fda.usc (version 2.0.2)

fregre.basis: 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),
  ...
)

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 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

  • x.fd Centered functional explanatory data of class fd.

  • 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

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.

Author

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

Details

$$Y=\big<X,\beta\big>+\epsilon=\int_{T}{X(t)\beta(t)dt+\epsilon}$$ where \( \big< \cdot , \cdot \big>\) denotes the inner product on \(L_2\) and \(\epsilon\) are random errors with mean zero, finite variance \(\sigma^2\) and \(E[X(t)\epsilon]=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)\approx\sum_{k=1}^{k_{n1}} c_k \xi_k(t)\) and the unknown functional parameter \(\beta(t)\approx\sum_{k=1}^{k_{n2}} b_k \phi_k(t)\).

The functional linear models estimated by the expression: $$\hat{y}= \big< X,\hat{\beta} \big> = C^{T}\psi(t)\phi^{T}(t)\hat{b}=\tilde{X}\hat{b}$$ where \(\tilde{X}(t)=C^{T}\psi(t)\phi^{T}(t)\), and \(\hat{b}=(\tilde{X}^{T}\tilde{X})^{-1}\tilde{X}^{T}y\) and so, \(\hat{y}=\tilde{X}\hat{b}=\tilde{X}(\tilde{X}^{T}\tilde{X})^{-1}\tilde{X}^{T}y=Hy\) where \(H\) is the hat matrix with degrees of freedom: \(df=tr(H)\).

If \(\lambda>0\) then fregre.basis incorporates a roughness penalty:
\(\hat{y}=\tilde{X}\hat{b}=\tilde{X}(\tilde{X}^{T}\tilde{X}+\lambda R_0)^{-1}\tilde{X}^{T}y= H_{\lambda}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 \(\beta(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_{n1},k_{n2})\), where \(k_{n1}\) and \(k_{n2}\) are the number of basis element of basis.x and basis.b respectively.

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

Examples

Run this code
if (FALSE) {
# 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 DataCamp Workspace