Computes functional GAM model between functional covariate (X(t_1),...,X(t_q)) (and non functional covariate (Z1,...,Zp)) and scalar response Y.
This function is an extension of the functional generalized linear regression models: fregre.glm where the E[Y|X,Z] is related to the linear prediction η via a link function g(.) with integrated smoothness estimation by the smooth functions f(.).
where ξ_j^k is the coefficient of the basis function expansion of X^k, (in PCA analysis ξ_j^k is the score of the j-functional PC of X^k.
The smooth functions f(.) can be added to the right hand side of the formula to specify that the linear predictor depends on smooth functions of predictors using smooth terms s and te as in gam (or linear functionals of these as Zβ and < X(t),β(t) > in fregre.glm).
Usage
fregre.gsam(formula, family = gaussian(),data=list(),
weights=NULL,basis.x=NULL,basis.b=NULL,CV=FALSE,...)
Arguments
formula
an object of class formula (or one that can be coerced to that class): a symbolic description of the model to be fitted. The details of model specification are given under Details.
family
a description of the error distribution and link function to be used in the model. This can be a character string naming a family function, a family function or the result of a call to a family function. (See family for details of family functions.)
data
List that containing the variables in the model.
weights
weights
basis.x
List of basis for functional explanatory data estimation.
basis.b
List of basis for functional beta parameter estimation.
CV
=TRUE, Cross-validation (CV) is done.
...
Further arguments passed to or from other methods.
Details
The first item in the data list is called "df" and is a data frame with the response and non functional explanatory variables, as gam.
Functional covariates of class fdata or fd are introduced in the following items in the data list. basis.x is a list of basis for represent each functional covariate. The basis object can be created by the function: create.pc.basis, pca.fdcreate.pc.basis, create.fdata.basis o create.basis. basis.b is a list of basis for represent each functional beta parameter. If basis.x is a list of functional principal components basis (see create.pc.basis or pca.fd) the argument basis.b is ignored.
Value
Return gam object plus:
basis.x
Basis used for fdata or fd covariates.
basis.b
Basis used for beta parameter estimation.
data
List that containing the variables in the model.
formula
formula.
CV
$y.pred predicted response by cross-validation.
Note
If the formula only contains a non functional explanatory variables (multivariate covariates), the function compute a standard glm procedure.