matW | R Documentation |
Calculation of within (matW
) and between (matB
) covariance matrices for classes of row observations of a data set.
matW(X, y)
matB(X, y)
X |
A |
y |
A vector of length |
The denominator in the variance calculations is n
.
A matrix.
n <- 8
p <- 3
set.seed(1)
X <- matrix(rnorm(n * p, mean = 10, sd = 3), ncol = p, byrow = TRUE)
y <- sample(1:2, size = n, replace = TRUE)
set.seed(NULL)
X
y
matW(X, y)
matB(X, y)
matB(X, y)$B
matW(X, y)$W + matB(X, y)$B
(n - 1) / n * cov(X)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.