[R-sig-ME] Nested and crossed random effects
Patrick Onyango
pogola at Princeton.EDU
Thu Jul 30 05:09:37 CEST 2009
Dear All,
I am in transition from SPSS to R and so I am trying to read as much
as I can to address some of my immediate statistical needs. And so,
as with most transitions, I am plagued by haste that some of you may
find quite sublime; but I ask for leniency.
I am trying to model a response variable, response, as a function of
the following fixed terms: a, b, c, d, and e; and 3 random effects:
f, g, h such that g denotes the ID of my sampling subjects sampled
over time and the subjects are distributed in 5 groups, here denoted
by f. An important note is that I sampled g as part of a pair with h
such that overall I have 131 samples involving 39 different gs and 45
different hs where h may be or may not be at 2 levels of two of the
fixed terms, let's for convenience call those terms d and e, each
with levels 1 and 2. The number of samples among h are pretty uneven.
The main idea is to find out what g does given the level of h; and
how is that influenced by a,b,c as well as vary by the IDs f,g,h
where f is the highest level of random effects and g and h should
probably be crossed terms?
This is what I did:
model<-lmer(response~a+b+c+d+e+(1|f)+(1|f/g)+(1|g)+(1|h), method='ML')
but got the following warning message
Error: length(f1) == length(f2) is not TRUE
In addition: Warning messages:
1: In g:f:
numerical expression has 131 elements: only the first used
2: In g:f:
numerical expression has 131 elements: only the first used
3: In h:f :
numerical expression has 131 elements: only the first used
4: In h:f :
numerical expression has 131 elements: only the first used
Then I tried
model<-lmer(response~a+b+c+d+e+(1|f)+(1+f|g)+(1|g)+(1|h),
method='ML') only making one change at the nested term; and got the
following Error message
In mer_finalize(ans) : singular convergence (7)
Further, the output from the latter call found a perfect correlation
for the intercept and slope of g indicating overparametization; and
so I sought to simplify the model by removing the correlation term
and assuming homoscedasticity for g in respect to f by replacing the
nested term in the previous call with (1|f:g), and also adding corr =
FALSE in the call
But got the following
Error: length(f1) == length(f2) is not TRUE
I go in your records as probably having the longest post. An
achievement indeed.
I need and will be most thankful for help in figuring how to handle
my data and in deciphering the error messages.
Many thanks in advance; and please let me if further clarifications
would suffice.
Patrick
More information about the R-sig-mixed-models
mailing list