Twostage approach

The flagship package for conducting a twostage IPD metaanalysis is ipdmetan, developed by Dr David Fisher for the Stata software package. See:
â€‹
Fisher DJ. Twostage individual participant data metaanalysis and generalized forest plots. Stata Journal 2015;15(2):36996
â€‹

This package automates the calculation of trialspecific aggregate data (e.g. treatment effect estimates and their variances) from the first stage, and then produces summary metaanalysis results and a forest plot from the second stage.

It can be installed from within Stata, simply by typing ‘ssc install ipdmetan’. Type ‘help ipdmetan’ for a detailed help file and range of examples.
â€‹

The package is applicable to IPD metaanalyses aiming to summarise a particular effect of interest defined by a single parameter in a regression model (such as a treatment effect, or another measure that can be estimated in a regression model, such as a prognostic effect or a treatmentcovariate interaction).
â€‹

To implement ipdmetan, IPD from all trials should be collated in a single dataset including a column identifying the trial in which each participant was included. The user then specifies the trial identification variable, which regression model to use in the first stage (calling standard regression packages in Stata such as reg, logit, or stcox), and which metaanalysis model and estimation method(s) to use in the second stage.
â€‹

The package then fits a regression model to the IPD from each trial separately and stores the derived results (aggregate data) for each trial, which are then immediately used to fit a chosen metaanalysis model in the second stage. A wide variety of model and estimation options are available for the second stage, including common or random treatment effects, REML estimation, HartungKnappSidikJonkmann (HKSJ) confidence intervals and tailored display of forest plots.
â€‹
In Chapter 5 of our book, we focus on a twostage metaanalysis of randomised trials  and below is the code we used to run the examples (we cannot share the IPD itself).
â€‹

For the timetoevent outcome example of Box 5.4, the following syntax was used to implement the ipdmetan package to the IPD from 10 trials of antihypertensive treatment:
â€‹
ipdmetan, study(trial) re(reml, hksj) forest(xtitle(hazard ratio) boxsca(30) xlab(0.2 0.5 1 2) astext(40)) hr effect(HR) : stcox treat smk sbpi age bmi
The terms in the syntax are explained below:

study(trial) denotes that the column called ‘trial’ in the dataset is the trial identification covariate

re(reml hksj) denotes that a random treatment effects model is to be fitted using REML estimation, with 95% confidence interval derived using the HKSJ method

forest() includes various options for tailoring the display of the forest plot, including the size of the boxes around the trial treatment effect estimates (boxsca()), the title of the xaxis (xtitle), the values of the hazard ratio to be displayed in the xaxis (xlab()) and relative size of the text on the forest plot (astext())

hr denotes that results should be displayed on the hazard ratio scale (and not the log hazard ratio scale)

effect(HR) denotes that HR should be displayed above the column of trial treatment effect estimates on the righthand side of the plot.

the syntax after the colon denotes the method to use in the first stage to each trial separately

stcox treat denotes that a Cox regression model should be fitted in each trial separately, with the treatment variable (column called ‘treat’ containing a value of 1 for participants in the treatment group and 0 for participants in the control group) included alongside prognostic factors of smoking (‘smk’), SBP (‘sbpi’), age (‘age’) and BMI (‘bmi’). Unless told otherwise (using the poolvar() option before the colon), ipdmetan will produce metaanalysis results for the first covariate listed within the subsequent regression statement.
â€‹

For the continuous outcome example of Box 5.5, the following syntax was used to implement the ipdmetan package to the IPD from 33 trials examining the effect of interventions to reduce unnecessary weight gain in pregnancy :
â€‹
ipdmetan, study(studyid) re(reml, hksj) forest(spacing(2) boxsca(30) effect(mean difference) lcols(intervention study_name n) xlab(5 4 3 2 1 0 1 2) astext(70)): reg final_wt trt basline_wt
â€‹
Here, reg invokes a linear regression analysis, and final_wt and baseline_wt are the final and baseline weights, respectively, and treat is 1 for those in the treatment group and 0 for those in the control group.
â€‹

For the binary outcome example of Box 5.6, the following syntax was used to implement the ipdmetan package to do the first stage analysis and then store the study results in a dataset called 'AD.dta', followed by a metaregression using the metareg command.
â€‹
ipdmetan, study(studyid) re(reml, hksj) forest(spacing(2) boxsca(30) lcols(intervention study_name) xlab(0.5 1 2 3) astext(40) ) saving(AD.dta, replace) or: logit outcm_comp_exclbase trt2
use AD.dta
* this dataset has stored the effect estimates (_ES) and standard errors (_seES)
* plus studylevel covariates including intervention type (intervention) and study name (study_name)
sort intervention study_name
* create new dummy variables for the different types of interventions
tabulate intervention, gen(int_type)
* fit a metaregression with exercise (int_type2 = 1) and mixed (int_type3=1) as covariates
metareg _ES int_type2 int_type3, wsse(_seES) eform
â€‹

Of course, if you are willing to generate and collate the aggregate data outside of ipdmetan (indeed, sometimes this is necessary, for example if studies have different designs, or if the IPD are not all stored together) then tther metaanalysis packages are also be useful.

That is, researchers could take the dataset of treatment effect estimates and variances obtained from the first stage, and use another package to fit their metaanalysis (or metaregression) model in the second stage.

For example, available packages in Stata include meta, metan, metaan and metareg. In R, suitable packages include the exceptional metafor (see here for what this package offers), and also rmeta and metaplus, amongst others.