1 | anova1(x)
|
x |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x)
{
if (is.matrix(x))
x <- listm(x)
A <- 0
B <- 0
C <- 0
N <- 0
for (j in 1:length(x)) {
N <- N + length(x[[j]])
A <- A + sum(x[[j]]^2)
B <- B + sum(x[[j]])
C <- C + (sum(x[[j]]))^2/length(x[[j]])
}
SST <- A - B^2/N
SSBG <- C - B^2/N
SSWG <- A - C
nu1 <- length(x) - 1
nu2 <- N - length(x)
MSBG <- SSBG/nu1
MSWG <- SSWG/nu2
FVAL <- MSBG/MSWG
pvalue <- 1 - pf(FVAL, nu1, nu2)
list(F.test = FVAL, p.value = pvalue, df1 = nu1, df2 = nu2,
MSBG = MSBG, MSWG = MSWG)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.