[R] Help with seting up comparison

Bart Joosen bartjoosen at hotmail.com
Mon Jun 7 17:14:28 CEST 2010


Hi,

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 the
days.
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)
anova(mod)

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, with
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 days
within every animal?

Best regards

Bart


-- 
View this message in context: http://r.789695.n4.nabble.com/Help-with-seting-up-comparison-tp2246106p2246106.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list