Learn R Programming

fda.usc (version 0.9.4)

fregre.plm: Semi-functional linear regression with scalar response.

Description

Computes functional regression between functional (and non functional) explanatory variables and scalar response using asymmetric kernel estimation.

Usage

fregre.plm(formula,data,h=NULL,Ker=AKer.norm,metric=metric.lp,
type.CV = GCV.S,type.S=S.NW,par.CV=list(trim=0,draw=FALSE),...)

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.
Ker
Type of asymmetric kernel used, by default asymmetric normal kernel.
h
Smoothing parameter or bandwidth.
metric
Metric function, by default metric.lp.
type.CV
Type of cross-validation. By default generalized cross-validation GCV.S method.
type.S
Type of smothing matrix S. By default S is calculated by Nadaraya-Watson kernel estimator (S.NW).
par.CV
List of parameters for type.CV: trim, the alpha of the trimming and draw=TRUE.
...
Further arguments passed to or from other methods.

Value

  • callThe matched call.
  • fitted.valuesEstimated scalar response.
  • residualsy minus fitted values.
  • dfThe residual degrees of freedom.
  • HHat matrix.
  • r2Coefficient of determination.
  • sr2Residual variance.
  • yScalar response.
  • fdataobjFunctional explanatory data.
  • XXNon functional explanatory data.
  • mdistDistance matrix between curves.
  • betahbeta coefficient estimated
  • dataList that containing the variables in the model.
  • KerAsymmetric kernel used.
  • h.optValue that minimizes CV or GCV method.
  • hSmoothing parameter or bandwidth.
  • dataList that containing the variables in the model.
  • gcvGCV values.
  • formulaformula.

Details

The first item in the data list is called "df" and is a data frame with the response and non functional explanatory variables, as link{lm} . If non functional data into the formula then lm regression is performed. Functional variable (fdata or fd class) is introduced in the second item in the data list. If only functional variable into the formula then fregre.np.cv is performed. The function estimates the value of smoothing parameter or the bandwidth h through Generalized Cross-validation GCV criteria. It computes the distance between curves using the metric.lp, although you can also use other metric funtions. Different asymmetric kernels can be used, see Kernel.asymmetric.

References

Aneiros-Perez G. and Vieu P. (2005). Semi-functional partial linear regression. Statistics {&} Probability Letters, 76:1102-1110. Ferraty, F. and Vieu, P. (2006). Nonparametric functional data analysis. Springer Series in Statistics, New York. Hardle, W. Applied Nonparametric Regression. Cambridge University Press, 1994.

See Also

See Also as: predict.fregre.plm and summary.fregre.fd Alternative methods: fregre.lm, fregre.np and fregre.np.cv

Examples

Run this code
data(tecator)
x=tecator$absorp.fdata
newx=tecator$absorp.fdata
y=tecator$y$Fat
dataf=as.data.frame(tecator$y)

f=Fat~Water+x
ldata=list("df"=dataf,"x"=x)
res.plm=fregre.plm(f,ldata)
summary(res.plm)

# with 2nd derivative of functional data
x.fd=fdata.deriv(x,nderiv=2)
f2=Fat~Water+x.fd
ldata2=list("df"=dataf,"x.fd"=x.fd)
res.plm2=fregre.plm(f2,ldata2)#,Ker=AKer.tri)
summary(res.plm)

par(mfrow=c(2,1))
plot(y,res.plm$fitted.values)
points(y,res.plm2$fitted.values,col=2)
plot(res.plm$residuals)
points(res.plm2$residuals,col=2)

# fregre.plm as fregre.np.cv
f=Fat~+x
res.np=fregre.plm(f,ldata)
res.np2=fregre.np.cv(x,y)
res.np
res.np2
# fregre.plm as lm
f=Fat~+Water
res.lm=fregre.plm(f,ldata)
res.lm2=lm(f,dataf)
res.lm
res.lm2

Run the code above in your browser using DataLab