Hello to All. I'd want to use a one-way ANOVA. This means that I have only one factor, with, lets say, 5 levels. I made a dataframe, called "DATA", with two Columns: A, that is my response, and it is "class numerical". B, that defines the different levels of my factor, and it is "class factor". If I want to use a fixed effect model, I know that the formula I have to use is: lm.1 <- lm(A~B,data=DATA) anova(lm.1) My questions is: which formula should I use if I want to use a random effects model? I think I should use "lme", but I don't know how. I hope to get a reply Best wishes to all Giuseppe
On Wed, 30 Nov 2005 Giuseppe.Palermo at bo.infn.it wrote:> Hello to All. > I'd want to use a one-way ANOVA. This means that I have only one factor, with, > lets say, 5 levels. > I made a dataframe, called "DATA", with two Columns: > A, that is my response, and it is "class numerical".There is no class 'numerical': I presume you mean 'numeric'.> B, that defines the different levels of my factor, and it is "class factor". > > If I want to use a fixed effect model, > I know that the formula I have to use is: > lm.1 <- lm(A~B,data=DATA) > anova(lm.1) > > My questions is: > which formula should I use if I want to use a random effects model? > I think I should use "lme", but I don't know how.aov() is the function for anova modelling. so you want aov(A ~ B, data = DATA) # fixed effects aov(A ~ Error(B), data = DATA) # random effects but a 1-way ANOVA with fixed or random effects is the same analysis, and only the interpretation differs. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
I'm sorry if I wasn't clear.... There are repeated measures for each level of my factor. For instance, the dataframe could look like that: A B 12.0 1 12.3 1 15 1 12.9 2 16.7 2 15.4 2 23.5 3 9.6 3 7.8 3 In order to fit a random effects, is right to apply: lme(A~1,data=DATA,random=~1|B) ? Giuseppe Quoting giovanni parrinello <parrinel at med.unibs.it>:> La domanda ?? poco chiara! Ci sono misure ripetute? > Senza queste informazioni non so pu?? rispondere.. > Giovanni Parrinello > ----- Original Message ----- > From: <Giuseppe.Palermo at bo.infn.it> > To: <r-help at stat.math.ethz.ch> > Sent: Wednesday, November 30, 2005 11:19 AM > Subject: [R] Random Effects for One-Way Anova > > >> Hello to All. >> I'd want to use a one-way ANOVA. This means that I have only one factor, > with, >> lets say, 5 levels. >> I made a dataframe, called "DATA", with two Columns: >> A, that is my response, and it is "class numerical". >> B, that defines the different levels of my factor, and it is "class > factor". >> >> If I want to use a fixed effect model, >> I know that the formula I have to use is: >> lm.1 <- lm(A~B,data=DATA) >> anova(lm.1) >> >> My questions is: >> which formula should I use if I want to use a random effects model? >> I think I should use "lme", but I don't know how. >> >> I hope to get a reply >> Best wishes to all >> Giuseppe >> >> ______________________________________________ >> R-help at stat.math.ethz.ch mailing list >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html >> > >
Giuseppe GIven the information below it is difficult to provide help. But, you might use the lmer() function in the Matrix package in a fashion such as lmer(A ~ B +(1|ID), data) where ID is a grouping variable. There are plently of papers on lme and lmer in the R news as well as a book by Pinhiero and Bates as well as multiple threads in the archives on this function as well. -----Original Message----- From: r-help-bounces@stat.math.ethz.ch on behalf of Giuseppe.Palermo@bo.infn.it Sent: Wed 11/30/2005 5:19 AM To: r-help@stat.math.ethz.ch Cc: Subject: [R] Random Effects for One-Way Anova Hello to All. I'd want to use a one-way ANOVA. This means that I have only one factor, with, lets say, 5 levels. I made a dataframe, called "DATA", with two Columns: A, that is my response, and it is "class numerical". B, that defines the different levels of my factor, and it is "class factor". If I want to use a fixed effect model, I know that the formula I have to use is: lm.1 <- lm(A~B,data=DATA) anova(lm.1) My questions is: which formula should I use if I want to use a random effects model? I think I should use "lme", but I don't know how. I hope to get a reply Best wishes to all Giuseppe ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]]