On Fri, 2 Jul 2004, Douglas Bates wrote: > 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]
interaction(egsingle$schoolid, egsingle$childid, drop=TRUE) is very similar and might be a bit more self-documenting (so I tend to prefer it). -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595 ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html