Last chance! 50% off unlimited learning
Sale ends in
qda
## S3 method for class 'qda':
predict(object, newdata, prior = object$prior,
method = c("plug-in", "predictive", "debiased", "looCV"), ...)
"qda"
object
has a formula, a data frame with columns of the same names as the
variables used. A vector will be interpreted
as a row vector. If newdata is missing, an attempt will be
made to retqda
."plug-in"
(the default) the usual unbiased parameter estimates are used and
assumed to be correct. With "debiased"
an unbiased estimator of
the log posterior probabilipredict()
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.
Ripley, B. D. (1996) Pattern Recognition and Neural Networks. Cambridge University Press.
qda
, lda
, predict.lda
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
Run the code above in your browser using DataLab