predict.mda {mda} | R Documentation |
predict.mda(object, x, type, prior, dimension, ...)
object |
a fitted mda object |
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 (note that the maximal
dimension is determined by the number of subclasses),
type = posterior produces a matrix of posterior
probabilities (based on a gaussian assumption),
type = hierarchical produces the predicted class in
sequence for models of dimensions specified by dimension
argument. |
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 , and in general <
R, the number of subclasses. Dimension can be a vector for use
with type = "hierarchical" . |
An appropriate object depending on type
. object
has a
component "fit"
which is regression fit produced by the
method
argument to mda
. There should be a
predict
method for this object which is invoked. This method
should itself take as input object
and optionally x
.
mda
,
fda
,
mars
,
bruto
,
polyreg
,
softmax
,
confusion
data(glass) samp <- sample(1:nrow(glass), 100) glass.train <- glass[samp,] glass.test <- glass[-samp,] glass.mda <- mda(Type ~ ., data = glass.train) predict(glass.mda, glass.test, type = "post") # abbreviations are allowed confusion(glass.mda, glass.test)