onewayEst: onewayEst

Description Usage Arguments Author(s) Examples

View source: R/oneway.R

Description

oneway analysis of varience

Usage

1

Arguments

z

A list of components

Author(s)

Xueli Gao

Examples

 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
##---- 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 (z) 
{
    s = sapply(z, sum)
    Total = sum(unlist(z)^2)
    group_n <- sapply(z, length)
    A = sum(s^2/group_n)
    CF <- (sum(unlist(z)))^2/length(unlist(z))
    SS_between <- A - CF
    SS_within <- Total - A
    df_between <- length(z) - 1
    df_within <- length(unlist(z)) - length(z)
    MSb <- (A - CF)/(length(z) - 1)
    MSw <- (Total - A)/(length(unlist(z)) - length(z))
    F <- MSb/MSw
    p <- 1 - pf(F, df_between, df_within, lower.tail = T)
    anotable = cbind(df = c(df_between, df_within), SS = c(SS_between, 
        SS_within), MS = c(MSb, MSw), F = c(F, NA), `Pr(<F)` = c(p, 
        NA))
    rownames(anotable) <- c("Treatment", "Residuals")
    printCoefmat(anotable, P.values = T, has.Pvalue = T, signif.stars = T, 
        na.print = "")
  }

xueligao/oneway documentation built on May 4, 2019, 1:26 p.m.