Displaying 1 result from an estimated 1 matches for "groupvariable2".
Did you mean:
groupvariable
2011 Aug 25
2
within-groups variance and between-groups variance
...ng this already in
R?
I would prefer to use a standard R function if one exists.
Kind Regards,
Avril
Within-Groups Variance:
=======================
calcWithinGroupsVariance <- function(variable,groupvariable)
{
# find out how many values the group variable can take
groupvariable2 <- as.factor(groupvariable[[1]])
levels <- levels(groupvariable2)
numlevels <- length(levels)
# get the mean and standard deviation for each group:
numtotal <- 0
denomtotal <- 0
for (i in 1:numlevels)
{
leveli...