[R] Nested and repeated effects together?
Stephan Kolassa
Stephan.Kolassa at gmx.de
Sun Jun 4 22:10:00 CEST 2006
Dear R people,
I am having a problem with modeling the following SAS code in R:
Class ID Gr Hemi Region Gender
Model Y = Gr Region Hemi Gender Gr*Hemi Gr*Region Hemi*Region
Gender*Region Gender*Hemi Gr*Hemi*Region Gender*Hemi*Region
Gr*Gender*Hemi*Region
Random Intercept Region Hemi /Subject = ID (Gr Gender)
I.e., ID is a random effect nested in Gr and Gender, leading to
ID-specific Intercept, Region and Hemi means. We have repeated
measurements within each ID (one measurement each for the different
combinations of Hemi and Region, i.e. 2 levels in Hemi: L vs. R; 4
levels in Region: F vs. C vs. T vs. PO).
I have been trying things like
aov(y~Gr+Region+Hemi+Gender+Gr:Hemi+Gr:Region+Hemi:Region+Gender:Region+Gender:Hemi+Gr:Hemi:Region+Gender:Hemi:Region+Gr:Gender:Hemi:Region+
Error(ID/(Gr+Gender))
and do get results, but I am very unsure whether this implements the
right model. An Error term like
Error((1+Region+Hemi)/(ID_Vp/(Gender+Gr))), data=daten))
in the above model looks intuitively better to me, but (1) again: I'm
unsure about this, (2) this crashes my R.
Of course, I have been googling for all permutations of "Nested
effects", "repeated effects", "random effects" and digging through the
R-help archives, but I can't seem to locate a similar question having
been answered before.
Thank you all for your time!
Best regards,
Stephan
More information about the R-help
mailing list