Displaying 1 result from an estimated 1 matches for "g1mean".
2007 Nov 22
3
anova planned comparisons/contrasts
...ng this?
Thanks!
Tyler
MyContrast <- function(Var, Group, G1, G2, G3=NULL) {
## Var == data vector, Group == factor
## G1, G2, G3 == character vectors of factor levels to contrast
nG1 = sum(Group %in% G1)
nG2 = sum(Group %in% G2)
GrandMean = mean(Var[Group %in% c(G1, G2, G3)])
G1Mean = mean(Var[Group %in% G1])
G2Mean = mean(Var[Group %in% G2])
if(is.null(G3))
MScontr = nG1 * ((G1Mean - GrandMean)^2) +
nG2 * ((G2Mean - GrandMean)^2)
else {
nG3 = sum(Group %in% G3)
G3Mean = mean(Var[Group %in% G3])
MScontr = (nG1 * ((G1Mean - GrandMean)^2)...