fda.usc (version 1.5.0)

classif.tree: Classification Fitting Functional Recursive Partitioning and Regression Trees

Description

Computes functional classification using functional (and non functional) explanatory variables by rpart model

Usage

classif.tree(formula,data,basis.x=NULL,basis.b=NULL,CV=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.

basis.x

List of basis for functional explanatory data estimation.

basis.b

List of basis for functional beta parameter estimation.

CV

=TRUE, Cross-validation (CV) is done .

Further arguments passed to or from other methods.

Value

Return rpart object plus:

basis.x

Basis used for fdata or fd covariates.

basis.b

Basis used for beta parameter estimation.

beta.l

List of estimated beta parameter of functional covariates.

data

List that containing the variables in the model.

formula

formula.

CV

\$y.pred predicted response by cross-validation.

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

Functional covariates of class fdata or fd are introduced in the following items in the data list. basis.x is a list of basis for represent each functional covariate. The basis object can be created by the function: create.pc.basis, pca.fd create.pc.basis, create.fdata.basis o create.basis. basis.b is a list of basis for represent each functional beta parameter. If basis.x is a list of functional principal components basis (see create.pc.basis or pca.fd) the argument basis.b is ignored.

References

Ramsay, James O., and Silverman, Bernard W. (2006), Functional Data Analysis, 2nd ed., Springer, New York. McCullagh and Nelder (1989), Generalized Linear Models 2nd ed. Chapman and Hall. Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S, New York: Springer.

See Also

See Also as: rpart. Alternative method: classif.glm.

Examples

Run this code
# NOT RUN {
data(phoneme)
mlearn<-phoneme[["learn"]]
glearn<-phoneme[["classlearn"]]
mtest<-phoneme[["test"]]
gtest<-phoneme[["classtest"]]
dataf<-data.frame(glearn)
dat=list("df"=dataf,"x"=mlearn)
a1<-classif.tree(glearn~x,data=dat)
summary(a1)
newdat<-list("x"=mtest)
p1<-predict.classif(a1,newdat,type="class")
table(gtest,p1)
sum(p1==gtest)/250
# }

Run the code above in your browser using DataLab