`FMA.historical.CV.Rd`

This function performs functional mediation regression under the historical influence model. Tuning parameter is chosen based on cross-validation.

```
FMA.historical.CV(Z, M, Y, delta.grid1 = 1, delta.grid2 = 1, delta.grid3 = 1,
intercept = TRUE, basis1 = NULL, Ld2.basis1 = NULL, basis2 = NULL, Ld2.basis2 = NULL,
basis.type = c("fourier"), nbasis1 = 3, nbasis2 = 3,
timeinv = c(0, 1), timegrids = NULL, lambda1 = NULL, lambda2 = NULL, nfolds = 5)
```

Z | a data matrix. |
---|---|

M | a data matrix. |

Y | a data matrix. |

delta.grid1 | a number indicates the width of treatment-mediator time interval in the mediator model. |

delta.grid2 | a number indicates the width of treatment-outcome time interval in the outcome model. |

delta.grid3 | a number indicates the width of mediator-outcome time interval in the outcome model. |

intercept | a logic variable. Default is |

basis1 | a data matrix. Basis function on the \(s\) domain used in the functional data analysis. The number of columns is the number of basis function considered. If |

Ld2.basis1 | a data matrix. The second derivative of the basis function on the \(s\) domain. The number of columns is the number of basis function considered. If |

basis2 | a data matrix. Basis function on the \(t\) domain used in the functional data analysis. The number of columns is the number of basis function considered. If |

Ld2.basis2 | a data matrix. The second derivative of the basis function on the \(t\) domain. The number of columns is the number of basis function considered. If |

basis.type | a character of basis function type. Default is Fourier basis ( |

nbasis1 | an integer, the number of basis function on the \(s\) domain included. If |

nbasis2 | an integer, the number of basis function on the \(t\) domain included. If |

timeinv | a numeric vector of length two, the time interval considered in the analysis. Default is (0,1). |

timegrids | a numeric vector of time grids of measurement. If |

lambda1 | a numeric vector of tuning parameter values on the \(s\) domain. |

lambda2 | a numeric vector of tuning parameter values on the \(t\) domain. |

nfolds | a number gives the number of folds in cross-validation. |

The historical influence mediation model is $$M(t)=\int_{\Omega_{t}^{1}}Z(s)\alpha(s,t)ds+\epsilon_{1}(t),$$ $$Y(t)=\int_{\Omega_{t}^{2}}Z(s)\gamma(s,t)ds+\int_{\Omega_{t}^{3}}M(s)\beta(s,t)ds+\epsilon_{2}(t),$$ where \(\alpha(s,t)\), \(\beta(s,t)\), \(\gamma(s,t)\) are coefficient curves; \(\Omega_{t}^{j}=[(t-\delta_{j})\vee 0,t]\) for \(j=1,2,3\). The model coefficient curves are estimated by minimizing the penalized \(L_{2}\)-loss. Tuning parameter \(\lambda\) controls the smoothness of the estimated curves, and is chosen by cross-validation.

the basis functions on the \(s\) domain used in the analysis.

the basis functions on the \(t\) domain used in the analysis.

a list of output for the mediator model `coefficient`

: the estimated coefficient with respect to the basis function `curve`

: the estimated coefficient curve `fitted`

: the fitted value of `M`

`lambda1`

: the chosen \(\lambda\) value on the \(s\) domain `lambda2`

: the chosen \(\lambda\) value on the \(t\) domain

a list of output for the outcome model `coefficient`

: the estimated coefficient with respect to the basis function `curve`

: the estimated coefficient curve `fitted`

: the fitted value of `Y`

`lambda1`

: the chosen \(\lambda\) value on the \(s\) domain `lambda2`

: the chosen \(\lambda\) value on the \(t\) domain

a list of output for the indirect effect comparing \(Z_{1}(t)=1\) versus \(Z_{0}(t)=0\) `curve`

: the estimated causal curve

a list of output for the direct effect comparing \(Z_{1}(t)=1\) versus \(Z_{0}(t)=0\) `curve`

: the estimated causal curve

Zhao et al. (2017). *Functional Mediation Analysis with an Application to Functional Magnetic Resonance Imaging Data.* arXiv preprint arXiv:1805.06923.

Yi Zhao, Johns Hopkins University, zhaoyi1026@gmail.com;

Xi Luo, Brown University xi.rossi.luo@gmail.com;

Martin Lindquist, Johns Hopkins University, mal2053@gmail.com;

Brian Caffo, Johns Hopkins University, bcaffo@gmail.com

```
##################################################
# Historical influence functional mediation model
data(env.historical)
Z<-get("Z",env.historical)
M<-get("M",env.historical)
Y<-get("Y",env.historical)
if (FALSE) {
# consider Fourier basis
fit<-FMA.historical.CV(Z,M,Y,delta.grid1=3,delta.grid2=3,delta.grid3=3,
intercept=FALSE,timeinv=c(0,300))
}
##################################################
```