Discussion:
[R-sig-ME] Different number of observations in variables of glmer
Cueva, Jorge
2018-06-13 15:35:21 UTC
Permalink
Hello, I am trying fit a glmer where the fixed variables has a different number of observations (72 and 60). With the models where the variables has the full observations I donŽt have problems but yes in the models where some of its variables has 60 observations. In the second case, all work well until I compute the R2m and R2c and I get the error "fitting model with the observation-level random effect term failed. Add the term manually", so, when I ingress the observation level the AIC increase 2 points, and miss 1 df. Please how I might work in these cases??

First case...
glmer(Spp~1+Mth.Prec+Soil.depth+Drainage+(1|Cluster),data = VariabRL,family=poisson,glmerControl(optimizer="bobyqa", optCtrl = list(maxfun = 2e5)))

Second case...
glmer(Spp~1+Mth.Prec+Soil.depth+Drainage+(1|Cluster)+(1|X),data = VariabRL,family=poisson,glmerControl(optimizer="bobyqa", optCtrl = list(maxfun = 2e5)))

Mth.Prec = 72 observations
Soil.depth and Drainage = 60 observations
X = observation level

Thanks a lot

Jorge Cueva Ortiz
Ing. Forestal
ECU: 0993085161
GER: 0049 1631327886


[[alternative HTML version deleted]]
Paul Johnson
2018-06-14 18:44:14 UTC
Permalink
The r.squaredGLMM function in MuMIn tries to add an observation-level random effect term if it doesn’t find one — I suspect this is where your error is coming from. It’s debatable whether this is a good idea (on the one hand it’s often a good idea to add an OLRE, but I think it would be better to give the user the choice).

I suggest using the rsquared function in piecewiseSEM. A major update has just been uploaded to CRAN, which includes extensions of R-squared to models not previously covered:
https://cran.r-project.org/web/packages/piecewiseSEM/index.html
Hello, I am trying fit a glmer where the fixed variables has a different number of observations (72 and 60). With the models where the variables has the full observations I don�t have problems but yes in the models where some of its variables has 60 observations. In the second case, all work well until I compute the R2m and R2c and I get the error "fitting model with the observation-level random effect term failed. Add the term manually", so, when I ingress the observation level the AIC increase 2 points, and miss 1 df. Please how I might work in these cases??
First case...
glmer(Spp~1+Mth.Prec+Soil.depth+Drainage+(1|Cluster),data = VariabRL,family=poisson,glmerControl(optimizer="bobyqa", optCtrl = list(maxfun = 2e5)))
Second case...
glmer(Spp~1+Mth.Prec+Soil.depth+Drainage+(1|Cluster)+(1|X),data = VariabRL,family=poisson,glmerControl(optimizer="bobyqa", optCtrl = list(maxfun = 2e5)))
Mth.Prec = 72 observations
Soil.depth and Drainage = 60 observations
X = observation level
Thanks a lot
Jorge Cueva Ortiz
Ing. Forestal
ECU: 0993085161
GER: 0049 1631327886
[[alternative HTML version deleted]]
_______________________________________________
https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
Loading...