CopulaDTA: An R Package for Copula Based Bivariate Beta-Binomial Models for Diagnostic Test Accuracy Studies in a Bayesian Framework

The current statistical procedures implemented in statistical software packages for pooling of diagnostic test accuracy data include hSROC regression and the bivariate random-effects meta-analysis model (BRMA). However, these models do not report the overall mean but rather the mean for a central study with random-effect equal to zero and have difficulties estimating the correlation between sensitivity and specificity when the number of studies in the meta-analysis is small and/or when the between-study variance is relatively large. This tutorial on advanced statistical methods for meta-analysis of diagnostic accuracy studies discusses and demonstrates Bayesian modeling using CopulaDTA package in R to fit different models to obtain the meta-analytic parameter estimates. The focus is on the joint modelling of sensitivity and specificity using copula based bivariate beta distribution. Essentially, we extend the work of Nikoloulopoulos by: i) presenting the Bayesian approach which offers flexibility and ability to perform complex statistical modelling even with small data sets and ii) including covariate information, and iii) providing an easy to use code. The statistical methods are illustrated by re-analysing data of two published meta-analyses. Modelling sensitivity and specificity using the bivariate beta distribution provides marginal as well as study-specific parameter estimates as opposed to using bivariate normal distribution (e.g., in BRMA) which only yields study-specific parameter estimates. Moreover, copula based models offer greater flexibility in modelling different correlation structures in contrast to the normal distribution which allows for only one correlation structure.

In a systematic review of diagnostic test accuracy, the statistical analysis section aims at estimating the average (across studies) sensitivity and specificity of a test and the variability thereof, among other measures. There tends to be a negative correlation between sensitivity and specificity, which postulates the need for correlated data models. The analysis is statistically challenging because the user i) deals with two summary statistics, ii) has to account for correlation between sensitivity and specificity, iii) has to account for heterogeneity in sensitivity and specificity across the studies and iv) should be allowed to incorporate covariates.
Currently, the HSROC regression (Rutter and Gatsonis 2001) or the bivariate random-effects meta-analysis model (BRMA) (Reitsma et al. (2005), Arends et al. (2008), Chu and Cole (2006)) are recommended for pooling of diagnostic test accuracy data. These models fit a bivariate normal distribution which allows for only one correlation structure to the logit transformed sensitivity and specificity. The resulting distribution has no closed form and therefore the mean sensitivity and specificity is only estimated after numerical integration or other approximation methods, an extra step which is rarely taken.
Within the maximum likelihood estimation methods, the BRMA and HSROC models have difficulties in convergence and estimating the correlation parameter when the number of studies in the meta-analysis are small and/or when the between-study variances are relatively large (Takwoingi et al. 2015). When the correlation is close to the boundary of its parameter space, the between study variance estimates from the BRMA are upwardly biased as they are inflated to compensate for the range restriction on the correlation parameter (Riley et al. 2007a). According to Riley et al. (2007b) this occurs because the maximum likelihood estimator truncates the between-study covariance matrix on the boundary of its parameter space, and this often occurs when the within-study variation is relatively large or the number of studies is small.
The BRMA and HSROC assume that the transformed data is approximately normal with constant variance, however for sensitivity and specificity and proportions in generals, the mean and variance depend on the underlying probability. Therefore, any factor affecting the probability will change the mean and the variance. This implies that the in models where the predictors affect the mean but assume a constant variance will not be adequate.
Joint modelling of study specific sensitivity and specificity using existing or copula based bivariate beta distributions overcomes the above mentioned difficulties. Since both sensitivity and specificity take values in the interval space (0, 1), it is a more natural choice to use a beta distribution to describe their distribution across studies, without the need for any transformation. The beta distribution is conjugate to the binomial distribution and therefore it is easy to integrate out the random-effects analytically giving rise to the beta-binomial marginal distributions. Moreover no further integration is needed to obtain the meta-analytically pooled sensitivity and specificity. Previously, Cong et al. (2007) fitted separate beta-binomial models to the number of true positives and the number of false positives. While the model ignores correlation between sensitivity and specificity, Cong et al. (2007) reported that the model estimates are comparable to those from the SROC model (Moses et al. 1993), the predecessor of the HSROC model.
According to Riley (2009), ignoring the correlation would have negligible influence on the meta-analysis results when the within-study variability is large relative to the between-study variability. By utilising the correlation, we allow borrowing strength across sensitivities and specificities resulting in smaller standard errors. The use of copula based mixed models within the frequentist framework for meta-analysis of diagnostic test accuracy was recently introduced by Nikoloulopoulos (2015a) who evaluated the joint density numerically. This tutorial, presents and demonstrates hierarchical mixed models for meta-analysis of diagnostic accuracy studies. In the first level of the hierarchy, given sensitivity and specificity for each study, two binomial distributions are used to describe the variation in the number of true positives and true negatives among the diseased and healthy individuals, respectively. In the second level, we model the unobserved sensitivities and specificities using a bivariate distribution. While hierarchical models are used, the focus of meta-analysis is on the pooled average across studies and rarely on a given study estimate.
The methods are demonstrated using datasets from two previously published meta-analyses: a) on diagnostic accuracy of telomerase in urine as a tumour marker for the diagnosis of primary bladder cancer from Glas et al. (2003) previously used by Riley et al. (2007b) and Nikoloulopoulos (2015a) since it is a problematic dataset that has convergence issues caused by the correlation parameter being estimated to be -1 and has no covariate and b) on the comparison of the sensitivity and specificity of human papillomavirus testing (using the HC2 assay) versus repeat cytology to triage women with minor cytological cervical lesions to detect underlying cervical precancer from Arbyn et al. (2013). the second dataset is used to demonstrate meta-regression with one covariate which can be naturally extended to include several covariates.
The layout of this tutorial is as follows: in Section 2 introduces the concept of copula theory and different bivariate distributions for sensitivity and specificity. The software implementation and model selection in a Bayesian framework is discussed in Section 3. The two aforementioned datasets are introduced in Section 4. Application of software, code examples and the results of the models fitted to the data are presented in Section 5 and 6. A brief discussion is found in Section 7 and a conclusion in Section 8.

Definition of copula function
A bivariate copula function describes the dependence structure between two random variables. Two random variables X 1 and X 2 are joined by a copula function C if their joint cumulative distribution function can be written as According to the theorem of Sklar (1959), there exists for every bivariate (multivariate in extension) distribution a copula representation C which is unique for continuous random variables. If the joint cumulative distribution function and the two marginals are known, then the copula function can be written as A 2-dimensional copula is in fact simply a 2-dimensional cumulative function restricted to the unit square with standard uniform marginals. A comprehensive overview of copulas and their mathematical properties can be found in Nelsen (2006). To obtain the joint probability density, the joint cumulative distribution in Equation 1 should be differentiated to yield where f 1 and f 2 denote the marginal density functions and c the copula density function corresponding to the copula cumulative distribution function C. Therefore from Equation 3, a bivariate probability density can be expressed using the marginal and the copula density, given that the copula function is absolutely continuous and twice differentiable.
When the functional form of the marginal and the joint densities are known, the copula density can be derived as follows While our interest does not lie in finding the copula function, Equation 3 and 4 serve to show how one can move from the copula function to the bivariate density or vice-versa, given that the marginal densities are known. The decompositions allow for constructions of other and possible better models for the variables than would be possible if we limited ourselves to only existing standard bivariate distributions.
We finish this section by mentioning an important implication when Sklar's theorem is extended to a meta-regression setting with covariates. According to Patton (2006), it is important that the conditioning variable remains the same for both marginal distributions and the copula, as otherwise the joint distribution might not be properly defined. This implies that covariate information should be introduced in both the marginals and the association parameters of the model.

The hierarchical model
Since there are two sources of heterogeneity in the data, the within-and between-study variability, the parameters involved in a meta-analysis of diagnostic accuracy studies vary at two levels. For each study i, i = 1, ..., n, let Y i = (Y i1 , Y i2 ) denote the true positives and true negatives, N i = (N i1 , N i2 ) the diseased and healthy individuals respectively, and π i = (π i1 , π i2 ) represent the 'unobserved' sensitivity and specificity respectively.
Given study-specific sensitivity and specificity, two separate binomial distributions describe the distribution of true positives and true negatives among the diseased and the healthy individuals as follows where x i generically denotes one or more covariates, possibly affecting π ij . Equation 5 forms the higher level of the hierarchy and models the within-study variability. The second level of the hierarchy aims to model the between study variability of sensitivity and specificity while accounting for the inherent negative correlation thereof, with a bivariate distribution as follows g(π i1 ) g(π i2 ) ∼ f (g(π i1 ), g(π i2 )) = f (g(π i1 )) f (g(π i2 )) c(F 1 (g(π i1 )), F 2 (g(π i2 ))), where g(.) denotes a transformation that might be used to modify the (0, 1) range to the whole real line. While it is critical to ensure that the studies included in the meta-analysis satisfy the specified entry criterion, there are study specific characteristics like different test thresholds and other unobserved differences that give rise to the second source of variability, the betweenstudy variability. It is indeed the difference in the test thresholds between the studies that gives rise to the correlation between sensitivity and specificity. Including study level covariates allows us to model part of the between-study variability. The covariate information can and should (Patton 2006) be used to model the mean as well as the correlation between sensitivity and specificity.
In the next section we give more details on different bivariate distributions f (g(π i1 ), g(π i2 )) constructed using the logit or identity link function g(.), different marginal densities and/or different copula densities c. We discuss their implications and demonstrate their application in meta-analysis of diagnostic accuracy studies. An overview of suitable parametric families of copula for mixed models for diagnostic test accuracy studies was recently given by Nikoloulopoulos (2015a). Here, we consider five copula functions which can be plugged in Equation 3 to model negative correlation.

Bivariate Gaussian copula
Given the density and the distribution function of the univariate and bivariate standard normal distribution with correlation parameter ρ ∈ (−1, 1), the bivariate Gaussian copula function and density is expressed (Meyer 2013) as The logit transformation is often used in binary logistic regression to relate the probability of "success" (coded as 1, failure as 0) of the binary response variable with the linear predictor model that theoretically can take values over the whole real line. In diagnostic test accuracy studies, the 'unobserved' sensitivities and specificities can range from 0 to 1 whereas their logits = log( π ij 1 − π ij ) can take any real value allowing to use the normal distribution as follows where, µ j is a vector of the mean sensitivity and specificity for a study with zero random effects, and ε i is a vector of random effects associated with study i. Now u is the normal distribution function of logit(π i1 ) with parameters µ 1 and σ 1 , v is the normal distribution function of logit(π i2 ) with parameters µ 2 and σ 2 , Φ 2 is the distribution function of a bivariate standard normal distribution with correlation parameter ρ ∈ (−1, 1) and Φ −1 is the quantile of the standard normal distribution. In terms of ρ, Kendall's tau is expressed as ( 2 π )arcsin(ρ). With simple algebra the copula density in Equation 7 with normal marginal distributions simplifies to The product of the copula density in Equation 9, the normal marginal of logit(π i1 ) and logit(π i2 ) in Equation 8 form a bivariate normal distribution which characterize the model by Reitsma et al. (2005), Arends et al. (2008), Chu and Cole (2006), and Riley et al. (2007a), the so-called bivariate random-effects meta-analysis (BRMA) model, recommended as the appropriate method for meta-analysis of diagnostic accuracy studies. Study level covariate information explaining heterogeneity is introduced through the parameters of the marginal and the copula as follows X j is a n × p matrix containing the covariates values for the mean sensitivity(j = 1 ) and specificity(j = 2 ). For simplicity, assume that X 1 = X 2 = X. B j is a p × 1 vector of regression parameters, and p is the number of parameters. By inverting the logit functions in Equation 8, we obtain Therefore, the meta-analytic sensitivity and specificity obtained by averaging over the random study effect, is given by, for j = 1, 2 assuming that σ 2 1 > 0 and σ 2 2 > 0. The integration in Equation 12 has no analytical expression and therefore needs to be numerically approximated and the standard are not easily available. Using MCMC simulation in the Bayesian framework the meta-analytic estimates can be easily computed as well as a standard error estimate and a credible intervals E(π j ) with minimum effort by generating predictions of the fitted bivariate normal distribution.
In the frequentist framework, it is more convenient however to use numerical averaging by sampling a large number M of random-effectsε ij from the fitted distribution and to estimate the meta-analytic sensitivity and specificity by (Molenberghs and Verbeke 2005), for j = 1, 2 However, inference is not straightforward in the frequentist framework since the standard errors are not available. When ε ij = 0, then Inference for E(π j | ε ij = 0), as expressed in Equation 14, can be done in both Bayesian and frequentist framework. The equation represents the mean sensitivity and specificity for a "central" study with ε ij = 0. Researchers often seem to confuse E(π j | ε ij = 0) with E(π j ) but due to the non-linear logit transformations, they are clearly not the same parameter.
With the identity link function, no transformation on study-specific sensitivity and specificity is performed. A natural choice for u and v would be beta distribution functions with parameters (α 1 , β 1 ) and (α 2 , β 2 ) respectively. Since π ij ∼ beta(α j , β j ), the meta-analytic sensitivity and specificity are analytically solved as follows After reparameterising the beta distributions using the mean (µ j = α j α j + β j ) and certainty (ψ j = α j + β j ) or dispersion (ϕ j = 1 1 + α j + β j ) parameters different link functions introduce covariate information to the mean, certainty/dispersion and association (ρ) parameters. A typical model parameterisation is X, W and Z are a n × p matrices containing the covariates values for the mean, dispersion and correlation which we will assume has similar information and denoted by X for simplicity purpose, p is the number of parameters, B j , V j and D j are a p × 1 vectors of regression parameters relating covariates to the mean, variance and correlation respectively. g(.) is the log link to mapping XC j to the positive real number line and • is the Hadamard product.

Frank copula
This flexible copula in the so-called family of Archimedean copulas was introduced by Frank (1979). The functional form of the copula and the density which is plugged in Equation 3 is given by; Since θ ∈ R, both positive and negative correlation can be modelled, making this one of the more comprehensive copulas. When θ is 0, sensitivity and specificity are independent. For θ > 0, sensitivity and specificity exhibit positive quadrant dependence and negative quadrant dependence when θ < 0. The Spearman correlation ρ s and Kendall's tau τ k can be expressed in terms of θ as where D j (δ) is the Debye function defined as Covariate information is introduced in a similar manner as Equation 16. The identity link is used for the association parameter θ.

Farlie-Gumbel-Morgenstern copula (FGM)
This popular copula studied by Farlie (1960), Gumbel (1960) and Morgenstern (1956) is defined as Because θ ∈ (−1, 1), the Spearman correlation and Kendall's tau are expressed in terms of θ as θ/3 and 2θ/9 respectively, making this copula only appropriate for data with weak dependence since |ρ s | ≤ 1/3. In a similar manner as in Equation 16 the logit link, log/identity link and Fisher's z transformation can be used to introduce covariate information in modelling the mean, dispersion and association parameter.

Clayton copula
The Clayton copula function and density by Clayton (1978) is defined as Since θ ∈ (0, ∞), the Clayton copula typically models positive dependence; Kendall's tau equals θ/(θ + 2). However, the copula function can be rotated by 90 • or 270 • to model negative dependence. The distribution and density functions following such rotations are given by and The logit, log/identity and log/identity links can be used to introduce covariate information in modelling the mean (µ j ), certainty (ψ j )/dispersion (ϕ j ) and association (θ) parameters respectively in the same way as in Equation 16. Of course other copula functions that allow for negative association can be chosen. It is also an option to use known bivariate beta distributions. However, it is not always straightforward and analytically attractive to derive the corresponding copula function for all bivariate distributions. The use of existing bivariate beta distributions in meta-analysis of diagnostic accuracy studies has been limited because these densities model positive association ( e.g., Libby and Novick (1982), Olkin and Liu (2003)), or both positive and negative association but over a restricted range( e.g., Sarmanov (1966)).

Inference Framework and Software
Within the Bayesian framework, the analyst updates a prior opinion/information of a parameter based on the observed data whereas in the frequentist framework, the analyst investigates the behaviour of the parameter estimates in hypothetical repeated samples from a certain population. Due to its flexibility and use of MCMC simulations, complex modelling can often be implemented more easily within the Bayesian framework. By manipulating the prior distributions, Bayesian inference can circumvent identifiability problems whereas numerical approximation algorithms in frequentist inference without prior distributions can become stuck caused by identifiability problems. However, Bayesian methods typically require statistical expertise and patience because the MCMC simulations are computationally intensive. In contrast, most frequentist methods have been wrapped up in standard 'procedures' that require less statistical knowledge and programming skills. Moreover frequentist methods are optimized with maximum likelihood estimation (MLE) that have much shorter run-times as opposed to MCMC simulations. CopulaREMADA (Nikoloulopoulos 2015b) is such a MLE based R package.

The CopulaDTA package
The JAGS (Plummer 2003) is an alternative extensible general purpose sampling engine to Stan.
Extending JAGS requires knowledge of C++ to assemble a dynamic link library(DLL) module. From experience, configuring and building the module is a daunting and tedious task especially in the Windows operation system. The above short-comings coupled with the fact that Stan tends to converge with fewer iterations even from bad initial values than JAGS made us prefer the Stan MCMC sampling engine.
The CopulaDTA package is available via the Comprehensive R Archive Network (CRAN) at http://CRAN.R-project.org/package=CopulaDTA. With a working internet connection, the CopulaDTA package is installed and loaded in R with the following commands R> install.packages("CopulaDTA", dependencies = TRUE)

R> library(CopulaDTA)
The CopulaDTA package provide functions to fit bivariate beta-binomial distributions constructed as a product of two beta marginal distributions and copula densities discussed in Section 2. The package also provides forest plots for a model with categorical covariates or with intercept only. Given the chosen copula function, a beta-binomial distribution is assembled up by the cdtamodel function which returns a cdtamodel object. The main function fit takes the cdtamodel object and fits the model to the given dataset and returns a cdtafit object for which print, summary and plot methods are provided for.

Model diagnostics
To assess model convergence, mixing and stationarity of the chains, it is necessary to check the potential scale reduction factorR, effective sample size (ESS), MCMC error and trace plots of the parameters. When all the chains reach the target posterior distribution, the estimated posterior variance is expected to be close to the within chain variance such that the ratio of the two,R is close to 1 indicating that the chains are stable, properly mixed and likely to have reached the target distribution. A largeR indicates poor mixing and that more iterations are needed. Effective sample size indicates how much information one actually has about a certain parameter. When the samples are auto correlated, less information from the posterior distribution of our parameters is expected than would be if the samples were independent. ESS close to the total post-warm-up iterations is an indication of less autocorrelation and good mixing of the chains. Simulations with higher ESS have lower standard errors and more stable estimates. Since the posterior distribution is simulated there is a chance that the approximation is off by some amount; the Monte Carlo (MCMC) error. MCMC error close to 0 indicates that one is likely to have reached the target distribution.

Model comparison and selection
Watanabe-Alkaike Information Criterion (WAIC) (Watanabe 2010), a recent model comparison tool to measure the predictive accuracy of the fitted models in the Bayesian framework, will be used to compare the models. WAIC can be viewed as an improvement of Deviance Information Criterion(DIC) which, though popular, is known to be have some problems (Plummer 2008). WAIC is a fully Bayesian tool, closely approximates the Bayesian cross-validation, is invariant to reparameterisation and can be used for simple as well as hierarchical and mixture models.

Datasets
4.1. Telomerase data Glas et al. (2003) systematically reviewed the sensitivity and specificity of cytology and other markers including telomerase for primary diagnosis of bladder cancer. They fitted a bivariate normal distribution to the logit transformed sensitivity and specificity values across the studies allowing for heterogeneity between the studies. From the included 10 studies, they reported that telomerase had a sensitivity and specificity of 0. Test is an explanatory variable showing the type of triage test, StudyID is the study identifier, TP is the number of true positives, FP is the number of false positives, TN is the number of true negatives, FN is the number of false negatives.

The intercept only model
The CopulaDTA package has five different correlation structures that result to five different bivariate beta-binomial distributions to fit to the data. The correlation structure is specified by indicating copula~=~"gauss" or "fgm" or "c90" or "270" or "frank" in the fitcopula function. The Gaussian copula bivariate beta-binomial distribution is fitted to the telomerase data with the following code R> gauss.1 <-cdtamodel("gauss") R> fitgauss.1 <-fit( + gauss.1, + data = telomerase, + SID = "ID", + iter = 28000, + warmup = 1000, + thin = 30, + seed = 3) By default, chains = 3 and cores = 3 and need not be specified unless otherwise. From the code above, 28000 samples are drawn from each of the 3 chains, the first 1000 samples are discarded and thereafter every 30 th draw kept such that each chain has 900 post-warm-up draws making a total of 2700 post-warm-up draws. The seed value, seed = 3, specifies a random number generator to allow reproducibility of the results and cores = 3 allows for parallel-processing of the chains by using 3 cores, one core for each chain. They were no initial values specified and in that case, the program randomly generates random values satisfying the parameter constraints. The trace plots in the top-left panel of Figure 1 produced with the code below show satisfactory mixing of the chains and convergence.

R> traceplot(fitgauss.1)
Next, obtain the model summary estimates as follows  Figure 2: Plot of the study-specific sensitivity and specificity (magenta points) and their corresponding 95 % exact confidence intervals (thick grey lines), superimposed with the posterior estimates (blues stars) and their corresponding 95 % credible intervals (think black lines). Posterior estimates from the Gaussian copula based bivariate beta distribution for the telomerase data.
As observed in Figure 2, the posterior study-specific sensitivity and specificity are less extreme and variable than the 'observed' study-specific sensitivity and specificity. In other words, there is 'shrinkage' towards the overall mean sensitivity and specificity as studies borrow strength from each other in the following manner: the posterior study-specific estimates depends on the global estimate and thus also on all other the studies.
The mean sensitivity and specificity as estimated by the other four copula based bivariate beta distributions are in Table 1 and graphically shown in Figure 3. Though not presented here, the full code of the other four fitted copula based bivariate beta distributions is in the replication code. Figure 1 shows satisfactory chain mixing with little autocorrelation apart from the 'Clayton270' model. The Clayton copula is known to be unstable when the correlation parameter is close to the boundaries (-1 or 0) and this could be the reason why sampling from the posterior distribution was difficult.
For comparison purpose, the current recommended model; the BRMA, which uses normal marginals is also fitted to the data though it is not part of the CopulaDTA package. The model is first expressed in Stan modelling language in the code below and is stored within R environment as character string named BRMA1. In the data block the dimensions and names of variables in the dataset are specified, here Ns indicate the number of studies in the dataset. The parameters block introduces the unknown parameters to be estimated. These are etarho; a scalar representing the Fisher's transformed form of the association parameter ρ, mul;a 2 × 1 vector representing the mean of sensitivity and specificity on the logit scale for a central study where the random-effect is zero, sigma; a 2 × 1 vector representing the between study standard deviation of sensitivity and specificity on the logit scale, logitp; a Ns × 2 array of study-specific sensitivity in the first column and specificity in the second column on logit scale, and logitphat; a Ns × 2 array of predicted sensitivity in the first column and predicted specificity in the second column on logit scale.

R>
The parameters are further transformed in the transformed parameters block. Here, p is a 2 × Ns array of sensitivity in the first column and specificity in the second column after inverse logit transformation of logitp, and phat is a 2 × Ns array of predicted sensitivity in the first column and predicted specificity in the second column after inverse logit transformation of logitphat to be used in computing the meta-analytic sensitivity and specificity. mu is a 2 × 1 vector representing the mean of sensitivity and specificity for a certain study with a random effect equal to 0, MU is a 2 × 1 vector containing the meta-analytic sensitivity and specificity, Sigma; a 2 × 2 matrix representing the variance-covarince matrix of sensitivity and specificity on the logit scale, rho and ktau are scalars representing the Pearson's and Kendall's tau correlation respectively. The prior distributions for the all parameters and data likelihood are defined in the model block. Finally, in the generated quantities block, loglik is a (2Ns) × 1 vector of the log likelihood needed to compute the WAIC. Next, call the function stan from the rstan package to translate the code into C++, compile the code and draw samples from the posterior distribution as follows R> brma.1 <-stan(model_code = BRMA1, + data = datalist, + chains = 3, + iter = 5000, + warmup = 1000, + thin = 10, + seed = 3, + cores = 3) The parameter estimates are extracted and the chain convergence and autocorrelation examined further with the following code R> print(brma.1, pars = c('MU', 'mu', 'rho'), + digits = 4, + prob=c(0.025, 0.975)) The above lines of code print the following output Inference for Stan model: d6a1713b5981968874c97152db2bb815. 3 chains, each with iter=5000; warmup=1000; thin=10; post-warmup draws per chain=400, total post-warmup draws=1200.   Table 1 shows that the correlation as estimated by the BRMA model and the Gaussian copula bivariate beta are more extreme but comparable to the estimates from the Frank, 90 • -and 270 • -Clayton copula. On the other extreme is the estimate from the model FGM copula bivariate beta and this is due to the constraints on the association parameter in the FGM copula where values lie within |2/9|.

Model comparison
In Figure 3, the marginal mean sensitivity and specificity from the five bivariate beta distributions are comparable with subtle differences in the 95 percent credible intervals despite differences in the correlation structure. Glas et al. (2003) and Riley et al. (2007a) estimated the Pearson's correlation parameter in the BRMA model ρ as -1 within the frequentist framework. Using maximum likelihood estimation, Riley et al. (2007b) showed that the between-study correlation from the BRMA is often estimated as +/-1. Without estimation difficulties, Table 1 shows an estimated Pearson's correlation of -0.9338 [-0.9993, -0.57118]. This is because Bayesian methods are not influenced by sample size and therefore able to handle cases of small sample sizes with less issues.
Essentially, all the six models are equivalent in the first level of hierarchy and differ in spec-ifying the prior distributions for the 'study-specific' sensitivity and specificity. As thus, the models should have the same number of parameters in which case it makes sense then to compare the log predictive densities. Upon inspection, the log predictive densities from the six models are practically equivalent (min=37.40, max=38.62) but the effective number of parameters differed a bit (max=5.9, max=9.1). Apparently, the last column of Table 1 indicates that the BRMA fits the data best based on the WAIC.

Meta-regression
The ascus dataset has Test as a covariate. The covariate is used as it is of interest to study its effect on the joint distribution of sensitivity and specificity (including the correlation). The following code fits the FGM copula based bivariate beta-binomial distribution to the data R> fgm.2 <-cdtamodel(copula = "fgm", + modelargs = list(formula.se = StudyID~Test + 0)) R> fitfgm.2 <-fit(fgm.2, + data = ascus, + SID = "StudyID", + iter = 19000, + warmup = 1000, + thin = 20, + seed = 3)   Figure 4 shows the trace plots for all the six models fitted to the ascus data where all parameters, including the correlation parameter(except the BRMA) are modeled as a function of the covariate. There is proper chains mixing and convergence except for the case of the Clayton copula based bivariate beta. From the posterior relative sensitivity and specificity plotted in Figure 5, all the models that converged generally agree that repeat cytology was less sensitive than HC2 without significant loss in specificity.  The n_eff in Table 2 indicate substantial autocorrelation in sampling the correlation parameters except in the 'Gaussian', 'FGM' and 'Frank' models. From the copula based bivariate beta distributions, it is apparent that the correlation between sensitivity and specificity in HC2 and repeat cytology is different.

Model
The 'Clayton' models have the lowest WAIC even though sampling from the posterior distribution was difficult as seen in their trace plots in Figure 4 and the n_eff and Rhat in Table 2. The difficulty in sampling from the posterior could be signalling over-parameterisation of the correlation structure. It would thus be interesting to re-fit the models using only one correlation parameter and compare the models. WAIC is known to fail in certain settings and this examples shows that it is crucial to check the adequacy of the fit and plausibility of the model and not blindly rely on an information criterion to select the best fit to the data.

Discussion
Copula-based models offer great flexibility and ease but their use is not without caution. While the copulas used in this paper are attractive as they are mathematically tractable, Mikosch (2006) and Genest and Remillard (2006) noted that it might be difficult to estimate copulas from data. Furthermore, the concepts behind copula models is slightly more complex and therefore require statistical expertise to understand and program them as they are not yet available as standard procedure/programs in statistical software.
In this paper, several advanced statistical models for meta-analysis of diagnostic accuracy  Figure 5: Pooled relative sensitivity (on top) and relative specificity (bottom) of repeat cytology (posterior mean and 95% credible intervals) compared to HPV testing with HC2 to detect cervical precancer in women with an atypical Pap smear estimated. studies were briefly discussed. The use of the R package CopulaDTA within the flexible Stan interface was demonstrated and shows how complex models can be implemented in a convenient way.
In most practical situations, the marginal mean structure is of primary interest and the correlation structure is treated a nuisance making the choice of copula less critical. Nonetheless, an appropriate correlation structure is critical in the interpretation of the random variation in the data as well as obtaining valid model-based inference for the mean structure.
When the model for the mean is correct but the true distribution is misspecified, the estimates of the model parameters will be consistent but the standard errors will be incorrect Agresti (2002). Nonetheless, the bivariate beta distribution has the advantage to allow direct joint modelling of sensitivity and specificity, without the need of any transformation, and consequently providing estimates with the appropriate meta-analytic interpretation but with the disadvantage of being more computationally intensive for some of the copula functions. Leeflang et al. (2013) showed that the sensitivity and specificity often vary with disease prevalence. The models presented above can easily be extended and implemented to jointly model prevalence, sensitivity and specificity using tri-variate copulas.
There were some differences between the models in estimating the meta-analytic sensitivity and specificity and the correlation. Therefore, further research is necessary to investigate the effect of certain parameters, such as the number of studies, sample sizes and misspecification of the joint distribution on the meta-analytic estimates.

Conclusion
The proposed Bayesian joint model using copulas to construct bivariate beta distributions, provides estimates with both the appropriate marginal as well as conditional interpretation, as opposed to the typical BRMA model which estimates sensitivity and specificity for specific studies with a particular value for the random-effects. Furthermore, the models do not have estimation difficulties with small sample sizes or large between-study variance because: i) the between-study variances are not constant but depends on the underlying means and ii Bayesian methods are less influenced by small samples sizes.
The fitted models generally agree that the mean specificity was slightly lower than what Glas et al. (2003) reported and based on this we conclude that telomerase was not sensitive and specific enough to be recommended for daily use.
In the ASCUS triage data, conclusion based on the fitted models is in line with what the authors conclude: that HC2 was considerably more sensitive but sligthly and non-significantly less specific than repeat cytology to triage women with an equivocal Pap smear to diagnose cervical precancer.
While the BRMA had the lowest WAIC for both datasets, we still recommend modelling of sensitivity and specificity using bivariate beta distributions as they easily and directly provide meta-analytic estimates.