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 geometric predictive DA (class
"geoda"
), a linear DA (class "linda"
), a
quadratic DA (class "quada"
), or a DISQUAL
analysis (class "disqual"
)
A list with the following elements
scores |
discriminant scores for each observation |
pred_class |
predicted class |
Gaston Sanchez
geoDA
, linDA
,
quaDA
, plsDA
,
disqual
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)
|
$scores
setosa versicolor virginica
1 72.204394 37.73393 -3.626036
2 11.523187 73.13868 69.971681
3 35.016494 71.91980 60.339169
4 72.407271 36.48113 -6.440942
5 97.625094 45.62021 -1.404146
6 85.223110 46.55924 5.797653
7 25.254888 74.92439 67.167839
8 23.616719 91.26464 95.590199
9 25.501982 115.82971 128.878440
10 30.470565 90.53837 89.741924
11 13.813633 60.37912 51.766075
12 8.252327 79.14437 83.169811
13 17.650298 97.28761 105.801427
14 39.288981 83.60302 74.590548
15 2.270057 79.48704 82.136496
$pred_class
[1] setosa versicolor versicolor setosa setosa setosa
[7] versicolor virginica virginica versicolor versicolor virginica
[13] virginica versicolor virginica
Levels: setosa versicolor virginica
setosa versicolor virginica
setosa 4 0 0
versicolor 0 6 0
virginica 0 0 5
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.