[R] Discrepency between R and MlwiN

Prof Brian Ripley ripley at stats.ox.ac.uk
Mon Sep 13 08:34:34 CEST 2004

On Sun, 12 Sep 2004, Damian Betebenner wrote:

> When playing around fitting unconditional growth models using R and MlwiN today, I produced two different sets of estimates that I can't reconcile and wondered if anyone here has an idea:
> The data is two-level repeated measures data with measures nested within child. There are two measures per child. I've fit an unconditional growth model as in Singer and Willet (2003) that allows for variable intercepts
> and slopes.
> The R code for the analysis is:
> model.uncgrowth.2lev <- lme(math ~ grade, mathdata, random=~grade|studentid)
> The fixed effects estimates for the intercept and slope are the same
> between MlwiN and R. It's the random effects estimates that differ. In
> particular, the residual error variance is ZERO using MlwiN and
> significantly non-zero using R. It appears that MlwiN perfectly fits
> lines to each of the two data points supplied for each student and R
> does not. The two program yield the same results when the covariate
> grade is treated as a fixed effect. Also, I used REML on both R and
> MlwiN.
> Anyone have any idea how to explain this descrpency?

Are there always two points per student?  If so, your model is not
identifiable (in so far as I understand what you are doing) and there is
an infinite set of parameters which give the same restricted likelihood.
Please check if the latter is the case for the two sets of results.

For each student you have a random intercept, a random slope and 
measurement error at each point.  That's 4 random variables to explain 2 

In short, you appear to have chosen a model that overfits.

Brian D. Ripley,                  ripley at stats.ox.ac.uk
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

More information about the R-help mailing list