plots:meta_analytic_scatterplot
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
plots:meta_analytic_scatterplot [2020/06/03 08:34] – [Code] Wolfgang Viechtbauer | plots:meta_analytic_scatterplot [2021/04/25 13:17] – Wolfgang Viechtbauer | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Meta-Analytic | + | ===== Meta-Analytic |
==== Description ==== | ==== Description ==== | ||
- | Below is an example of a scatterplot, showing the observed outcomes (risk ratios) of the individual studies plotted against a quantitative predictor (absolute latitude). The radius | + | Below is an example of a scatter plot (also known as a bubble plot), showing the observed outcomes (i.e., risk ratios) of the individual studies plotted against a quantitative predictor (i.e., the absolute latitude |
==== Plot ==== | ==== Plot ==== | ||
Line 20: | Line 20: | ||
res <- rma(yi, vi, mods = ~ ablat, data=dat) | res <- rma(yi, vi, mods = ~ ablat, data=dat) | ||
- | ### calculate predicted risk ratios for 0 to 60 degrees absolute latitude | + | ### draw plot |
- | preds <- predict(res, newmods=c(0: | + | regplot(res, xlim=c(10, |
- | + | | |
- | ### radius of points will be proportional to the inverse standard errors | + | |
- | ### hence the area of the points will be proportional to inverse variances | + | |
- | size <- 1 / sqrt(dat$vi) | + | |
- | size <- size / max(size) | + | |
- | + | ||
- | ### set up plot (risk ratios on y-axis, absolute latitude on x-axis) | + | |
- | plot(NA, NA, xlim=c(10, | + | |
- | xlab=" | + | |
- | las=1, bty=" | + | |
- | + | ||
- | ### add points | + | |
- | symbols(dat$ablat, exp(dat$yi), | + | |
- | + | ||
- | ### add predicted values (and corresponding CI bounds) | + | |
- | lines(0:60, preds$pred) | + | |
- | lines(0:60, preds$ci.lb, lty=" | + | |
- | lines(0:60, preds$ci.ub, lty=" | + | |
- | + | ||
- | ### dotted line at RR=1 (no difference between groups) | + | |
- | abline(h=1, lty="dotted") | + | |
- | + | ||
- | ### labels some points in the plot | + | |
- | ids <- c(4, | + | |
- | pos <- c(3,3,1,1) | + | |
- | text(dat$ablat[ids], exp(dat$yi)[ids], | + | |
</ | </ | ||
plots/meta_analytic_scatterplot.txt · Last modified: 2022/03/26 16:15 by Wolfgang Viechtbauer