fcRegression {MECfda} | R Documentation |
Solve linear models with functional covariate(s)
Description
Function to fit (generalized) linear model with functional covariate(s). Model allows one or multiple functional covariate(s) as fixed effect(s), and zero, one, or multiple scalar-valued fixed or random effect(s).
Usage
fcRegression(
Y,
FC,
Z,
formula.Z,
family = gaussian(link = "identity"),
basis.type = c("Fourier", "Bspline"),
basis.order = 6L,
bs_degree = 3
)
Arguments
Y |
Response variable, can be an atomic vector, a one-column matrix or data frame, recommended form is a one-column data frame with column name. |
FC |
Functional covariate(s), can be a "functional_variable" object or a matrix or a data frame or a list of these object(s). |
Z |
Scalar covariate(s), can be NULL or not input (when there's no scalar covariate), an atomic vector (when only one scalar covariate), a matrix or data frame, recommended form is a data frame with column name(s). |
formula.Z |
A formula without the response variable,
contains only scalar covariate(s) (or intercept),
use the format of lme4 package if random effects exist. e.g. ~ Z_1 + (1|Z_2).
(See |
family |
A description of the error distribution and link function to be used in the model,
see |
basis.type |
Type of funtion basis.
Can only be assigned as one type even if there is more than one functional covariates.
Available options: 'Fourier' or 'Bspline', represent Fourier basis and b-spline basis respectively.
For the detailed form for Fourier and b-splines basis,
see |
basis.order |
Indicate number of the function basis.
When using Fourier basis |
bs_degree |
Degree of the piecewise polynomials if use b-splines basis,
default is 3. See |
Details
Solve linear models with functional covariates below
g(E(Y_i|X_i,Z_i)) = \sum_{l=1}^{L} \int_{\Omega_l} \beta_l(t) X_{li}(t) dt + (1,Z_i^T)\gamma
where the scalar-valued covariates can be fixed or random effect or doesn't exist (may do not contain scalar-valued covariates).
Value
fcRegression returns an object of class "fcRegression". It is a list that contains the following elements.
regression_result |
Result of the regression. |
FC.BasisCoefficient |
A list of Fourier_series or bspline_series object(s), represents the functional linear coefficient(s) of the functional covariates. |
function.basis.type |
Type of funtion basis used. |
basis.order |
Same as in the arguemnets. |
data |
Original data. |
bs_degree |
Degree of the splines, returned only if b-splines basis is used. |
Author(s)
Heyang Ji
Examples
data(MECfda.data.sim.0.0)
res = fcRegression(FC = MECfda.data.sim.0.0$FC, Y=MECfda.data.sim.0.0$Y, Z=MECfda.data.sim.0.0$Z,
basis.order = 5, basis.type = c('Bspline'),
formula.Z = ~ Z_1 + (1|Z_2))