[R-sig-ME] Interpreting 2-way aov interaction
ONKELINX, Thierry
Thierry.ONKELINX at inbo.be
Fri Feb 13 10:19:55 CET 2015
Dear Christian,
If the interaction is important, you can model it by a random slope. See the example below. Caveat: a random effect with only 4 levels is not a good idea. See http://glmm.wikidot.com/faq for more details.
f2 <- factor(c(rep(seq(1,4),each=20)))
meas <- factor(c(rep(1,18),c(rep(2,44),c(rep(1,18)))))
df <- data.frame(f2,meas)
df$interaction <- interaction(df$meas, df$f2)
rf <- rnorm(length(levels(df$interaction)))
main <- c(10, 20)
noise <- rnorm(nrow(df), sd = 0.1)
df$res <- main[df$meas] + rf[df$interaction] + noise
library(lme4)
model.interaction <- lmer(res ~ meas + (0 + meas|f2), data = df)
model.no.interaction <- lmer(res ~ meas + (1|f2), data = df)
anova(model.interaction, model.no.interaction)
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+ 32 2 525 02 51
+ 32 54 43 61 85
Thierry.Onkelinx op inbo.be
www.inbo.be
To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of.
~ Sir Ronald Aylmer Fisher
The plural of anecdote is not data.
~ Roger Brinner
The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data.
~ John Tukey
-----Oorspronkelijk bericht-----
Van: R-sig-mixed-models [mailto:r-sig-mixed-models-bounces op r-project.org] Namens Brandstätter Christian
Verzonden: vrijdag 13 februari 2015 9:58
Aan: r-sig-mixed-models op r-project.org
Onderwerp: [R-sig-ME] Interpreting 2-way aov interaction
Dear community,
I encountered a problem with an experimental setup; we had one treatment step and a few mixing steps in a laboratory experiment.
The data was stored in a usual dataframe (df as below, long format) with the categorial variables as factors left.
We could clearly observe an interaction between mixing (f2) and treatment
(meas) by applying aov as in the (extreme) example below.
f2 <- factor(c(rep(seq(1,4),each=20)))
meas <- factor(c(rep(1,18),c(rep(2,44),c(rep(1,18)))))
res <- 15*as.numeric(f2)*as.numeric(meas)
df <- data.frame(f2,meas,res)
summary(aov(data=df,res~f2*meas))
My question is, would there be a way to somehow "exclude" the variation from the mixing step?
Would it be correct to include an error term as follows:
summary(aov(data=df,res~meas+Error(f2)))
And would that mean, what I am thinking it does: the treatment is still significant, even if the variation through mixing (f2) is considered?
One obvious alternative I could think of would be to separate the mixing steps, but of course in the experiment there were a few of them.
Another option would be a lmer-model I found, but the interpretation of the output is harder to interpret:
library(lme4)
mix.model = lmer(res ~ meas + (1|f2),data=df)
summary(mix.model)
I am unfortunately not very familiar with mixed anova-setups and available sources usually mention rather catchy examples from psychology which I find hard to translate for this case.
Best regards
Brandstätter Christian
[[alternative HTML version deleted]]
_______________________________________________
R-sig-mixed-models op r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Disclaimer<https://www.inbo.be/nl/disclaimer-mailberichten-van-het-inbo>
More information about the R-sig-mixed-models
mailing list