5.1 Generating a Forest Plot

To produce a forest plot, we use the meta-analysis output we just created (e.g., m, m.raw) and the meta::forest() function. I will use my m.hksj.raw output from Chapter 4.2.3 to create the forest plot.

forest(m.hksj.raw)

Looks good so far. We see that the function plotted a forest plot with a diamond (i.e. the overall effect and its confidence interval) and a prediction interval.

There are plenty of other parameters within the meta::forest function which we can use to modify the forest plot.

Type Parameter Description
General sortvar A sorting variable. For example, you can sort the forest plot by effect size using ‘TE’, or by author name using ‘Author’
General studlab This tells the function which variable should be printed as the study label. The standard is ‘Author’
General comb.fixed Whether fixed effect estimate should be plotted. (TRUE/FALSE)
General comb.random Whether random effects estimate should be plotted. (TRUE/FALSE)
General overall Whether overall summaries should be plotted. This argument is useful in a meta-analysis with subgroups if summaries should only be plotted on group level.
General text.fixed A character string used in the plot to label the pooled fixed effect estimate. Has to be put in "" (e.g. “Overall effect”)
General text.random A character string used in the plot to label the pooled random effect estimate. Has to be put in "" (e.g. “Overall effect”)
General col.fixed Line colour (pooled fixed effect estimate). E.g. “red”, “blue”, or hex color code (“#2e8aff”)
General col.random Line colour (random fixed effect estimate). E.g. “red”, “blue”, or hex color code (“#2e8aff”)
General prediction Whether a prediction interval should be printed.
General text.predict A character string used in the plot to label the prediction interval. E.g. “Prediction Interval”
General subgroup A logical indicating whether subgroup results should be shown in forest plot. This argument is useful in a meta-analysis with subgroups if summaries should not be plotted on group level. (TRUE/FALSE)
General print.subgroup.labels A logical indicating whether subgroup label should be printed. (TRUE/FALSE)
General study.results Whether results for individual studies should be shown in the figure (useful to only plot subgroup results). (TRUE/FALSE)
General xlab A label for the x-axis on the bottom. Put in "".
General smlab A label for the summary measure on top. Put in "".
General xlim The x limits (min,max) of the plot, or the character “s” to produce symmetric forest plots. This is particularly revelant when your results deviate substantially from zero, or if you also want to have outliers depicted. (e.g. xlim=c(0,1.5) for effects from 0 to 1.5).
General ref The reference value to be plotted as a line in the forest plot. This is interesting if you want to compare effects to common thresholds or results from previous analyses (e.g. ref=0.5)
General leftcols Here you can specify all variables which should be printed on the left side of your plot. The variables have to be part of you meta-analysis output, so check with name_of_your_output$ which variables can be displayed. E.g. leftcols=c(“TE”,“seTE”).
General rightcols Same as leftcols, but for the right side of your plot
General leftlabs This specifies how the columns on the left side should be named. Always provide all labels (e.g. leftlabs=c(“Author”,“Effect size”,“Standard error”))
General rightlabs Same as leftlabs, but for the left side of you plot
General print.I2 Whether to print the value of the I-squared statistic.
General print.I2.ci Whether to print the confidence interval of the I-squared statistic.
General squaresize A numeric used to increase or decrease the size of squares in the forest plot. (E.g., squaresize = 1.2)
Color col.study The colour for individual study results and confidence limits. E.g. ‘red’, ‘blue’, or hex color code (‘#2e8aff’)
Color col.inside The colour for individual study results and confidence limits if confidence limits are completely within squares. E.g. ‘red’, ‘blue’, or hex color code (‘#2e8aff’)
Color col.square The colour for squares reflecting study’s weight in the meta-analysis. E.g. ‘red’, ‘blue’, or hex color code (‘#2e8aff’)
Color col.square.lines The colour for the outer lines of squares reflecting study’s weight in the meta-analysis. E.g. ‘red’, ‘blue’, or hex color code (‘#2e8aff’)
Color col.diamond The colour of diamonds representing the results for fixed effect and random effects models. E.g. ‘red’, ‘blue’, or hex color code (‘#2e8aff’)
Color col.diamond.fixed The colour of diamonds for fixed effect estimates. E.g. ‘red’, ‘blue’, or hex color code (‘#2e8aff’)
Color col.diamond.random The colour of diamonds for random effects estimates. E.g. ‘red’, ‘blue’, or hex color code (‘#2e8aff’)
Color col.diamond.lines The colour of the outer lines of diamonds representing the results for fixed effect and random effects models. E.g. ‘red’, ‘blue’, or hex color code (‘#2e8aff’)
Color col.diamond.lines.fixed The colour of the outer lines of diamond for fixed effect estimate. E.g. ‘red’, ‘blue’, or hex color code (‘#2e8aff’)
Color col.diamond.lines.random The colour of the outer lines of diamond for random effects estimate. E.g. ‘red’, ‘blue’, or hex color code (‘#2e8aff’)
Color col.inside.fixed The colour for result of fixed effect meta-analysis if confidence limit lies completely within square. E.g. ‘red’, ‘blue’, or hex color code (‘#2e8aff’)
Color col.inside.random The colour for result of random effects meta-analysis if confidence limit lies completely within square. E.g. ‘red’, ‘blue’, or hex color code (‘#2e8aff’)
Color col.predict Background colour of prediction interval. E.g. ‘red’, ‘blue’, or hex color code (‘#2e8aff’)
Color col.predict.lines Colour of outer lines of prediction interval. E.g. ‘red’, ‘blue’, or hex color code (‘#2e8aff’)
Color col.label.right The colour for label on right side of null effect. E.g. ‘red’, ‘blue’, or hex color code (‘#2e8aff’)
Color col.label.left The colour for label on left side of null effect. E.g. ‘red’, ‘blue’, or hex color code (‘#2e8aff’)
Digits digits Minimal number of significant digits for treatment effects (TE)
Digits digits.se Minimal number of significant digits for standard errors
Digits digits.zval Minimal number of significant digits for z- or t-statistic for test of overall effect
Digits digits.tau2 Minimal number of significant digits for between-study variance
Digits digits.pval Minimal number of significant digits for p-value of overall treatment effect
Digits digits.pval.Q Minimal number of significant digits for p-value of heterogeneity test
Digits digits.Q Minimal number of significant digits for heterogeneity statistic Q
Digits digits.I2 Minimal number of significant digits for I-squared statistic
Digits digits.weight Minimal number of significant digits for weights
Digits digits.mean Minimal number of significant digits for the mean
Digits digits.sd Minimal number of significant digits for the standard deviations

This is again just an overview. For all settings, type ?meta::forest in your Console to see more.

Let us play around with the function a little now:

forest(m.hksj.raw,
       sortvar=TE,
       xlim = c(-1.5,0.5),
       rightlabs = c("g","95% CI","weight"),
       leftlabs = c("Author", "N","Mean","SD","N","Mean","SD"),
       lab.e = "Intervention",
       pooled.totals = FALSE,
       smlab = "",
       text.random = "Overall effect",
       print.tau2 = FALSE,
       col.diamond = "blue",
       col.diamond.lines = "black",
       col.predict = "black",
       print.I2.ci = TRUE,
       digits.sd = 2
)

Looks good so far! For special layout types, proceed to Chapter 5.2 now.




banner