Forest plots are great ways to visualize individual group estimates as well as investigate heterogeneity of effect. Most forest plot programs will display combined effect estimates and give you an indicator of whether there is evidence for heterogeneity among subgroups. Fortunately, the R metafor package makes meta-analysis and plotting forest plots relatively easy. Below is a sample R script that will combine beta and standard error estimates from an input file (

*input.txt*) and create simple forest plots with an overall estimate as well as p-values for association and heterogeneity.

In general, the

*input.txt*file should either

(1) Have the columns:

*- name for the study or group*

__group__*- the log odds ratio for the effect of interest*

__beta__*- the standard error for the log odds ratio estimate*

__se__or

(2) Have the columns:

*- name for the study or group*

__group__*- odds ratio for the effect of interest*

__OR__*- lower confidence interval for the odds ratio*

__LCL__*- upper confidence interval for the odds ratio*

__UCL__For the second case where you have an odds ratio and 95% confidence estimates,

*beta*and

*se*need to be estimated. This is done by uncommenting lines 8 and 9 of the script. Of note: due to rounding error the final forest plot may have 95% CI limits that are one digit off.

The R script that uses the metafor package as well as an example

*input.txt*are below.

Hi,

ReplyDeletethanks for this script, i have been looking for something similar for a long time!

I was just wondering if it's ok to use it for a linear regression, and with standardized beta.

Thanks.