Doran, Harold wrote:
> I was able to run the following in nlme successfully, but the same model
> and code (same dataset) failed to run in lme4 and gave me the error
> message below. Any thoughts?
>
>
> lme(math~year, data=egsingle, random=~year|schoolid/childid)
>
>
> Error in lme(formula = math ~ year, data = egsingle, random >
structure(list( :
>
> Unable to invert singular factor of downdated X'X
Is childid unique? If not, you will need to generate a unique id for
the child for the lme4 version of lme. (This change is required because
the lme4 package can fit models with crossed or partially crossed
grouping factors.)
A simple way of creating the necessary factor (thanks to Martin Maechler
for showing me this) is
egsingle$chld <- (egsingle$schoolid : egsingle$childid)[drop = TRUE]
(I haven't checked this. I don't have R on the machine that I use for
email connectivity. I can check this later today. Is the egsingle data
set the same one you sent me earlier?)