fda.usc (version 2.0.1)

predict.classif: Predicts from a fitted classif object.

Description

Classifier of functional data by kernel method using functional data object of class classif. Returns the predicted classes using a previously trained model.

Usage

# S3 method for classif
predict(object, new.fdataobj = NULL, type = "class", ...)

Arguments

object

Object object estimated by: k nearest neighbors method classif.knn, kernel method classif.kernel.

new.fdataobj

New functional explanatory data of fdata class.

type

Type of prediction ("class or probability of each group membership").

Further arguments passed to or from other methods.

Value

If type="class", produces a vector of predictions. If type="probs", a list with the following components is returned:

  • group.pred the vector of predictions.

  • prob.group the matrix of predicted probability by factor level.

References

Ferraty, F. and Vieu, P. (2006). Nonparametricc functional data analysis. Springer Series in Statistics, New York.

Ramsay, James O., and Silverman, Bernard W. (2006), Functional Data Analysis, 2nd ed., Springer, New York.

See Also

See also classif.np classif.glm, classif.gsam and classif.gkam .

Examples

Run this code
# NOT RUN {
data(phoneme)
mlearn<-phoneme[["learn"]][1:100]
glearn<-phoneme[["classlearn"]][1:100]

#	ESTIMATION knn
out1=classif.knn(glearn,mlearn,knn=3)
summary(out1)

#	PREDICTION knn
mtest<-phoneme[["test"]][1:100]
gtest<-phoneme[["classtest"]][1:100]
pred1=predict(out1,mtest)
table(pred1,gtest)

#	ESTIMATION kernel 
h=2^(0:5)
# using metric distances computed in classif.knn
out2=classif.kernel(glearn,mlearn,h=h,metric=out1$mdist)
summary(out2)
#	PREDICTION kernel
pred2=predict(out2,mtest)
table(pred2,gtest)
# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace