matW: Between and within covariance matrices

View source: R/matW.R

matWR Documentation

Between and within covariance matrices

Description

Calculation of within (matW) and between (matB) covariance matrices for classes of observations.

Usage


matW(X, y)

matB(X, y)

Arguments

X

Data (n, p) on whch are calculated the covariances.

y

Class membership (n, 1).

Details

The denominator in the variance calculations is n.

Value

Covariance matrices and other information.

Examples


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)


mlesnoff/rchemo documentation built on April 15, 2023, 1:25 p.m.