[Rd] normality and equal variance testing

Greg Snow Greg.Snow at imail.org
Mon Jan 24 22:02:49 CET 2011


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]]



More information about the R-devel mailing list