[R-sig-ME] GLMM - R squared
Ben Bolker
bbolker at gmail.com
Wed Mar 22 23:19:56 CET 2017
You have the same number of random effects grouping levels (plots, 16)
as total observations (16). The way that the conditional and marginal
R-squareds differ is by adding an observation-level random effect to
the model; since you already have an observation-level random effect
in your model, adding another observation-level random effect doesn't
make a difference.
While we're at it, I would be *very* careful fitting a model with 4-6
parameters (depending on whether you count the intercept and/or the
random effects variance) to a data set with 16 points; a general rule
of thumb (Harrell, *Regression Modeling Strategies*) is that you need
*at least* 10-20 data points per parameter ...
Possibly of interest:
library(dplyr)
ss <- arm::rescale ## avoid Error: Unsupported type CLOSXP for column "width"
comuni1sc <- comuni1 %>%
mutate_each(funs(ss),-c(riquplanta,plot,lot))
MM1B <- update(MM1A,data=comuni1sc)
library(ggplot2)
dotwhisker::dwplot(MM1B)+geom_vline(xintercept=0,lty=2)
On Wed, Mar 22, 2017 at 5:44 PM, Marcos Monasterolo
<mmonasterolo at agro.uba.ar> wrote:
> Dear all. I am working with a GLMM in the lme4 package using 4 fixed
> factors and 1 random factor (plot). An unexpected result comes up when I
> calculate the model's conditional and marginal R-squared using the
> r.squaredGLMM funtion in the MuMIn package. Both values are the same. Does
> this mean the random term does not add any explanatory power to the model
> (and could thus be dropped)? I provide a working code below. Thanks in
> advance for your help.
> Marcos
>
> id <- "0Bzd8I1jr8z_iRm1aRWhqdHJHcmc" # google file ID
> comuni <- read.table(sprintf("https://docs.google.com/uc?id=%s&
> export=download", id), head=T, sep="")
> comuni1<-comuni[-c(3,6,7,8),] #these data points I don't need
> library(lme4)
> MM1A <- glmer(riquplanta ~width+lot+exph200+db500+(1|plot), data = comuni1,
> family=poisson, control=glmerControl(optimizer="bobyqa",
> optCtrl=list(maxfun=2e5)))
> summary(MM1A)
> library(MuMIn)
> r.squaredGLMM(MM1A) #what's going on here?
>
>
> ----
> Biól. Marcos Monasterolo
> Becario doctoral - Cátedra de Botánica General, Facultad de Agronomía, UBA
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models
More information about the R-sig-mixed-models
mailing list