tips:rma_vs_lm_lme_lmer
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
tips:rma_vs_lm_lme_lmer [2016/07/01 17:25] – external edit 127.0.0.1 | tips:rma_vs_lm_lme_lmer [2021/11/08 13:31] – Wolfgang Viechtbauer | ||
---|---|---|---|
Line 3: | Line 3: | ||
In essence, the commonly used meta-analytic models are just special cases of the linear (mixed-effects) model with the only peculiar aspect that the variances of the error terms (i.e., the sampling variances) are known. Not surprisingly, | In essence, the commonly used meta-analytic models are just special cases of the linear (mixed-effects) model with the only peculiar aspect that the variances of the error terms (i.e., the sampling variances) are known. Not surprisingly, | ||
- | ==== Fixed-Effects Model ==== | + | ==== Equal-Effects Model ==== |
- | Let's start with a fixed-effects model. As an example, consider the data from the meta-analysis by Molloy et al. (2014) on the relationship between conscientiousness and medication adherence. For each study, we can compute the r-to-z transformed correlation coefficient and corresponding sampling variance with: | + | Let's start with an equal-effects model. As an example, consider the data from the meta-analysis by Molloy et al. (2014) on the relationship between conscientiousness and medication adherence. For each study, we can compute the r-to-z transformed correlation coefficient and corresponding sampling variance with: |
<code rsplus> | <code rsplus> | ||
library(metafor) | library(metafor) | ||
Line 32: | Line 32: | ||
The '' | The '' | ||
- | We can now fit a fixed-effects model to these data with: | + | We can now fit an equal-effects model to these data with: |
<code rsplus> | <code rsplus> | ||
- | res.fe <- rma(yi, vi, data=dat, method=" | + | res.ee <- rma(yi, vi, data=dat, method=" |
- | res.fe | + | res.ee |
</ | </ | ||
<code output> | <code output> | ||
- | Fixed-Effects Model (k = 16) | + | Equal-Effects Model (k = 16) |
- | Test for Heterogeneity: | + | I^2 (total heterogeneity / total variability): |
+ | H^2 (total variability / sampling variability): | ||
+ | |||
+ | Test for Heterogeneity: | ||
Q(df = 15) = 38.1595, p-val = 0.0009 | Q(df = 15) = 38.1595, p-val = 0.0009 | ||
Model Results: | Model Results: | ||
- | estimate | + | estimate |
- | 0.1252 | + | 0.1252 |
--- | --- | ||
- | Signif. codes: | + | Signif. codes: |
</ | </ | ||
Line 74: | Line 77: | ||
</ | </ | ||
Two things are of note here: | Two things are of note here: | ||
- | - The estimated intercept ('' | + | - The estimated intercept ('' |
- The standard error (of the estimated intercept) is different (and hence, the test statistic and p-value also differs). | - The standard error (of the estimated intercept) is different (and hence, the test statistic and p-value also differs). | ||
Line 81: | Line 84: | ||
This can be demonstrated by extracting the estimated error variance from the '' | This can be demonstrated by extracting the estimated error variance from the '' | ||
<code rsplus> | <code rsplus> | ||
- | rma(yi, vi*summary(res.lm)$sigma^2, | + | rma(yi, vi*summary(res.lm)$sigma^2, |
</ | </ | ||
<code output> | <code output> | ||
- | Fixed-Effects Model (k = 16) | + | Equal-Effects Model (k = 16) |
- | Test for Heterogeneity: | + | I^2 (total heterogeneity / total variability): |
+ | H^2 (total variability / sampling variability): | ||
+ | |||
+ | Test for Heterogeneity: | ||
Q(df = 15) = 15.0000, p-val = 0.4514 | Q(df = 15) = 15.0000, p-val = 0.4514 | ||
Model Results: | Model Results: | ||
- | estimate | + | estimate |
- | 0.1252 | + | 0.1252 |
--- | --- | ||
- | Signif. codes: | + | Signif. codes: |
</ | </ | ||
Now these results are exactly the same as those obtained by the '' | Now these results are exactly the same as those obtained by the '' | ||
Line 101: | Line 107: | ||
Therefore, if we want to obtain the same standard error from '' | Therefore, if we want to obtain the same standard error from '' | ||
<code rsplus> | <code rsplus> | ||
- | coef(summary(res.fe)) | + | coef(summary(res.ee)) |
</ | </ | ||
<code output> | <code output> | ||
Line 108: | Line 114: | ||
</ | </ | ||
<code rsplus> | <code rsplus> | ||
- | coef(summary(res.lm))[1, | + | coef(summary(res.lm))[1, |
</ | </ | ||
<code output> | <code output> | ||
Line 216: | Line 222: | ||
To illustrate this, we can again factor in that constant into the sampling variances and refit the model with '' | To illustrate this, we can again factor in that constant into the sampling variances and refit the model with '' | ||
<code rsplus> | <code rsplus> | ||
- | rma(yi, vi*res.lme$sigma^2, data=dat) | + | rma(yi, vi*sigma(res.lme)^2, data=dat) |
</ | </ | ||
<code output> | <code output> | ||
Line 285: | Line 291: | ||
These are the exact same results as obtained earlier with the '' | These are the exact same results as obtained earlier with the '' | ||
- | **Update:** The R version of the '' | + | **Update:** The R version of the '' |
==== Summary ==== | ==== Summary ==== |
tips/rma_vs_lm_lme_lmer.txt · Last modified: 2023/11/14 08:00 by Wolfgang Viechtbauer