Re: [R] extraction of mean square value from ANOVA

2011-05-19 Thread Cheryl Johnson
Thanks for your help. How would I extract each of the 3 values in the vector individually? Thanks again On Thu, May 19, 2011 at 10:40 PM, Rolf Turner wrote: > On 20/05/11 13:46, Cheryl Johnson wrote: > >> Hello, >> >> I am randomly generating values and then using an ANOVA table to find the >> m

Re: [R] extraction of mean square value from ANOVA

2011-05-19 Thread Bill.Venables
r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Dennis Murphy Sent: Friday, 20 May 2011 1:38 PM To: Cheryl Johnson Cc: r-help@r-project.org Subject: Re: [R] extraction of mean square value from ANOVA Hi: It's easier to use an apply family function than a loop for th

Re: [R] extraction of mean square value from ANOVA

2011-05-19 Thread Dennis Murphy
Hi: It's easier to use an apply family function than a loop for this type of problem, as illustrated below: # Generate 30 random samples of size 10 from a standard # normal distribution and put them into a matrix u <- matrix(rnorm(300), ncol = 10) a <- factor(rep(1:5, each = 2)) b <- factor(rep(1

Re: [R] extraction of mean square value from ANOVA

2011-05-19 Thread Rolf Turner
On 20/05/11 14:51, Cheryl Johnson wrote: Thanks for your help. How would I extract each of the 3 values in the vector individually? If you are going to use R, it would pay you to learn a little bit about it. Like, e.g., vector indexing. In your example anova(mylm)[["Mean Sq"]][3] would g

Re: [R] extraction of mean square value from ANOVA

2011-05-19 Thread Rolf Turner
On 20/05/11 13:46, Cheryl Johnson wrote: Hello, I am randomly generating values and then using an ANOVA table to find the mean square value. I would like to form a loop that extracts the mean square value from ANOVA in each iteration. Below is an example of what I am doing. a<-rnorm(10) b<-fact

[R] extraction of mean square value from ANOVA

2011-05-19 Thread Cheryl Johnson
Hello, I am randomly generating values and then using an ANOVA table to find the mean square value. I would like to form a loop that extracts the mean square value from ANOVA in each iteration. Below is an example of what I am doing. a<-rnorm(10) b<-factor(c(1,1,2,2,3,3,4,4,5,5)) c<-factor(c(1,2,