| compute_SB | R Documentation |
This function calculates the between-group scatter matrix (SB) for a given numeric matrix and grouping variable.
compute_SB(A, g)
A |
A numeric matrix of dimensions |
g |
A grouping variable of length |
The function computes the total mean of the matrix A and the mean for each group defined by g.
It then calculates the between-group scatter matrix by summing the outer product of the mean differences, weighted by the group sizes.
A numeric matrix representing the between-group scatter matrix (SB).
# Example usage:
A <- matrix(rnorm(20), nrow = 5, ncol = 4)
g <- factor(c("A", "B", "A", "B", "A"))
SB <- rENA:::compute_SB(A, g)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.