qda(x, …)# S3 method for formula
qda(formula, data, …, subset, na.action)
# S3 method for default
qda(x, grouping, prior = proportions,
method, CV = FALSE, nu, …)
# S3 method for data.frame
qda(x, …)
# S3 method for matrix
qda(x, grouping, …, 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 argument must be named.)
"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:
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