# Extract all R2 values from LMM

In order to analyse which factors have greater weight in the proportion of incidence (number of infected individuals against total individuals), the interaction of all factors (habitat, site and seasons) must be tested by a linear mixed model (LMM)

The predictor variables are habitat and season, considering at the same time the random factor sampling site and the response factor was the incidence value.

The dataset that I am using is this: https://drive.google.com/file/d/1fVuJNdZ593L6LoIKNhUynRGGIsN-IdxV/view?usp=sharing

I performed the GLMM by R. Habitat and season as fixed factor and site as random

 m1 <- nlme::lme(Incidence ~ Habitat + Season, random = ~1|Site, data=Incidence)


In order to extract the R2

      r2 <- r2glmm::r2beta(model=m1,partial=TRUE,method='sgv')

print(r2)

Effect   Rsq upper.CL lower.CL
Model 0.867    0.929    0.792
HabitatEdge 0.705    0.836    0.539
HabitatWasteland 0.639    0.797    0.443
HabitatOakwood 0.603    0.775    0.394
SeasonSummer 0.084    0.348    0.000
SeasonSpring 0.003    0.184    0.000


I would like to obtain the R2 of all habitat (included Crop) and all seasons (included Autumn), this analysis took them as "Model".

Using summary function, those factors (crop and autumn) are masked by Intercept

What can I do?

• Aren't those factor levels used as the reference levels in your model (like, summary() won't print the corresponding regression coefficient either)?
– chl
Nov 3, 2020 at 18:44
• Using summary function, those factors (crop and autumn) are masked by Intercept, and I can not know these values. Nov 3, 2020 at 18:48
• Relevel your factor (i.e. change the reference category) or use C or contrasts. See Coding for categorical variables in regression models.
– chl
Nov 3, 2020 at 18:55
• I don't know this package, but why is it printing an $R^2$ value for each factor level, and not for the factor itself? See also this related thread.
– chl
Nov 3, 2020 at 19:03
• r.squaredGLMM() provide the Marginal R-Squared and Conditional R-Squared but not the R-squared of each element Nov 3, 2020 at 19:05