[R] repeated-measures multiple regression/ANCOVA/MANCOVA
Jakub Szewczyk
jakub.szewczyk at gmail.com
Sat Nov 16 17:45:10 CET 2013
Dear List,
I am trying to analyze a dataset where I have 1 continuous
between-item variable (C), and 2 factorial within-item variables (3-
and 2-level: F3, F2). I'm interested in whether slope of C is
different from 0 at different combinations of F3 and F2, and whether
it varies between these combinations.
And unfortunately I need a decent anova-like table with p-values. The
reason is that 1) this analysis is going to be repeated 9 times for
different parts of the data (not comparable), so such an omnibus table
will give a good overview of which places need a follow up with
simpler models; 2) this is the norm in my field of reseach, although
usually with factorial variables only.
I'm wondering how to do it properly in R without falling into any
pitfalls, avoiding violations of any assumptions (like sphericity) and
what is the most apropriate type of sum of squares for this analysis.
The 2 solutions I found so far are:
based on nlme::lme():
> res.lme = nlme::lme(data=d, y ~ C * F3 * F2, random = ~ 1|item/F3/F2)
> anova(res.lme) for type I SS
> Anova(res.lme, type="II/III") # for type II/III SS
based on lmerTest package:
> res.lmertest = lmerTest::lmer(data=d, y ~ C * F3 * F2 + (1|item))
> anova(res.lmertest) # for type III SS
I also considered running repeated-measures ANCOVA using aov() with
nested error terms, but that wouldn't protect me against sphericity
assumption violations.
I also considered using car::Anova() for running a repeated-measures
MANCOVA analysis, but if I got this thread right
(http://thread.gmane.org/gmane.comp.lang.r.general/270271/focus=270275),
this is (at present) not possible to do.
Are these ways of analyzing data valid?
Concerning the type of SS: I tried to read all discussions in this
list on this topic. If I got it right, since I'm interested in
interactions of C with other factors in the first place, in my case
using SS type III would make sense - is this a good logic?
Many thanks for help,
Jakub
More information about the R-help
mailing list