qda(x, ...)## S3 method for class 'formula':
qda(formula, data, \dots, subset, na.action)
## S3 method for class 'default':
qda(x, grouping, prior = proportions,
method, CV = FALSE, nu, \dots)
## S3 method for class 'data.frame':
qda(x, \dots)
## S3 method for class 'matrix':
qda(x, grouping, \dots, subset, na.action)
groups ~ x1 + x2 + ...
That is, the
response is the grouping factor and the right hand side specifies
the (non-factor) discriminators.formula
are
preferentially to be taken.NA
s are found.
The default action is for the procedure to fail. An alternative is
na.omit, which leads to rejection of cases with missing values on
any required variable. (NOTE: If given, this"moment"
for standard estimators of the mean and variance,
"mle"
for MLEs, "mve"
to use cov.mve
, or "t"
for robust
estimates based on a t distribution.method = "t"
."qda"
containing the following components:i
, scaling[,,i]
is an array which transforms observations
so that within-groups covariance matrix is spherical.CV=TRUE
, when the return value is a list with components:Ripley, B. D. (1996) Pattern Recognition and Neural Networks. Cambridge University Press.
predict.qda
, 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)))
z <- qda(train, cl)
predict(z,test)$class
Run the code above in your browser using DataLab