Learn R Programming

fda.usc (version 1.2.3)

predict.classif: Predicts from a fitted classif object.

Description

Classifier of functional data by kernel method using functional data object of class classif.

Usage

"predict"(object, new.fdataobj,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.

Details

Returns the predicted classes using a previously trained model.

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.classif(out1)
# 
# #	PREDICTION knn
# mtest<-phoneme[["test"]][1:100]
# gtest<-phoneme[["classtest"]][1:100]
# pred1=predict.classif(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.classif(out2)
# #	PREDICTION kernel
# pred2=predict.classif(out2,mtest)
# table(pred2,gtest)
# ## End(Not run)

Run the code above in your browser using DataLab