Learn R Programming

fda.usc (version 0.9.4)

fregre.basis: Functional Regression with scalar response using basis representation.

Description

Computes functional regression between functional explanatory variable and scalar response using basis representation.

Usage

fregre.basis(fdataobj,y,basis.x=NULL,basis.b=NULL,
lambda=0,Lfdobj=vec2Lfd(c(0,0),rtt),...)

Arguments

fdataobj
fdata class object.
y
Scalar response with length n.
basis.x
Basis for functional explanatory data fdataobj.
basis.b
Basis for functional beta parameter.
lambda
A roughness penalty. By default, no penalty lambda=0.
Lfdobj
...
Further arguments passed to or from other methods.

Value

  • Return:
  • callThe matched call.
  • beta.estbeta coefficient estimated of class fd
  • a.estIntercept parameter estimated
  • fitted.valuesEstimated scalar response.
  • HHat matrix.
  • residualsy minus fitted values.
  • dfThe residual degrees of freedom.
  • r2Coefficient of determination.
  • sr2Residual variance.
  • yResponse.
  • fdataobjFunctional explanatory data of class fdata.
  • basis.bBasis used for beta parameter estimation.
  • lmReturn lm object

Details

If basis=NULL creates the bspline basis. If the functional covariate fdataobj is in a format "raw data", such as matrix or data.frame, creates an object of class "fdata" with default attributes, see fdata.

References

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

See Also

See Also as: fregre.basis.cv, summary.fregre.fd and predict.fregre.fd. Alternative method: fregre.pc and fregre.np.

Examples

Run this code
# fregre.basis
data(tecator)
names(tecator)
absorp=tecator$absorp.fdata
ind=1:129
x=absorp[ind,]
y=tecator$y$Fat[ind]
tt=absorp[["argvals"]]


res1=fregre.basis(x,y)
summary(res1)
basis1=create.bspline.basis(rangeval=range(tt),nbasis=19)
basis2=create.bspline.basis(rangeval=range(tt),nbasis=9)
res5=fregre.basis(x,y,basis1,basis2)
summary(res5)
x.d2=fdata.deriv(x,nbasis=19,nderiv=1,method="bspline",class.out="fdata")
res7=fregre.basis(x.d2,y,basis1,basis2)
summary(res7)

Run the code above in your browser using DataLab