Message-ID: <4B13C7F0.3080901@biostat.ku.dk>
Date: 2009-11-30T13:26:08Z
From: Peter Dalgaard
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?
The first term in M looks wrong when group sizes differ, but it would be
much easier to check if you gave the actual group variances.
(and PLEASE don't hijack other threads. This has nothing to do with
kernlab's ksvm!)
>
>
> #-------------------
>
> 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
--
O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B
c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907