[R] Levene's test
Kurt Hornik
Kurt.Hornik at ci.tuwien.ac.at
Fri Sep 1 13:35:16 CEST 2000
>>>>> Peter Dalgaard BSA writes:
> Prof Brian D Ripley <ripley at stats.ox.ac.uk> writes:
>> Levene <- function(y, group)
>> {
>> group <- as.factor(group) # precautionary
>> meds <- tapply(y, group, median)
>> resp <- abs(y - meds[group])
>> anova(lm(resp ~ group))[1, 4:5]
>> }
>>
>> > data(warpbreaks)
>> > attach(warpbreaks)
>> > Levene(breaks, tension)
>> F value Pr(>F)
>> group 2.818 0.06905
>>
>> I could (and probably would) dress it up with a formula interface,
>> but that would obscure the simplicity of the calculation.
> Cough. Is that really the calculation of the P value in Levene's test?
> Just close your eyes an pretend that F is F distributed? Not that I
> don't believe that it might be the case, I just sort of expected that
> something more elaborate was required.
> I've been wondering whether we should have L's test, if for no other
> reason then because SPSS uses it by default.
> Hmm. So we have a test (Bartlett's) which is known to be optimal under
> Normal theory, then SPSS goes and replaces with a test which uses an
> arbitrary quantity, known to be suboptimal in the Normal case, and
> tests a hypothesis that isn't actually what it purports to be
> (identical variances does not follow from identical mean absolute
> residuals), and to top it off uses a certainly incorrect calculation
> of its p-value. Well, yes they would, wouldn't they?
Btw, we have fligner.test() in ctest. From the docs,
The Fligner-Killeen (median) test has been determined in a simulation
study as one of the many tests for homogeneity of variances which is
most robust against departures from normality, see Conover, Johnson &
Johnson (1981).
-k
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list