> 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
At 09:02 PM 01-09-00 , Prof Brian Ripley wrote: ....>> From: Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> >> 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. >This was indeed what I had in mind, and yes my source was the same encyclopedia, though I havn't read the Brown-Forsyth article. John Maindonald pointed out to me in an email that library(ctest) of the base distribution has the Fligner-Killeen test. I vaguely wondered if the tests might be equivalent. However:> fligner.test(breaks, tension)Fligner-Killeen test for homogeneity of variances data: breaks and tension Fligner-Killeen:med chi-square = 4.3178, df = 2, p-value = 0.1155 (Though they still could be equivalent and just the naive use of the F distribution yielding wrong p-values for the Levene test) Anyway, I can go and read the papers. The point is that Brian has solved my problem of how to do what I understood to be the Levene/Brown/Forsyth test reasonably elegantly in R. Thanks to all, Murray Dr Murray Jorgensen http://www.stats.waikato.ac.nz/Staff/maj.html Department of Statistics, University of Waikato, Hamilton, New Zealand *Applications Editor, Australian and New Zealand Journal of Statistics* maj at waikato.ac.nz Phone +64-7 838 4773 home phone 856 6705 Fax 838 4155 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._