predict.qda.Rd
Classify multivariate observations in conjunction with qda
# S3 method for qda predict(object, newdata, prior = object$prior, method = c("plug-in", "predictive", "debiased", "looCV"), ...)
object | object of class |
---|---|
newdata | data frame of cases to be classified or, if |
prior | The prior probabilities of the classes, by default the proportions in the
training set or what was set in the call to |
method | This determines how the parameter estimation is handled. With |
... | arguments based from or to other methods |
a list with components
The MAP classification (a factor)
posterior probabilities for the classes
This function is a method for the generic function
predict()
for class "qda"
.
It can be invoked by calling predict(x)
for an
object x
of the appropriate class, or directly by
calling predict.qda(x)
regardless of the
class of the object.
Missing values in newdata
are handled by returning NA
if the
quadratic discriminants cannot be evaluated. If newdata
is omitted and
the na.action
of the fit omitted cases, these will be omitted on the
prediction.
Venables, W. N. and Ripley, B. D. (2002) Modern Applied Statistics with S. Fourth edition. Springer.
Ripley, B. D. (1996) Pattern Recognition and Neural Networks. Cambridge University Press.
tr <- sample(1:50, 25) train <- rbind(iris3[tr,,1], iris3[tr,,2], iris3[tr,,3]) test <- rbind(iris3[-tr,,1], iris3[-tr,,2], iris3[-tr,,3]) cl <- factor(c(rep("s",25), rep("c",25), rep("v",25))) zq <- qda(train, cl) predict(zq, test)$class#> [1] s s s s s s s s s s s s s s s s s s s s s s s s s c c c c c c c c c v c c c #> [39] c c c v c c c c c c c c v v v v v v v v v v v v v v v v v v v v v v v v v #> Levels: c s v