In order to analyse which factors have greater weight in the proportion of incidence (number of infected inidivuals 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 LMM by R. Habitat and season as fixed factor and site as random
lme(Incidence ~ Habitat + Season, random = ~1|Site)
In order to extract the variance I execute these codes in r
##to obtain ramdon effects
vc <- lme4::VarCorr(GlM_habitats)
print(vc,comp=c("Variance","Std.Dev."),digits=2)
Site = pdLogChol(1)
Variance StdDev
(Intercept) 0.0031535943 0.05615687
Residual 0.0008026781 0.02833157
# Variance of fixed effects:
get_variance_fixed(GlM_habitats)
var.fixed
0.01533339
var_fixed <- diag(vc_fixed); var_fixed
(Intercept) HabitatEdge HabitatOakwood HabitatWasteland SeasonSpring SeasonSummer
0.0014200762 0.0020746951 0.0022753646 0.0022753646 0.0001337797 0.0004310081
# Standard errors of fixed effects:
se_fixed <- sqrt(var_fixed); se_fixed
(Intercept) HabitatEdge HabitatOakwood HabitatWasteland SeasonSpring SeasonSummer
0.03768390 0.04554882 0.04770078 0.04770078 0.01156632 0.02076074
However, I obtain the same variance value for crop (from habitat predictable variable) and autumn (from season predictable variable) called Intercept.
I do not know to separate them or obtain their variance value.
Thank you in advance
Best Answer
I second @IsabellaGhement's suggestion that you strongly consider a binomial model for the incidence (you'll need to know the 'denominator' — the total number of individuals used to compute the incidence).
$R^2$ measures do exist for linear mixed models, although there are several different, all slightly different,definitions. A reasonable place to start would be the overview of the r2glmm R package.
Now compute $R^2$ and display: