The argument “classifiers” of the function “clover_plot” determines which classifiers should be plotted in the clover plot. The default value is c(“QDA”,“DD1”). Possible values are “none”, “all”, “QDA”, “DD0”, “DD1”, “DD2”, “BB0”, “BB1”, “II0”, “II1”. Here “QDA” is the quadratic discriminant rule; “DD0” denotes the max-depth classifier, “DD1” and “DD2” denote the linear and quadratic DD-classifier, respectively; “BB0” classifies points according to the minimum bagdistance rule, “BB1” gives the best separating line in the bagdistance-bagdistance plot; “II0” classifies points according to the minimum illumination rule, “II1” gives the best separating line in the illumination-illumination plot.

The classifying boundary curves are plotted in red, using a solid line for “DD0”, “BB0” and “II0”, a dashed line for “QDA”, “DD1”, “BB1” and “II1” and a dotted line for “DD2”.

Example

First we generate data from bivariate normal distributions with different means and the same variance matrices and compute the necessary quantities:

library(mvtnorm)

n1 <- 100
n2 <- 75

set.seed(2020)

X <- rmvnorm(n1, mean=c(0,0), sigma=diag(2)) # Observations of class 1
Y <- rmvnorm(n2, mean=c(2,2), sigma=diag(2)) # Observations of class 2

res <- clover_calc(X, Y)

The clover plot with default settings, showing the “QDA” and “DD1” classification rule:

clover_plot(res)
## Misclassification rate of the QDA classifier:   0.0857
## Non-classification rate of the QDA classifier:  0
## 
## Misclassification rate of the DD1 classifier:   0.0914
## Non-classification rate of the DD1 classifier:  0.0686

The clover plot showing different classifiers:

clover_plot(res, classifiers=c("QDA","DD0","DD1","BB1","II1"))
## Misclassification rate of the QDA classifier:   0.0857
## Non-classification rate of the QDA classifier:  0
## 
## Misclassification rate of the DD0 (max-depth) classifier:   0.0914
## Non-classification rate of the DD0 (max-depth) classifier:  0.0743
## 
## Misclassification rate of the DD1 classifier:   0.0914
## Non-classification rate of the DD1 classifier:  0.0686
## 
## Misclassification rate of the BB1 classifier:   0.0914
## Non-classification rate of the BB1 classifier:  0
## 
## Misclassification rate of the II1 classifier:   0.0857
## Non-classification rate of the II1 classifier:  0

The class labels of the observations X and Y, assigned by the classifiers specified in the function “clover_plot”, are returned as a silent output of this function. This allows the user to further use/analyse the results from the considered classifications.

Labels 1 and 2 correspond to the samples X and Y, respectively; label 0 is assigned to observations that cannot be classified by the given classifier. Note that the silent output is only returned for the static clover plot (for technical reasons).

a <- clover_plot(res, interactive=FALSE, classifiers=c("QDA","DD0"))

The result “a” is a list of vectors of class labels assigned by the specified classifiers, i.e. QDA and DD0 in this example.The vector of class labels assigned by the QDA to the observations in the sample X is now available as “a$QDA.classX”, and similarly for the sample Y and also for the max-depth classifier (DD0).

a$QDA.classX
##   [1] 1 1 1 1 1 1 1 1 1 1 2 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 1
##  [36] 2 1 1 1 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 1
##  [71] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
a$QDA.classY
##  [1] 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2 2
## [36] 1 2 2 2 1 1 2 2 2 2 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
## [71] 2 2 2 2 2
a$DD0.classX
##   [1] 1 1 0 1 1 1 1 1 0 1 2 1 1 2 1 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1
##  [36] 2 1 1 1 1 1 2 1 1 2 0 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 1 1 1 1 1 0
##  [71] 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 2 1 1 1 1 1 1 1
a$DD0.classY
##  [1] 2 2 1 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 1 2 2 2 2
## [36] 1 2 0 2 1 1 2 2 2 0 1 2 2 2 2 2 2 0 2 2 2 2 2 2 2 2 2 2 2 2 2 1 2 2 2
## [71] 0 2 2 2 2

The misclassification and non-classification rates then can be computed manually and/or separately for the two samples X and Y. An example for misclassification rates of “DD0”:

mean(c(a$DD0.classX==2,a$DD0.classY==1)) # Overall misclassification rate of DD0
## [1] 0.09142857
mean(a$DD0.classX==2)   # Misclassification rate of DD0 in X sample
## [1] 0.09
mean(a$DD0.classY==1)   # Misclassification rate of DD0 in Y sample 
## [1] 0.09333333

Back to the main page.