Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

fregre.lm

Fitting Functional Linear Models


Description

Computes functional regression between functional (and non functional) explanatory variables and scalar response using basis representation.

Usage

fregre.lm(
  formula,
  data,
  basis.x = NULL,
  basis.b = NULL,
  rn,
  lambda,
  weights = rep(1, n),
  ...
)

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.

data

List that containing the variables in the model.

basis.x

List of basis for functional explanatory data estimation.

basis.b

List of basis for functional beta parameter estimation.

rn

List of Ridge parameter.

lambda

List of Roughness penalty parameter.

weights

weights

...

Further arguments passed to or from other methods.

Details

This section is presented as an extension of the linear regression models: fregre.pc, fregre.pls and fregre.basis. Now, the scalar response Y is estimated by more than one functional covariate X^j(t) and also more than one non functional covariate Z^j. The regression model is given by:

E[Y|X,Z]=α+∑_j β_j Z^j + ∑_k <X^k,β_k>

where Z=[Z^1,...,Z^p] are the non functional covariates, X(t)=[X^1(t),...,X^q(t)] are the functional ones and ε are random errors with mean zero , finite variance σ^2 and E[X(t)ε]=0.

The first item in the data list is called "df" and is a data frame with the response and non functional explanatory variables, as lm. 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.fd create.pc.basis, create.fdata.basis or create.basis.
basis.b is a list of basis for represent each functional β_k parameter. If basis.x is a list of functional principal components basis (see create.pc.basis or pca.fd) the argument basis.b (is unnecessary and) is ignored.

The user can penalty the basis elements by: (i) lambda is a list of rough penalty values for the second derivative of each functional covariate, see fregre.basis for more details.
(ii) rn is a list of Ridge penalty value for each functional covariate, see fregre.pc, fregre.pls and P.penalty for more details.
Note: For the case of the Functional Principal Components basis two penalties are allowed (but not the two together).

Value

Return lm object plus:

  • sr2 Residual variance.

  • Vp Estimated covariance matrix for the parameters.

  • lambda A roughness penalty.

  • basis.x Basis used for fdata or fd covariates.

  • basis.b Basis used for beta parameter estimation.

  • beta.l List of estimated beta parameter of functional covariates.

  • data List that containing the variables in the model.

  • formula formula.

Author(s)

Manuel Febrero-Bande, Manuel Oviedo de la Fuente manuel.oviedo@usc.es

References

Ramsay, James O., and Silverman, Bernard W. (2006), Functional Data Analysis, 2nd ed., Springer, New York.

Febrero-Bande, M., Oviedo de la Fuente, M. (2012). Statistical Computing in Functional Data Analysis: The R Package fda.usc. Journal of Statistical Software, 51(4), 1-28. http://www.jstatsoft.org/v51/i04/

See Also

See Also as: predict.fregre.lm and summary.lm.
Alternative method: fregre.glm.

Examples

data(tecator)
x=tecator$absorp.fdata
y=tecator$y$Fat
tt=x[["argvals"]]
dataf=as.data.frame(tecator$y)

nbasis.x=11
nbasis.b=7
basis1=create.bspline.basis(rangeval=range(tt),nbasis=nbasis.x)
basis2=create.bspline.basis(rangeval=range(tt),nbasis=nbasis.b)
 
f=Fat~Protein+x
basis.x=list("x"=basis1)
basis.b=list("x"=basis2)
ldata=list("df"=dataf,"x"=x)
res=fregre.lm(f,ldata,basis.x=basis.x,basis.b=basis.b)
summary(res)

f2=Fat~Protein+xd
xd=fdata.deriv(x,nderiv=2,class.out='fdata',nbasis=nbasis.x)
ldata2=list("df"=dataf,"xd"=xd)
basis.x2=list("xd"=basis1)
basis.b2=list("xd"=basis2)
res2=fregre.lm(f2,ldata2,basis.x=basis.x2,basis.b=basis.b2)
summary(res2)

par(mfrow=c(2,1))
plot(res$beta.l$x,main="functional beta estimation")
plot(res2$beta.l$xd,col=2)

fda.usc

Functional Data Analysis and Utilities for Statistical Computing

v2.0.2
GPL-2
Authors
Manuel Febrero Bande [aut], Manuel Oviedo de la Fuente [aut, cre], Pedro Galeano [ctb], Alicia Nieto [ctb], Eduardo Garcia-Portugues [ctb]
Initial release
2020-02-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.