[R] Linear Trend in Residiuals From lme
Rick Bilonick
rab45+ at pitt.edu
Wed Aug 9 22:55:39 CEST 2006
On Wed, 2006-08-09 at 15:04 -0500, Douglas Bates wrote:
> On 8/9/06, Rick Bilonick <rab45+ at pitt.edu> wrote:
> > I'm fitting a mixed effects model:
> >
> > fit.1 <- lme(y~x,random=~1|id,data=df)
> >
> > There are two different observations for each id for both x and y. When
> > I use plot(fit.1), there is a strong increasing linear trend in the
> > residuals versus the fitted values (with no outliers). This also happens
> > if I use random=~x|id. Am I specifying something incorrectly?
>
> Could you provide a reproducible example please?
>
> I suspect that the problem comes from having only two observations per
> level of id. When you have very few observations per group the roles
> of the random effect and the per-observation noise term in explaining
> the variation become confounded. However, I can't check if this is
> the case without looking at some data and model fits.
I tried using geeglm from geepack to fit a marginal model. I understand
this is not the same as a mixed effects model but the residuals don't
have the linear trend. Should I avoid using lme in this case?
Rick B.
More information about the R-help
mailing list