powered by
Calculation of within (matW) and between (matB) covariance matrices for classes of observations.
matW
matB
matW(X, y)matB(X, y)
matB(X, y)
For (matW):
within covariance matrix.
list of covariance matrices for each class.
classes
number of observations in each per class
For (matB):
between covariance matrix.
matrix of class centers.
Data (\(n, p\)) on whch are calculated the covariances.
Class membership (\(n, 1\)).
The denominator in the variance calculations is \(n\).
n <- 8 ; p <- 3 X <- matrix(rnorm(n * p), ncol = p) y <- sample(1:2, size = n, replace = TRUE) X y matW(X, y) matB(X, y) matW(X, y)$W + matB(X, y)$B (n - 1) / n * cov(X)
Run the code above in your browser using DataLab