[R-sig-ME] Help!
Ben Bolker
bbolker at gmail.com
Wed Sep 28 23:06:07 CEST 2011
Eric ADJAKOSSA <ericadjakossah at ...> writes:
> [snip]
> I am about to
> use the book "Mixed-effects models in S and S-plus" as part of my
> master's thesis. I adjusted a linear mixed effects model, but I can
> not make some graphs to validate this model. I use the software R
> (version 2.13.0). In fact R displays errors that I can not correct for
> several days.
[SNIP]
> groupCSP <- groupedData(conCSP ~ NBDORM_f | VILLAG, data =
> subset(Tori_util_sd, select = c(conCSP,TOTTDR_f, TOTTDR, VILLAG
> ,IND_VEGET_f , NBDORM_f, EAU, TMUR, NO, LONG, LAT)))
>
> cm <- lme(log(conCSP) ~ NBDORM_f + EAU*IND_VEGET_f + TOTTDR , data =
> groupCSP, random = ~ 1 | VILLAG, na.action = na.omit)
>
> > plot( cm, VILLAG~resid(.), abline = 0 )
> Erreur dans `[<-.data.frame`(`*tmp*`, , ".y", value = c(2L, 2L, 2L, 2L, 8L, :
> replacement has 479 rows, data has
Hard to answer without a reproducible example, but I suspect the
problem is with NAs in your data that are being automatically
removed in one place and not in the other. I would try subsetting
and na.omit()ing your data first, i.e.
subdat <- subset(Tori_util_sd, select = c(conCSP,TOTTDR_f,
TOTTDR, VILLAG ,IND_VEGET_f , NBDORM_f,
EAU, TMUR, NO, LONG, LAT)
subdat <- na.omit(subdat)
groupCSP <- groupedData(...,data=subdat)
etc.
More information about the R-sig-mixed-models
mailing list