s-news
[Top] [All Lists]

Re: Levene test

To: John Fox <jfox@mcmaster.ca>
Subject: Re: Levene test
From: Christoph Scherber <Christoph.Scherber@uni-jena.de>
Date: Wed, 25 Feb 2004 16:46:48 +0100
Cc: s-news@lists.biostat.wustl.edu
In-reply-to: <5.1.0.14.2.20040225103509.020031c8@127.0.0.1>
References: <5.1.0.14.2.20040225103509.020031c8@127.0.0.1>
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)
Dear John,

Thanks - that was exactly what I was looking for - really great.

Just one slight correction: S-Plus doesn´t know the function "rownames". The correct code therefore is as stated below, using "row.names" instead.

Best regards
Chris

John Fox wrote:

Dear Chris,

The following function is from my Rcmdr package for R, and is a slightly modified version of a solution contributed by Brian Ripley to the R-help list:

levene.test <- function(y, group) {
    meds <- tapply(y, group, median, na.rm=TRUE)
    resp <- abs(y - meds[group])
    table <- anova(lm(resp ~ group, na.action=na.omit))
    row.names(table)[2] <- " "
    cat("Levene's Test for Homogeneity of Variance\n\n")
    table[,c(1,4,5)]
    }

For S-PLUS, I've changed the function to specify na.action=na.omit in the call to lm().

I hope this helps,
 John

At 01:55 PM 2/25/2004 +0100, Christoph Scherber wrote:

Dear all,

is there a way to perform a Levene´s test for variance homogeneity in S-Plus?

Best wishes
Chris


-----------------------------------------------------
John Fox
Department of Sociology
McMaster University
Hamilton, Ontario, Canada L8S 4M4
phone: 905-525-9140x23604
web: http://socserv.mcmaster.ca/jfox
-----------------------------------------------------




<Prev in Thread] Current Thread [Next in Thread>