help metandi                                                    (Roger Harbord)
                                              also see:  metandi postestimation


metandi -- Meta-analysis of diagnostic accuracy


metandi tp fp fn tn [if] [in] [, plot gllamm ip(g|m) nip(#) nobivariate nohsroc nosummarypt detail level(#) allc trace nolog dots]

by may be used with metandi; see by.

See metandi postestimation for features available after estimation, in particular the predict command. metandiplot graphs the results from metandi.


Description - Options - Remarks - Examples - References - Acknowledgements - Author - Citation of metandi - Also see


metandi performs meta-analysis of diagnostic test accuracy studies in which both the index test under study and the reference test (gold standard) are dichotomous. It takes as input four variables tp fp fn tn giving the number of true positives, false positives, false negatives and true negatives within each study. It fits a two-level mixed logistic regression model, with independent binomial distributions for the true positives and true negatives conditional on the sensitivity and specificity in each study, and a bivariate normal model for the logit transforms of sensitivity and specificity between studies.

In Stata 10 metandi fits the model using the built-in command xtmelogit by default. In Stata 8 or 9 it makes use of the user-written command gllamm, which must therefore be installed. To ensure you have the most recent version of gllamm, type ssc install gllamm, replace.

metandi does not allow covariates to be fitted, i.e. meta-regression of diagnostic accuracy is not supported.


+------+ ----+ Plot +-------------------------------------------------------------

plot requests a plot of the results on a summary receiver operating characteristic (SROC) plot. This is a convenience option equivalent to executing the metandiplot command after metandi with the same list of variables tp fp fn tn (and the same if and in qualifiers if specified). Greater control of the plot is available through the options of the metandiplot command when issued separately.

The remaining options below control details of the estimation algorithm and reporting of results. Typically you will not need to specify any of them. However, this model can be difficult or slow to fit to certain datasets, in which case they may prove useful.

+------------+ ----+ Estimation +-------------------------------------------------------

gllamm specifies that the model be fitted using gllamm. This is the default in Stata 8 and 9 so the option is only of use in Stata 10, in which the model is fitted using xtmelogit by default.

ip(g|m) specifies the quadrature method: ip(g), the default, gives Cartesian product quadrature. ip(m) is only available when the model is fitted using gllamm. It gives spherical quadrature, which can be more efficient though its properties are less well known and it can sometimes cause adaptive quadrature to take longer to converge. See Rabe-Hesketh, Skrondal & Pickles (2005).

nip(#) specifies the number of integration points used for quadrature. Higher values should result in greater accuracy, but typically at the expense of longer execution times. Specifying too small a value can lead to convergence problems, or even failure of adaptive quadrature - if gllamm reports the error "log-likelihood cannot be computed", try increasing nip(). For Cartesian product quadrature, nip() specifies the number of points for each of the two random effects; the default is nip(5). For spherical quadrature, nip() specifies the degree d of the approximation; the default is nip(9), and the only values currently supported by gllamm are 5, 7, 9, 11 and 15. These defaults give approximately the same accuracy, as degree d for spherical quadrature corresponds in accuracy approximately to (d + 1)/2 points per random effect for Cartesian product quadrature. (Rabe-Hesketh & Skrondal 2005, appendix B.)

+-----------+ ----+ Reporting +--------------------------------------------------------

nobivariate, nohsroc and nosummarypt suppress reporting of the bivariate parameter estimates, the HSROC parameter estimates or the summary point estimates respectively.

detail displays the default output of all gllamm or xtmelogit commands issued. If the model is fitted using gllamm, this includes the output of two univariate models used to give good starting values for the bivariate model.

level(#) specifies the confidence level, in percent, for confidence intervals of the coefficients; see help level.

nolog suppresses display of the iteration log.

trace adds a display of the current parameter vector to the iteration log.


+--------+ ----+ Models +-----------------------------------------------------------

Estimates are displayed for the parameters of both the bivariate model (Reitsma et al. 2005) and the Hierarchical Summary Receiver Operating Characteristic (HSROC) model (Rutter & Gatsonis 2001). In the models without covariates fitted by metandi, these are different parameterisations of the same model (Harbord et al. 2007, Arends 2006).

metandi fits the model using the approach Chu & Cole (2006) refer to as a generalized linear mixed model approach to bivariate meta-analysis of sensitivity and specificity. As they indicate, in the common situation of low cell counts this may be preferable to the approach originally used by Reitsma et al. (2005) involving empirical logit transforms. This generalized linear mixed model approach corresponds to the "empirical Bayes" approach to fitting the HSROC model introduced by Macaskill (2004).

+--------+ ----+ Output +-----------------------------------------------------------

In the output of metandi, the bivariate parameters are denoted using E() for expectation (mean), Var() for variance, Corr() for correlation, logitSe for logit(sensitivity) and logitSp for logit(specificity). The HSROC parameters are denoted using the notation of Rutter & Gatsonis (2001), giving Latin names for Greek letters but abbreviating sigma^2_alpha and sigma^2_theta to s2alpha and s2theta.

The correlation rather than the covariance is displayed for the bivariate parameterisation as the correlation is more interpretable and its confidence interval can usually be computed. However, the correlation is often estimated imprecisely and may sometimes be estimated as -1 (or +1) (Riley et al. 2007). This corresponds to estimating s2alpha (or s2theta) to be very close to zero. When this occurs the estimated standard error and confidence interval for both are unreliable and will often be displayed as missing values.

The following estimates for the summary point are also displayed: sensitivity (Se), specificity (Sp), diagnostic odds ratio (DOR), positive likelihood ratio (LR+), negative likelihood ratio (LR-), inverse of the negative likelihood ratio (1/LR-).

Confidence intervals are computed assuming asymptotic normality after a log transformation for variance parameters and for DOR, LR+ and LR-, an atanh (Fisher's z) transformation for the correlation, and a logit transformation for proportions.

The covariance between the estimates of E(logitSe) & E(logitSp) is displayed at the end of the output as this is needed in addition to the other bivariate parameter estimates to construct confidence or prediction regions around the summary point.

+--------+ ----+ GLLAMM +-----------------------------------------------------------

For detailed information on the gllamm command, see the GLLAMM manual (Rabe-Hesketh, Skrondal & Pickles 2004) and Rabe-Hesketh & Skrondal (2005).


. metandi tp fp fn tn

. metandi tp fp fn tn, plot

. metandi a b c d, nobivariate nohsroc plot

. metandi (Replays default output)

. metandi a b c d if test==2, detail


Arends LR (2006). Multivariate meta-analysis: modelling the heterogeneity. Doctoral Thesis, Erasmus University Rotterdam.

Chu H, Cole SR (2006). Bivariate meta-analysis of sensitivity and specificity with sparse data: a generalized linear mixed model approach. Journal of Clinical Epidemiology 59:1331-1332. doi:10.1016/j.jclinepi.2006.06.011

Harbord RM, Deeks JJ, Egger M, Whiting P, Sterne JA (2007). A unification of models for meta-analysis of diagnostic accuracy studies. Biostatistics 8:239-251. doi:10.1093/biostatistics/kxl004

Macaskill P (2004). Empirical Bayes estimates generated in a hierarchical summary ROC analysis agreed closely with those of a full Bayesian analysis. Journal of Clinical Epidemiology 57:925-932. doi:10.1016/j.jclinepi.2003.12.019

Rabe-Hesketh S, Skrondal A (2005). Multilevel and Longitudinal Modeling Using Stata. College Station, TX: Stata Press.

Rabe-Hesketh S, Skrondal A, Pickles A (2004). GLLAMM Manual. U.C. Berkeley Division of Biostatistics Working Paper Series. Working Paper 160.

Rabe-Hesketh S, Skrondal A, Pickles A (2005). Maximum likelihood estimation of limited and discrete dependent variable models with nested random effects. Journal of Econometrics 128:301-323. doi:10.1016/j.jeconom.2004.08.017

Reitsma JB, Glas AS, Rutjes AWS, Scholten RJPM, Bossuyt PM, Zwinderman AH (2005). Bivariate analysis of sensitivity and specificity produces informative summary measures in diagnostic reviews. Journal of Clinical Epidemiology 58:982-990. doi:10.1016/j.jclinepi.2005.02.022

Riley RD, Abrams KR, Sutton AJ, Lambert PC, Thompson JR (2007). Bivariate random-effects meta-analysis and the estimation of between-study correlation. BMC Medical Research Methodology 7:3. doi:10.1186/1471-2288-7-3

Rutter CM, Gatsonis CA (2001). A hierarchical regression approach to meta-analysis of diagnostic test accuracy evaluations. Statistics in Medicine 20:2865-2884. doi:10.1002/sim.942


Joseph Coveney worked out how to fit the bivariate model using gllamm and posted the syntax on Statalist. I also thank him for generous and helpful email correspondence. metandi is essentially a wrapper for gllamm and I thank the authors of gllamm for their work, and Sophia-Rabe-Hesketh in particular for helpful email correspondence. Thanks also to Susan Mallett for pointing out a bug in a previous version.


Roger Harbord, Department of Social Medicine, University of Bristol, UK.

Citation of metandi

metandi is not an official Stata command. It is a free contribution to the research community, like a paper. Please cite it as such:

Harbord, RM (2008). metandi: Stata module for meta-analysis of diagnostic accuracy. Statistical Software Components, Boston College Department of Economics. Revised 15 Apr 2008.

metandi is based on the ideas and relies on the results in Harbord et al. (2006), which should therefore be cited as well.

Also see

Online: metandiplot, xtmelogit (in Stata 10 or above), gllamm (if