predict.fda {mda}R Documentation

make predictions from an fda object

Usage

predict.fda(object, x, type, prior, dimension)

Arguments

object An object of class fda.
x New data at which to make predictions. If missing, the training data is used.
type kind of predictions: type = class (default) produces a fitted factor, type = variates produces a matrix of discriminant variables, type = posterior produces a matrix of posterior probabilities (based on a gaussian assumption), and type=hierarchical produces the predicted class in sequence for models of all dimensions.
prior the prior probabability vector for each class; the default is the training sample proportions.
dimension the dimension of the space to be used, no larger than the dimension component of object.

Value

An appropriate object depending on type. object has a component "fit"

See Also

fda, mars, bruto, polyreg, softmax, confusion

Examples

data(iris)
irisfit <- fda(Species ~ ., data = iris)
irisfit
## Call:
## fda(x = iris$x, g = iris$g)
## 
## Dimension: 2 
##
## Percent Between-Group Variance Explained:
##     v1  v2 
##  99.12 100
confusion(predict(irisfit, iris), iris$Species)
##            Setosa Versicolor Virginica
##     Setosa     50          0         0
## Versicolor      0         48         1
##  Virginica      0          2        49
## attr(, "error"):
## [1] 0.02


[Package Contents]