[R] Bartlett' test

Silvano silvano at uel.br
Mon Nov 30 12:42:38 CET 2009


Hi,

I have an experiment with 5 treatments, of which 2 with 10 
repetitions and 2 with 7 replications.
I conducted the test of Bartlett step-by-step and compared 
with the value calculated directly by the R and the values 
are different.
Anyone know tell me why?


#-------------------

n = length(trat)
I = 4

(M = 2.3026*((n-I)*log10(mean(tapply(valor,trat,var))) - 
(9*log10(vari[1])+9*log10(vari[2])+6*log10(vari[3])+6*log10(vari[4]))))
(C = 1 + 1/(3*(4-1))*((1/9 + 1/9 + 1/6 + 1/6) - 
1/(9+9+6+6)))
(B = M/C)

> B
1.748670

> qchisq(.05, 3, lower.tail=F)    # Valor tabelado
[1] 7.814728

#-----------------------------------------
# Teste de Bartlett de forma direta no R -
#-----------------------------------------

bartlett.test(valor,trat)

        Bartlett test of homogeneity of variances

data:  valor and trat
Bartlett's K-squared = 0.7845, df = 3, p-value =
0.8532

Thanks,

--------------------------------------
Silvano Cesar da Costa
Departamento de Estatística
Universidade Estadual de Londrina
Fone: 3371-4346




More information about the R-help mailing list