Description Usage Arguments Details Value See Also Examples
Classify multivariate observations in conjunction with
wqda
.
1 2 3 |
object |
Object of class |
newdata |
A |
prior |
The class prior probabilities. By default the proportions in the training data set. |
... |
Further arguments. |
This function is a method for the generic function
predict()
for class "wqda"
. It can be
invoked by calling predict(x)
for an object
x
of the appropriate class, or directly by calling
predict.wqda(x)
regardless of the class of the
object.
A list with components:
class |
The predicted class
labels (a |
posterior |
Matrix of class posterior probabilities. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | library(mlbench)
data(PimaIndiansDiabetes)
train <- sample(nrow(PimaIndiansDiabetes), 500)
# weighting observations from classes pos and neg according to their
# frequency in the data set:
ws <- as.numeric(1/table(PimaIndiansDiabetes$diabetes)
[PimaIndiansDiabetes$diabetes])
fit <- wqda(diabetes ~ ., data = PimaIndiansDiabetes, weights = ws,
subset = train)
pred <- predict(fit, newdata = PimaIndiansDiabetes[-train,])
mean(pred$class != PimaIndiansDiabetes$diabetes[-train])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.