CVA | R Documentation |
This function performs canonical variate analysis as a descriptive visualisation tool. It is close to the 'lda()' function in the MASS package but it is not meant to be used for discriminant analyses.
CVA(dataset, groups, scale = TRUE, constraint = 3)
dataset |
dataset is a multidimensional matrix of observations |
groups |
groups is a vector coding for groupings |
scale |
whether the data needs to be standardised prior to analysis. Defaults to TRUE |
constraint |
It is the type of scaling for eigenvectors, so that canonical variates have: 1 = unit within-group standard deviations (most common); 2 = unit total standard deviations; 3 = unit within group norms; 4 = unit total norms. It defaults to 3 |
More detail can be found in a blog page, at 'https://www.statforbiology.com/2023/stat_multivar_cva/'. Please, note that preliminary data transformations (e.g.: standardisation) are left to the user and must be performed prior to analyses (see example below).
TOT |
matrix of total variances-covariances |
B |
matrix of 'between-groups' variances-covariances |
W |
matrix of 'within-group' variances-covariances |
B/W |
matrix of W^{-1} B |
eigenvalues |
vector of eigenvalues |
eigenvectors |
matrix of eigenvectors |
proportion |
a vector containing the proportion of total discriminating ability captured by each canonical variate |
correlation |
vector of canonical correlations |
squared.canonical.correlation |
vector of squared canonical correlations |
coefficients |
matrix of canonical coefficients |
scores |
matrix of canonical scores |
centroids |
matrix of scores for centroids |
total.structure |
matrix of total canonical structure |
between.structure |
matrix of between-groups canonical structure |
within.structure |
matrix of within-groups canonical structure |
class.fun |
matrix of classifications functions |
class.val |
matrix of classification values |
within.structure |
matrix of within-groups canonical structure |
class |
vector of predicted classes |
Andrea Onofri
https://www.statforbiology.com/2023/stat_multivar_cva/
dataset <- getAgroData("WheatQuality4years")
dataset$Year <- factor(dataset$Year)
head(dataset)
# Standardise the data
groups <- dataset$Genotype
Z <- apply(dataset[,3:6], 2, scale, center = TRUE, scale = TRUE)
head(Z)
# Performs CVA
cvaobj <- CVA(Z, groups)
cvaobj
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.