Description Usage Arguments Details Value Author(s) See Also Examples
Classify provided observations based on a given Discriminant object
1 | classify(DA_object, newdata)
|
DA_object |
discriminant analysis object |
newdata |
vector or matrix or data frame with variables for which their classes will be calculated |
A DA_object
is a discriminant analysis (DA) object obtained from a
linear DA (class "linda"
) or a quadratic DA (class "quada"
).
A list with the following elements
scores |
discriminant scores for each observation |
pred_class |
predicted class |
Gaston Sanchez
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## Not run:
# load iris dataset
data(iris)
# linear discriminant analysis
my_lin1 = linDA(iris[,1:4], iris$Species)
# select a sample of 15 observations
set.seed(111)
obs = sample(1:nrow(iris), 15)
some_data = iris[obs, 1:4]
# classify some_data
get_classes = classify(my_lin1, some_data)
get_classes
# compare the results against original class
table(iris$Species[obs], get_classes$pred_class)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.