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')

        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?

  • $\begingroup$ Aren't those factor levels used as the reference levels in your model (like, summary() won't print the corresponding regression coefficient either)? $\endgroup$
    – chl
    Nov 3, 2020 at 18:44
  • $\begingroup$ Using summary function, those factors (crop and autumn) are masked by Intercept, and I can not know these values. $\endgroup$ Nov 3, 2020 at 18:48
  • 1
    $\begingroup$ Relevel your factor (i.e. change the reference category) or use C or contrasts. See Coding for categorical variables in regression models. $\endgroup$
    – chl
    Nov 3, 2020 at 18:55
  • 1
    $\begingroup$ 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. $\endgroup$
    – chl
    Nov 3, 2020 at 19:03
  • 1
    $\begingroup$ r.squaredGLMM() provide the Marginal R-Squared and Conditional R-Squared but not the R-squared of each element $\endgroup$ Nov 3, 2020 at 19:05


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.