[R] ANOVA

Kingsford Jones kingsfordjones at gmail.com
Fri Mar 6 00:42:27 CET 2009


On Thu, Mar 5, 2009 at 8:31 AM, kayj <kjaja27 at yahoo.com> wrote:
>
> Hi All,
>
>
> I have about one hundred patients and all the patients had their glucose
> measured on three different days. The days are all the same for all he
> patients. So I have three measurement for each patient . I want to know
> whether the day when the glucose was measured has an effect on the
> measurements. I was thinking to use a single factor analysis of variance but
> I am not sure how to do it in R.

Two options for one-way ANOVA are aov(response ~ factor), or
lm(response ~ factor) followed by anova(lm.object).

But....this would probably be a bad idea.  I recommend Pinheiro and
Bates (2000), where there are many examples of modeling effects within
subjects over time.

Here's an example with a continuous time effect

library(nlme)
f1 <- lme(distance~age, data=Orthodont, random= ~1 + age|Subject,
weights=varPower())
plot(f1, distance~fitted(.)|Subject, abline=c(0,1))
intervals(f1)


hth,

Kingsford Jones


>any other suggestion on dealing with this
> problem is welcome.
>
> Thanks,
>
> --
> View this message in context: http://www.nabble.com/ANOVA-tp22353919p22353919.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list