Learn R Programming

fda.usc (version 0.9.4)

predict.fregre.gkam: Predict method for functional generalized kernel additive model of fregre.gkam fits object

Description

Computes predictions for regression between functional explanatory variables and scalar response using backfitting algorithm.

Usage

## S3 method for class 'fregre.gkam':
predict(object, newx = NULL, type = "response",\dots)

Arguments

object
fregre.gkam object.
newx
An optional data list in which to look for variables with which to predict. If omitted, the fitted values are used. List of new explanatory data.
type
Type of prediction (response or model term).
...
Further arguments passed to or from other methods.

Value

  • Return:
  • predict.kgamproduces a vector of predictions

Details

Predicts from a fitted fregre.kgam object. This function uses the model fitting function gam properties. If using functional data derived, is recommended to use a number of bases to represent beta lower than the number of bases used to represent the functional data. The first item in the data list of newx argument is called "df" and is a data frame with the response and non functional explanatory variables, as lm. Functional variables (fdata and fd class) are introduced in the following items in the data list of newx argument.

References

Febrero-Bande M. and Gonz'{a}lez-Manteiga W. (2011). Generalized Additive Models for Functional Data. Recent Advances in functional Data Analyisis and Related Topics. Physica-Velag. McCullagh and Nelder (1989), Generalized Linear Models 2nd ed. Chapman and Hall. Opsomer J.D. and Ruppert D.(1997). Fitting a bivariate additive model by local polynomial regression.Annals of Statistics, 25, 186-211.

See Also

See Also as: fregre.gsam.

Examples

Run this code
data(tecator)
ind<-1:129
ab=tecator$absorp.fdata
ab2=fdata.deriv(ab,2)

# Example: Binomial family 
ycat=ifelse(tecator$y[,"Fat"]<15,0,1)
yfat.cat<-ycat[ind]
f<-yfat.cat~ab+ab2
xlist=list("df"=data.frame(yfat.cat),"ab"=ab[ind],"ab2"=ab2[ind])

# Time-consuming 
res=fregre.gkam(f,family=binomial(),data=xlist,control=list(maxit=2))
newxlist=list("ab"=ab[-ind],"ab2"=ab2[-ind])

pred=predict(res,newxlist)
table(ycat[-ind],ifelse(pred<.5,0,1))

Run the code above in your browser using DataLab