Visualize LDA results with discrimination plots, loading plots, or histograms (for binary classification).
Arguments
- x
A
stat_ldaobject- type
Character. Type of plot:
"scores": LD score plot (default) - scatter for 2+ LDs, boxplot for 1 LD"loadings": Loading plot for first two LDs
- lds
Integer vector of length 2. Which LDs to plot for score/loading plots. Default is
c(1, 2). For binary classification (1 LD), only first element used.- color
Column name (bare or quoted) for coloring points. Default uses the response variable.
- labels
Column name (bare or quoted) for text labels in score plot. For loadings, logical: should variable names be shown? Default
TRUE.- chull
Logical. Draw convex hulls around groups? Only works when
coloris a factor. DefaultTRUE.- cex
Numeric. Character expansion for labels. Default is 0.7.
- legend
Logical. Show legend for colors? Default
TRUE.- ...
Additional arguments (reserved for future use)
Examples
if (FALSE) { # \dontrun{
lda <- boteft %>% stat_lda(type)
# Score plot (default)
plot(lda)
plot(lda, color = type)
plot(lda, labels = pred)
plot(lda, color = type, chull = TRUE)
# Different LDs
plot(lda, lds = c(2, 3))
# Loading plot
plot(lda, type = "loadings")
plot(lda, type = "loadings", labels = FALSE)
} # }
