From Greg.Snow at imail.org  Mon Jan 24 22:02:49 2011
From: Greg.Snow at imail.org (Greg Snow)
Date: Mon, 24 Jan 2011 14:02:49 -0700
Subject: [Rd] normality and equal variance testing
In-Reply-To: <86509.71814.qm@web161703.mail.bf1.yahoo.com>
References: <86509.71814.qm@web161703.mail.bf1.yahoo.com>
Message-ID: <B37C0A15B8FB3C468B5BC7EBC7DA14CC634247A051@LP-EXMBVS10.CO.IHC.COM>

Why do you want to test for normality and equal variances?

If those are really a concern then you should use a method up front that is robust against those.  Those tests are usually testing a hypothesis that is different from what you are actually interested in and generally have low power to guide further tests.

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-devel-bounces at r-project.org [mailto:r-devel-bounces at r-
> project.org] On Behalf Of Karthi Subramanian
> Sent: Monday, January 24, 2011 10:06 AM
> To: R-devel at r-project.org
> Subject: [Rd] normality and equal variance testing
> 
> I currently have a program that automates 2-way ANOVA on a series of
> endpoints,
> but before the ANOVA is carried out I want the code to test the
> assumptions of
> normality and equal variance and report along with each anova result in
> the
> output file.? How can I do this?
> 
> 
> I have pasted below the code that I currently use.
> 
> 
> library(car)
> numFiles = x # <--<--<--<--<--<--<--<--<--<--<-- supply the number of
> files
> containing the source data here
> for (iIndx in 1:numFiles) {
> ?????? sinkFilePath = paste("C:/AnovaData/2WayAnovaForProteins_Set",
> iIndx,
> ".txt", sep="")
> ?sink(sinkFilePath)
> ?sourceFilePath = paste("C:/AnovaData/ProteinsFor2WayAnova_Set", iIndx,
> ".txt",
> sep="")
> ?dataSet = read.delim(sourceFilePath)
> ?numProteins = ncol(dataSet)
> ?nameProteins = colnames(dataSet)
> ?for (i in 3:numProteins) {
> ??fla = as.formula(paste(nameProteins[i],"~","Trt*Dose"))
> ??mod = lm(fla, data = dataSet , contrasts = list(Trt = contr.sum, Dose
> =
> contr.sum))
> ??ano = Anova(mod, type = "III")
> ??print.noquote("")
> ??print.noquote("")
> ??print.noquote("--------------------------------------------")
> ??print.noquote(paste("--------- Analysis of Spot:
> ",nameProteins[i],"------------"))
> ??print.noquote("--------------------------------------------")
> ??print(ano)
> ?}
> }
> 
> 
> Thanks in advance.
> Karthi
> 
> 
> 	[[alternative HTML version deleted]]



[Rd] normality and equal variance testing
Greg Snow