partR2: partitioning R in generalized linear mixed models
The coefficient of determination<em>R</em><sup>2</sup>quantifies the amount of variance explained by regression coefficients in a linear model. It can be seen as the fixed-effects complement to the repeatability<em>R</em>(intra-class correlation) for the variance explained by random effects and thus as a tool for variance decomposition. The<em>R</em><sup>2</sup>of a model can be further partitioned into the variance explained by a particular predictor or a combination of predictors using semi-partial (part)<em>R</em><sup>2</sup>and structure coefficients, but this is rarely done due to a lack of software implementing these statistics. Here, we introduce<monospace>partR2</monospace>, an R package that quantifies part<em>R</em><sup>2</sup>for fixed effect predictors based on (generalized) linear mixed-effect model fits. The package iteratively removes predictors of interest from the model and monitors the change in the variance of the linear predictor. The difference to the full model gives a measure of the amount of variance explained uniquely by a particular predictor or a set of predictors.<monospace>partR2</monospace>also estimates structure coefficients as the correlation between a predictor and fitted values, which provide an estimate of the total contribution of a fixed effect to the overall prediction, independent of other predictors. Structure coefficients can be converted to the total variance explained by a predictor, here called ‘inclusive’<em>R</em><sup>2</sup>, as the square of the structure coefficients times total<em>R</em><sup>2</sup>. Furthermore, the package reports beta weights (standardized regression coefficients). Finally,<monospace>partR2</monospace>implements parametric bootstrapping to quantify confidence intervals for each estimate. We illustrate the use of<monospace>partR2</monospace>with real example datasets for Gaussian and binomial GLMMs and discuss interactions, which pose a specific challenge for partitioning the explained variance among predictors.
9
PeerJ
1