Re: [R] How to run Shapiro-Wilk test for each grouped

2010-04-13 Thread Yvonnick Noel
Iurie, Noel, thanks a lot. This will help me someday. But I have a question. When we run Shapiro-Wilk test, the homogenity of variances is a mandatory condition? No it is not. An homoscedasticity test only makes sense when you have a grouping factor, and a normality test may of course be

Re: [R] How to run Shapiro-Wilk test for each grouped

2010-04-13 Thread Thomas Lumley
On Tue, 13 Apr 2010, Yvonnick Noel wrote: Iurie, Noel, thanks a lot. This will help me someday. But I have a question. When we run Shapiro-Wilk test, the homogenity of variances is a mandatory condition? No it is not. An homoscedasticity test only makes sense when you have a grouping

Re: [R] How to run Shapiro-Wilk test for each grouped variable?

2010-04-12 Thread Yvonnick Noel
Dear Iurie, I want to run Shapiro-Wilk test for each variable in my dataset, each grouped by variable groupFactor. Note that, at least on a single dependent variable with a grouping variable, a possible simplification may arise when homogeneity of variances is assumed and reasonable. You may

Re: [R] How to run Shapiro-Wilk test for each grouped variable?

2010-04-12 Thread Iurie Malai
Noel, thanks a lot. This will help me someday. But I have a question. When we run Shapiro-Wilk test, the homogenity of variances is a mandatory condition? 2010/4/12 Yvonnick Noel yvonnick.n...@uhb.fr: Dear Iurie, I want to run Shapiro-Wilk test for each variable in my dataset, each grouped

[R] How to run Shapiro-Wilk test for each grouped variable?

2010-04-09 Thread Iurie Malai
I want to run Shapiro-Wilk test for each variable in my dataset, each grouped by variable groupFactor. I have these working commands: data.n-names(data) # put names into a vector called data.n by(eval(parse(text=(paste(data,data.n[3],sep=$, data$factor, shapiro.test) #run shapiro.test

Re: [R] How to run Shapiro-Wilk test for each grouped variable?

2010-04-09 Thread David Winsemius
On Apr 9, 2010, at 8:16 AM, Iurie Malai wrote: I want to run Shapiro-Wilk test for each variable in my dataset, each grouped by variable groupFactor. I have these working commands: data.n-names(data) # put names into a vector called data.n by(eval(parse(text=(paste(data,data.n[3],sep=$,

Re: [R] How to run Shapiro-Wilk test for each grouped variable?

2010-04-09 Thread Ivan Calandra
Hi, Maybe you should change the 3 in the loop with r like: for (r in 3:18) { by(eval(parse(text=(paste(data,data.n[r],sep=$, data$groupFactor, shapiro.test) } I think it should work, if not, I have already a similar script for that. HTH, Ivan Le 4/9/2010 15:17, David Winsemius a écrit :

Re: [R] How to run Shapiro-Wilk test for each grouped variable?

2010-04-09 Thread David Winsemius
On Apr 9, 2010, at 9:39 AM, Ivan Calandra wrote: Hi, Maybe you should change the 3 in the loop with r like: for (r in 3:18) { by(eval(parse(text=(paste(data,data.n[r],sep=$, data $groupFactor, shapiro.test) } I think it should work, if not, I have already a similar script for that.

Re: [R] How to run Shapiro-Wilk test for each grouped variable?

2010-04-09 Thread Iurie Malai
Thank you, David! Here is the code to read my file: data - read.table(data.txt, header=TRUE, sep=;, na.strings=NA, dec=., strip.white=TRUE) Jorge Ivan Velez gave me a working solution, but I am ready to learn yours to. Iurie 2010/4/9 David Winsemius dwinsem...@comcast.net: OK, we have the

Re: [R] How to run Shapiro-Wilk test for each grouped variable?

2010-04-09 Thread Iurie Malai
Thank you very much, Jorge! Your example worked for me. Here is the code: d - data.frame(data$groupFactor, data[2:17]) d # p-values for the shapiro test (by levels of groupFactor) with(d, aggregate(d[,-1], list(d[,1]), FUN = function(x) shapiro.test(x)$p.value)) Iurie 2010/4/9 Jorge Ivan Velez

Re: [R] How to run Shapiro-Wilk test for each grouped variable?

2010-04-09 Thread David Winsemius
On Apr 9, 2010, at 10:51 AM, Iurie Malai wrote: Thank you, David! Here is the code to read my file: data - read.table(data.txt, header=TRUE, sep=;, na.strings=NA, dec=., strip.white=TRUE) Jorge Ivan Velez gave me a working solution, but I am ready to learn yours to. I don't think I