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

View source: R/fregre.basis.R

fregre.basisR Documentation

Functional Regression with scalar response using basis representation.

Description

Computes functional regression between functional explanatory variable X(t) and scalar response Y using basis representation.

Usage

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

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

See eval.penalty.

weights

weights

...

Further arguments passed to or from other methods.

Details

Y=<X,β>+ε

where <.,.> denotes the inner product on L_2 and ε are random errors with mean zero, finite variance σ^2 and E[X(t)ε]=0.

The function uses the basis representation proposed by Ramsay and Silverman (2005) to model the relationship between the scalar response and the functional covariate by basis representation of the observed functional data X(t) and the unknown functional parameter β(t).

The functional linear models estimated by the expression:

y.est= < X,β.est > = C'ψφ' β.est=Zβ.est

where Z=C'ψφ', and β.est=(Z'Z)^{-1}Z'y and so, y.est=Z(Z'Z)^{-1}Z'y where H is the hat matrix with degrees of freedom: df=tr(H).

If λ>0 then fregre.basis incorporates a roughness penalty:
y.est=Z(Z'Z+λ R_0)^{-1} Z'y= H_{λ}y where R_0 is the penalty matrix.

This function allows covariates of class fdata, matrix, data.frame or directly covariates of class fd. The function also gives default values to arguments basis.x and basis.b for representation on the basis of functional data X(t) and the functional parameter β(t), respectively.

If basis=NULL creates the bspline basis by create.bspline.basis.
If the functional covariate fdataobj is a matrix or data.frame, it creates an object of class "fdata" with default attributes, see fdata.
If basis.x$type=``fourier'' and basis.b$type=``fourier'', the basis are orthonormal and the function decreases the number of fourier basis elements on the min(k.x,k_b), where k.x and k.b are the number of basis element of basis.x and basis.b respectively.

Value

Return:

  • call: The matched call.

  • coefficients: A named vector of coefficients

  • residuals: y minus fitted values.

  • fitted.values: Estimated scalar response.

  • beta.est: beta parameter estimated of class fd

  • weights:(only for' weighted fits) the specified weights.

  • df.residual: The residual degrees of' freedom.

  • r2: Coefficient of determination.

  • sr2: Residual' variance.

  • Vp: Estimated covariance matrix for the parameters.

  • H: Hat matrix.

  • y: Response.

  • fdataobj: Functional explanatory data of class fdata.

  • a.est: Intercept parameter estimated

  • basis.b: Basis used' for beta parameter estimation.

  • lambda.opt: A roughness penalty.

  • Lfdobj: Order of a derivative or a linear differential operator.

  • P: Penalty matrix.

  • lm: Return lm object

Author(s)

Manuel Febrero-Bande, Manuel Oviedo de la Fuente manuel.oviedo@udc.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. https://www.jstatsoft.org/v51/i04/

See Also

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

Examples

## Not run: 
# 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)

## End(Not run)

fda.usc documentation built on Oct. 17, 2022, 9:06 a.m.