I need to obtain partial R2 for all explanatory variables of a mixed model, which should also include a correlation structure. For instance:
> mod_nlme = nlme(Richness_herbs ~ A*B + C, random = ~ 1|plot, data,
corr = corSpatial(form = ~Easting + Northing, type ="exponential", nugget = F), method = "ML")
A, B and C are factors with 3, 2 and 3 modalities respectively, so when I use the r2beta function (package r2glmm) with default method, I obtain partial R2 for each modality:
> r2beta(mod_nlme, partial = 'TRUE')
Effect Rsq upper.CL lower.CL
1 Model 0.442 0.638 0.314
3 A2 0.168 0.364 0.031
2 A3 0.078 0.255 0.002
7 C1 0.024 0.161 0.000
6 C2 0.019 0.150 0.000
5 C3 0.011 0.131 0.000
4 B2 0.002 0.099 0.000
8 A2:B2 0.001 0.095 0.000
9 A3:B2 0.000 0.091 0.000
I would rather report the partial R2 of the each variable, not modality, because it is more easily understandable (similar to the linear model, or "variance explained by each variable" in lm, although I am aware that it is not exact for mixed models). This is possible with the "kr" method of the r2beta function; but it works only for lmer models:
> r2beta(mod_nlme, partial = 'TRUE', 'kr')
Error in r2beta.lme(mod, partial = "TRUE", "kr") : The Kenward Roger approach is only compatible with lmerMod objects.
> mod_lmer = lmer(Richness_herbs ~ Ntrans*s + Crop3 + (1|plot),
Div_trans2)
> r2beta(mod_lmer, partial = 'TRUE', 'kr')
Effect Rsq upper.CL lower.CL
1 Model 0.372 0.585 0.252
2 A 0.132 0.329 0.026
4 B 0.058 0.248 0.011
3 C 0.010 0.135 0.000
5 A:B 0.005 0.154 0.001
But then, from various reads on this forum and from the documentation, it seems that lmer does supports spatial correlation structures (please correct me if I'm wrong). So if I use nlme I can use spatial correlation, but not obtain the variable-level partial R2, and with lmer I can't use spatial autocorrelation.
Is there any way to combine both requirements?