Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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 class '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.

Author(s)

Manuel Febrero-Bande, Manuel Oviedo de la Fuente manuel.oviedo@usc.es

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

Examples

## 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)

## End(Not run)

fda.usc

Functional Data Analysis and Utilities for Statistical Computing

v2.0.2
GPL-2
Authors
Manuel Febrero Bande [aut], Manuel Oviedo de la Fuente [aut, cre], Pedro Galeano [ctb], Alicia Nieto [ctb], Eduardo Garcia-Portugues [ctb]
Initial release
2020-02-17

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.