[R] Levene's test
Prof Brian Ripley
ripley at stats.ox.ac.uk
Fri Sep 1 11:02:58 CEST 2000
> From: Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk>
> Date: 01 Sep 2000 09:54:59 +0200
>
> Prof Brian D Ripley <ripley at stats.ox.ac.uk> writes:
Important omission: specification from Murray Jorgensen
The test that I was thinking of basically does an anova on a modified
response variable that is the absolute value of the difference between an
observation and the median of its group (more robust than Levene's original
choice, the mean).
> > 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.
This isn't really Levene's test, and I was making no claims as to validity,
just demonstrating how to do a calculation. However, the entry
in the Encyclopedia of Statistical Sciences does say that's what done
for the original form, and appears to say the same for the Brown-Forysthe
median form, so I guess this was what Murray had in mind.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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