Message-ID: <4B13D4D5.6060405@ucalgary.ca>
Date: 2009-11-30T14:21:09Z
From: Peter Ehlers
Subject: Bartlett' test
In-Reply-To: <427C2DE0561C49BF85906E608C401385@ccePC>
Silvano wrote:
> 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?
>
Yes. Is mean(tapply(valor,trat,var)) the pooled variance estimate?
Maybe you should look at the code of bartlett.test.default.
-Peter Ehlers
>
> #-------------------
>
> 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
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
>