tips:model_selection_with_glmulti_and_mumin
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tips:model_selection_with_glmulti_and_mumin [2021/10/22 14:44] – Wolfgang Viechtbauer | tips:model_selection_with_glmulti_and_mumin [2022/08/09 05:28] – Wolfgang Viechtbauer | ||
---|---|---|---|
Line 1: | Line 1: | ||
===== Model Selection using the glmulti and MuMIn Packages ===== | ===== Model Selection using the glmulti and MuMIn Packages ===== | ||
- | Information-theoretic approaches provide methods for model selection and (multi)model inference that differ quite a bit from more traditional methods based on null hypothesis testing (e.g., Anderson, 2007; Burnham & Anderson, 2002). These methods can also be used in the meta-analytic context when model fitting is based on likelihood methods. Below, I illustrate how to use the metafor package in combination with the [[https:// | + | Information-theoretic approaches provide methods for model selection and (multi)model inference that differ quite a bit from more traditional methods based on null hypothesis testing (e.g., Anderson, 2007; Burnham & Anderson, 2002). These methods can also be used in the meta-analytic context when model fitting is based on likelihood methods. Below, I illustrate how to use the metafor package in combination with the [[https:// |
==== Data Preparation ==== | ==== Data Preparation ==== | ||
- | For the example, I will use data from the meta-analysis by Bangert-Drowns et al. (2004) on the effectiveness of school-based writing-to-learn interventions on academic achievement ('' | + | For the example, I will use data from the meta-analysis by Bangert-Drowns et al. (2004) on the effectiveness of school-based writing-to-learn interventions on academic achievement ('' |
<code rsplus> | <code rsplus> | ||
library(metafor) | library(metafor) | ||
Line 43: | Line 43: | ||
* length: treatment length (in weeks) | * length: treatment length (in weeks) | ||
- | * wic: writing in class (0 = no; 1 = yes) | + | * wic: writing |
- | * feedback: feedback (0 = no; 1 = yes) | + | * feedback: feedback |
* info: writing contained informational components (0 = no; 1 = yes) | * info: writing contained informational components (0 = no; 1 = yes) | ||
* pers: writing contained personal components (0 = no; 1 = yes) | * pers: writing contained personal components (0 = no; 1 = yes) | ||
* imag: writing contained imaginative components (0 = no; 1 = yes) | * imag: writing contained imaginative components (0 = no; 1 = yes) | ||
- | * meta: prompts for metacognitive reflection (0 = no; 1 = yes) | + | * meta: prompts for metacognitive reflection |
More details about the meaning of these variables can be found in Bangert-Drowns et al. (2004). For the purposes of this illustration, | More details about the meaning of these variables can be found in Bangert-Drowns et al. (2004). For the purposes of this illustration, | ||
Line 59: | Line 59: | ||
==== Model Selection ==== | ==== Model Selection ==== | ||
- | We will now examine the fit and plausibility of various models, focusing on models that contain none, one, and up to seven (i.e., all) of these moderator variables. For this, we need to install and load the glmulti package and define a function that takes a model formula and a dataset as input and then fits a random/mixed-effects meta-regression model to the given data using maximum likelihood estimation: | + | We will now examine the fit and plausibility of various models, focusing on models that contain none, one, and up to seven (i.e., all) of these moderator variables. For this, we install and load the glmulti package and define a function that (a) takes a model formula and dataset as input and (b) then fits a mixed-effects meta-regression model to the given data using maximum likelihood estimation: |
<code rsplus> | <code rsplus> | ||
install.packages(" | install.packages(" | ||
Line 123: | Line 123: | ||
</ | </ | ||
- | We see that the " | + | We see that the " |
So, we could now examine the " | So, we could now examine the " | ||
Line 132: | Line 132: | ||
Mixed-Effects Model (k = 41; tau^2 estimator: ML) | Mixed-Effects Model (k = 41; tau^2 estimator: ML) | ||
- | logLik | + | logLik |
- | | + | |
tau^2 (estimated amount of residual heterogeneity): | tau^2 (estimated amount of residual heterogeneity): | ||
Line 149: | Line 149: | ||
Model Results: | Model Results: | ||
- | | + | |
- | intrcpt | + | intrcpt |
- | imag | + | imag |
--- | --- | ||
Line 172: | Line 172: | ||
If we do want to make inferences about the various predictors, we may want to do so not in the context of a single model that is declared to be " | If we do want to make inferences about the various predictors, we may want to do so not in the context of a single model that is declared to be " | ||
- | < | + | < |
eval(metafor::: | eval(metafor::: | ||
</ | </ | ||
Line 180: | Line 180: | ||
coef(res) | coef(res) | ||
</ | </ | ||
- | The output is not shown, because I don't find it very intuitive. But with a bit of extra code, we can make it more interpretable: | + | The output is not shown, because I don't find it very intuitive. But with a bit of extra code, we can make it more interpretable: |
<code rsplus> | <code rsplus> | ||
mmi <- as.data.frame(coef(res)) | mmi <- as.data.frame(coef(res)) | ||
Line 310: | Line 310: | ||
</ | </ | ||
<code output> | <code output> | ||
- | Global model call: rma(yi = yi, vi = vi, mods = ~length + wic + feedback + info + | + | Global model call: rma(yi = yi, vi = vi, mods = ~length + wic + feedback + info + |
pers + imag + meta, data = dat, method = " | pers + imag + meta, data = dat, method = " | ||
--- | --- | ||
- | Model selection table | + | Model selection table |
| | ||
3 + | 3 + | ||
Line 334: | Line 334: | ||
</ | </ | ||
<code output> | <code output> | ||
- | Model-averaged coefficients: | + | Model-averaged coefficients: |
- | (full average) | + | (full average) |
- | Estimate Std. Error z value Pr(> | + | Estimate Std. Error z value Pr(> |
- | intrcpt | + | intrcpt |
imag 0.351153 | imag 0.351153 | ||
- | meta 0.051201 | + | meta 0.051201 |
- | feedback | + | feedback |
- | length | + | length |
- | wic -0.017004 | + | wic -0.017004 |
- | pers 0.013244 | + | pers 0.013244 |
- | info | + | info |
</ | </ | ||
I have removed some of the output, since this is the part we are most interested in. These are the same results as in object '' | I have removed some of the output, since this is the part we are most interested in. These are the same results as in object '' |
tips/model_selection_with_glmulti_and_mumin.txt · Last modified: 2022/10/13 06:07 by Wolfgang Viechtbauer