[R] Help with cochran.test

Stephanie Bernard SMBernard at lbl.gov
Mon Nov 5 19:52:54 CET 2007


Hi,
I have been trying to use the function cochran.test from the Outliers 
package to test for homogeneity of variance. This works well except when 
I use transformed data. Would anyone have an idea why it doesn't work 
and how I could do the cochran test on transformed data?
Thanks,
Stephanie

 >library(outliers)
 > set.seed(1234)
 > x=rnorm(100)
 > d=data.frame(x=x,group=rep(1:10,10))
 > cochran.test(x~group,d)

    Cochran test for outlying variance

data:  x ~ group
C = 0.1619, df = 10, k = 10, p-value = 0.935
alternative hypothesis: Group 10 has outlying variance
sample estimates:
        1         2         3         4         5         6         
7         8         9        10
0.9702567 1.0762180 0.9489474 0.9098832 1.1665495 0.9753678 1.2960769 
0.8036918 0.7193931 1.7127172

 > cochran.test(log(x)~group,d)
Error in tapply(data[[bn[1]]], by.factor, var) :
    arguments must have same length



More information about the R-help mailing list