tips:computing_adjusted_effects
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:computing_adjusted_effects [2020/08/18 19:53] – Wolfgang Viechtbauer | tips:computing_adjusted_effects [2022/07/09 09:57] – Wolfgang Viechtbauer | ||
---|---|---|---|
Line 10: | Line 10: | ||
dat <- dat.bcg | dat <- dat.bcg | ||
dat <- escalc(measure=" | dat <- escalc(measure=" | ||
- | slab=paste0(dat$author, ", ", | + | slab=paste0(author, |
dat | dat | ||
</ | </ | ||
Line 37: | Line 37: | ||
<code rsplus> | <code rsplus> | ||
- | res <- rma(yi, vi, data=dat) | + | res1 <- rma(yi, vi, data=dat) |
- | res | + | res1 |
</ | </ | ||
<code output> | <code output> | ||
Line 53: | Line 53: | ||
Model Results: | Model Results: | ||
- | estimate | + | estimate |
- | | + | |
--- | --- | ||
- | Signif. codes: | + | Signif. codes: |
</ | </ | ||
- | To make the results easier to interpret, we can exponentiate the estimated average log risk ratio (i.e., $-0.7145$) to obtain an estimate of the average risk ratio. This can be done with the '' | + | To make the results easier to interpret, we can exponentiate the estimated average log risk ratio (i.e., $-0.7145$) to obtain an estimate of the average risk ratio.((Strictly speaking, since exponentiation is a non-linear transformation, |
<code rsplus> | <code rsplus> | ||
- | predict(res, transf=exp, digits=2) | + | predict(res1, transf=exp, digits=2) |
</ | </ | ||
<code output> | <code output> | ||
Line 75: | Line 75: | ||
<code rsplus> | <code rsplus> | ||
- | forest(res, xlim=c(-6.8, | + | forest(res1, xlim=c(-6.8, |
| | ||
</ | </ | ||
Line 86: | Line 86: | ||
<code rsplus> | <code rsplus> | ||
- | res <- rma(yi, vi, mods = ~ ablat, data=dat) | + | res2 <- rma(yi, vi, mods = ~ ablat, data=dat) |
- | res | + | res2 |
</ | </ | ||
<code output> | <code output> | ||
Line 106: | Line 106: | ||
Model Results: | Model Results: | ||
- | | + | |
- | intrcpt | + | intrcpt |
- | ablat | + | ablat |
--- | --- | ||
- | Signif. codes: | + | Signif. codes: |
</ | </ | ||
- | The results indeed suggest that the size of the average log risk ratio depends on absolute latitude. | + | The results indeed suggest that the size of the average log risk ratio is a function of the absolute latitude |
- | In such a meta-regression model, there is no longer | + | In such a meta-regression model, there is no longer |
<code rsplus> | <code rsplus> | ||
- | predict(res, newmods = mean(dat$ablat), | + | predict(res2, newmods = mean(dat$ablat), |
</ | </ | ||
<code output> | <code output> | ||
Line 131: | Line 131: | ||
<code rsplus> | <code rsplus> | ||
- | forest(res, xlim=c(-6.8, | + | forest(res2, xlim=c(-6.8, |
| | ||
- | ilab=dat$ablat, ilab.xpos=-3.5, | + | |
text(-3.5, 15, " | text(-3.5, 15, " | ||
abline(h=0) | abline(h=0) | ||
- | sav <- predict(res, newmods = mean(dat$ablat)) | + | sav1 <- predict(res1) |
- | addpoly(sav$pred, sei=sav$se, atransf=exp, | + | addpoly(sav1, |
+ | sav2 <- predict(res2, newmods = mean(dat$ablat)) | ||
+ | addpoly(sav2, row=-2, mlab="Meta-Regression Model (Adjusted Effect)") | ||
</ | </ | ||
- | In the forest plot, the values of the moderator are added as an extra column and the studies are ordered based on their absolute latitude value to make this clearer. Some extra space was also added to the forest plot to add the ' | + | In the forest plot, the values of the moderator are added as an extra column and the studies are ordered based on their absolute latitude value to make this clearer. Some extra space was also added to the forest plot to add the estimate from the standard random-effects model and the ' |
{{ tips: | {{ tips: | ||
Line 149: | Line 151: | ||
<code rsplus> | <code rsplus> | ||
- | res <- rma(yi, vi, mods = ~ alloc, data=dat) | + | res3 <- rma(yi, vi, mods = ~ alloc, data=dat) |
- | res | + | res3 |
</ | </ | ||
<code output> | <code output> | ||
Line 178: | Line 180: | ||
</ | </ | ||
- | The intercept reflects the estimated average log risk ratio for level '' | + | The intercept reflects the estimated average log risk ratio for level '' |
First, we can compute the estimated average risk ratios for the three levels with: | First, we can compute the estimated average risk ratios for the three levels with: | ||
<code rsplus> | <code rsplus> | ||
- | predict(res, newmods = c(0,0), transf=exp, digits=2) | + | predict(res3, newmods = c(0,0), transf=exp, digits=2) |
- | predict(res, newmods = c(1,0), transf=exp, digits=2) | + | predict(res3, newmods = c(1,0), transf=exp, digits=2) |
- | predict(res, newmods = c(0,1), transf=exp, digits=2) | + | predict(res3, newmods = c(0,1), transf=exp, digits=2) |
</ | </ | ||
<code output> | <code output> | ||
Line 194: | Line 196: | ||
</ | </ | ||
- | Note: The output above was obtained with '' | + | Note: The output above was obtained with '' |
But what should we do if we want to compute an ' | But what should we do if we want to compute an ' | ||
<code rsplus> | <code rsplus> | ||
- | colMeans(model.matrix(res))[-1] | + | colMeans(model.matrix(res3))[-1] |
</ | </ | ||
<code output> | <code output> | ||
Line 209: | Line 211: | ||
<code rsplus> | <code rsplus> | ||
- | predict(res, newmods = colMeans(model.matrix(res))[-1], transf=exp, digits=2) | + | predict(res3, newmods = colMeans(model.matrix(res3))[-1], transf=exp, digits=2) |
</ | </ | ||
<code output> | <code output> | ||
Line 223: | Line 225: | ||
<code rsplus> | <code rsplus> | ||
- | predict(res, newmods = c(1/3,1/3), transf=exp, digits=2) | + | predict(res3, newmods = c(1/3,1/3), transf=exp, digits=2) |
</ | </ | ||
<code output> | <code output> | ||
Line 235: | Line 237: | ||
<code rsplus> | <code rsplus> | ||
- | res <- rma(yi, vi, mods = ~ ablat + alloc, data=dat) | + | res4 <- rma(yi, vi, mods = ~ ablat + alloc, data=dat) |
- | res | + | res4 |
</ | </ | ||
<code output> | <code output> | ||
Line 268: | Line 270: | ||
<code rsplus> | <code rsplus> | ||
- | predict(res, newmods = colMeans(model.matrix(res))[-1], transf=exp, digits=2) | + | predict(res4, newmods = colMeans(model.matrix(res4))[-1], transf=exp, digits=2) |
</ | </ | ||
<code output> | <code output> |
tips/computing_adjusted_effects.txt · Last modified: 2024/06/07 12:32 by Wolfgang Viechtbauer