[R] Help with seting up comparison
Greg.Snow at imail.org
Mon Jun 7 22:54:47 CEST 2010
Are you interested in only those 35 animals (not every going to look at any other animals other than those 35, but you want to predict what will happen for those 35)? Or are the 35 animals a sample of a larger population of animals?
If the later (seems the most likely case) then you probably want to use a mixed effects model (nlme or lme4 packages) with animal as a random effect, then just look at the fixed effect of day.
Hope this helps,
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
greg.snow at imail.org
> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Bart Joosen
> Sent: Monday, June 07, 2010 9:14 AM
> To: r-help at r-project.org
> Subject: [R] Help with seting up comparison
> I tried on this, but couldn't figure it out:
> Suppose I have a dataframe as follows:
> dat <- data.frame(Day=rep(rep(c(1,2), each=4),2), Animal = rep(c(1,2),
> each=8), Count=c(rnorm(8, 100), rnorm(8,90)))
> 2 animals are being examined on 2 different days. Count is the result.
> Now I need to point out whether or not there is a difference between
> I did this by an ANOVA test, while first converting the animal and day
> to a
> factor variable:
> dat$Animal <- as.factor(dat$Animal)
> dat$Day <- as.factor(dat$Day)
> mod <- lm(Count ~Animal * Day,dat)
> Now I have to check for difference within the animal, to see if there
> is a
> difference in count for each day. (In my real data, I have 35 animals,
> 4 days, and 4 results).
> I thought about a Tukey HSD test, but this compares every day of every
> animal with every other day of every other animal. (TukeyHSD(aov(mod)))
> Any idea about which function (or model for lm) to use to only compare
> within every animal?
> Best regards
> View this message in context: http://r.789695.n4.nabble.com/Help-with-
> Sent from the R help mailing list archive at Nabble.com.
> R-help at r-project.org mailing list
> PLEASE do read the posting guide http://www.R-project.org/posting-
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help