felmdir | R Documentation |

Fit the response and predictor envelope model in function-on-function linear regression with dimensions ux and uy, using the direct estimation.

```
felmdir(X, Y, ux, uy, t1, t2, knots = c(0, 0.25, 0.5, 0.75, 1))
```

`X` |
Predictor function. An n by T1 matrix, T1 is number of observed time points, which is the length of t1. Here we assume that each function is observed at the same time points. |

`Y` |
Response function. An n by T2 matrix, T2 is number of observed time points, which is the length of t2. Here we assume that each function is observed at the same time points. |

`ux` |
Dimension of the predictor envelope. An integer between 0 and number of knots +2. |

`uy` |
Dimension of the response envelope. An integer between 0 and number of knots +2. |

`t1` |
The observed time points for the predictor functions. |

`t2` |
The observed time points for the response functions. |

`knots` |
The location of knots of the cubic splines used for estimation. Locations should be positive. The default location of the knots are 0, 0.25, 0.5, 0.75, 1. |

This function fits the envelope model to the function-on-function linear regression,

```
Y = \alpha + B X + \epsilon
```

,
where X and Y are random functions in Hilbert spaces `H_X`

and `H_Y`

, `\alpha`

is a fixed member in `H_Y`

, `\epsilon`

is a random member of `H_Y`

, and B: `H_X -> H_Y`

is a linear operator. We use cubic splines as the basis for both `H_X`

and `H_Y`

. The coefficients `[X]`

and `[Y]`

with respect to the basis are computed. The predictor and response envelope model is fitted on the linear regression model of `[Y]`

on `[X]`

. In this method, we do not need to estimate the eigenfunctions of `Sigma_X`

and `Sigma_\epsilon`

. Based on the estimation result, the fitted value of `Y`

is calculated. The standard function-on-function regression model also works through the linear regression model of `[Y]`

on `[X]`

. But instead of fitting an envelope model, it fits a standard linear regression model, based on which the fitted value of `[Y]`

is calculated. The details are elaborated in Section 5, direct estimation, in the reference of Su et al. (2022).

The output is a list that contains the following components:

`beta` |
The envelope estimator of the regression coefficients in the regression of |

`betafull` |
The standard estimator, i.e., the OLS estimator of the regression coefficients in the regression of |

`alpha` |
The envelope estimator of the intercept in the regression of |

`alphafull` |
The standard estimator of the intercept in the regression of |

`fitted.env` |
The fitted value of Y computed from the functional envelope linear model. |

`fitted.full` |
The fitted value of Y computed from the standard function-to-function linear model. |

Su, Z., Li, B. and Cook, R. D. (2022+) Envelope model for function-on-function linear regression.

```
data(NJdata)
dataX <- matrix(NJdata[,6], nrow = 21)
X <- as.matrix(dataX[, 32:61])
dataY <- matrix(NJdata[,3], nrow = 21)
Y <- as.matrix(dataY[, 32:61])
t1 <- 0:29
t2 <- t1
m <- felmdir(X, Y, 3, 1, t1, t2)
head(m$fitted.env)
head(m$fitted.full)
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.