Learn R Programming

fda.usc (version 1.1.0)

predict.classif: Predicts from a fitted classif object.

Description

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

Usage

## S3 method for class 'classif':
predict(object, new.fdataobj,type="class",\dots)

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
!=''class'', for each functional data shows the probability of each group membership.
...
Further arguments passed to or from other methods.

Value

  • group.predVector of groups or classes predicted
  • prob.groupFor each functional data shows the probability of each group membership.

Details

Returns the groups or classes predicted using a previously trained model.

References

Ferraty, F. and Vieu, P. (2006). Nonparametricc functional data analysis. Springer Series in Statistics, New York. Ferraty, F. and Vieu, P. (2006). NPFDA in practice. Free access on line at http://www.lsp.ups-tlse.fr/staph/npfda/ Ramsay, James O., and Silverman, Bernard W. (2006), Functional Data Analysis, 2nd ed., Springer, New York. Ramsay, James O., and Silverman, Bernard W. (2002), Applied Functional Data Analysis, Springer, New York.

See Also

See also classif.knn, classif.kernel and summary.classif .

Examples

Run this code
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)
#MisclasPredict <- sum(pred1 != gtest)/length(gtest)
#MisclasPredict

##	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)
# MisclasPredict <- sum(pred2!= gtest)/length(gtest)
# MisclasPredict

Run the code above in your browser using DataLab