Learn R Programming

fda.usc (version 0.9.4)

fregre.basis.cv: Cross-validation Functional Regression with scalar response using basis representation.

Description

Computes functional regression between functional explanatory variables and scalar response using basis representation by cross-validation method.

Usage

fregre.basis.cv(fdataobj,y,basis.x=NULL,basis.b=NULL,
type.basis=NULL,lambda=0,Lfdobj=vec2Lfd(c(0,0),rtt),
type.CV=GCV.S,par.CV=list(trim=0),...)

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.
type.basis
A vector of character string which determines type of basis. By default "bspline". It is only used when basis.x or basis.b are a vector of number of basis considered.
lambda
A roughness penalty. By default, no penalty lambda=0.
Lfdobj
type.CV
Type of cross-validation. By default generalized cross-validation GCV.S method.
par.CV
List of parameters for type.CV: trim, the alpha of the trimming and draw.
...
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.
  • yScalar response.
  • fdataobjFunctional explanatory data of class fdata.
  • lambda.optlambda value that minimizes CV or GCV method.
  • gcv.optMinimum value of CV or GCV method. If lambda=0, gcv.opt=NA.
  • basis.x.optBasis used for functional explanatory data estimation fdata.
  • basis.bBasis used for for functional beta parameter estimation.
  • lmReturn lm object.

Details

If basis = NULL creates 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, summary.fregre.fd and predict.fregre.fd . Alternative method: fregre.pc.cv and fregre.np.cv.

Examples

Run this code
data(tecator)
x<-tecator$absorp.fdata
y=tecator$y$Fat
tt=x[["argvals"]]
a=seq(21,77,by=8)
b=seq(5,17,by=4)
l=2^(-4:15)
res1=fregre.basis.cv(x,y)
summary(res1)
res2=fregre.basis.cv(x,y,a,b,lambda=l,type.CV=GCV.S,par.CV=list(trim=0.05))
ind=c(7,8,9,13,14)
rbind(c(res1[ind],res1$basis.x.opt$type,res1$basis.x.opt$nbasis,
res1$basis.x.opt$type,res1$basis.b.opt$nbasis),
c(res2[ind],res2$basis.x.opt$type,res2$basis.x.opt$nbasis,res2$basis.x.opt$type
,res2$basis.b.opt$nbasis))

Run the code above in your browser using DataLab