meta4diag {meta4diag} | R Documentation |
Function to analyse diagnostic meta-analysis with Bayesian methods using INLA.
Description
Estimate a Bayesian bivariate hierarchical model fitted within INLA.
Usage
meta4diag(data=NULL, model.type = 1,
var.prior = "Invgamma", var2.prior = "Invgamma", cor.prior = "Normal",
var.par = c(0.25, 0.025), var2.par, cor.par = c(0,5),
wishart.par = c(4, 1, 1, 0),
init = c(0.01,0.01,0), link="logit", quantiles=c(0.025,0.5,0.975),
modality = NULL, covariates = NULL,
verbose = FALSE, nsample=FALSE,num.threads = 1, seed=0L)
Arguments
data |
A data frame contains at least 4 columns specifying the number of True Positive( |
model.type |
A numerical value specifying the model type, options are 1(default), 2, 3 and 4. |
var.prior |
A string specifying the prior density for the first variance component, options are "PC" for penalised complexity prior, "Invgamma" for inverse gamma prior, "Tnormal" for truncated normal prior, "Unif" for uniform prior which allow the standard deviation uniformaly distributed on [0,1000], "Hcauchy" for half-cauchy prior and "table" for user specific prior.
|
var2.prior |
See |
cor.prior |
A string specifying the prior density for the correlation, options are "PC" for penalised complexity prior, "Invgamma" for inverse gamma prior, "beta" for beta prior and "table" for user specific prior.
|
var.par |
A numerical vector specifying the parameter of the prior density for the first variance component.
See also argument |
var2.par |
A numerical vector specifying the parameter of the prior density for the second variance component. If not given, function will copy the setting for the first variance component. The definition of the priors is the same as for |
cor.par |
A numerical vector specifying the parameter of the prior density for the correlation. See also
See also argument |
wishart.par |
A numerical vector specifying the parameter of the prior density for the covariance matrix. |
init |
A numerical vector specifying the initial value of the first variance, the second variance and correlation. |
link |
A string specifying the link function used in the model. Options are "logit", "probit" and "cloglog". |
quantiles |
A vector of quantiles, p(0), p(1),... to compute for each posterior marginal. The function returns, for each posterior marginal, the values x(0), x(1),... such that
The default value are c(0.025, 0.5, 0.975). Not matter what other values are going to be given, the estimates for these 3 quantiles are always returned. |
verbose |
Boolean (default:FALSE) indicating whether the program should run in a verbose model. |
modality |
A string specifying the modality variable, which is a categorical variable, such as test threshold. Default value is NULL. See also |
covariates |
A vector, which could be either the name of columns or the number of columns, specifying the continuous covariates variables, such as disease prevalence or average individual patients status of each study. Default value is NULL. See also |
nsample |
A numerical value specifying the number of posterior samples, default is 5000. The posterior samples are used to compute the marginals and estimates values of non-linear functions, such as log radios and diagnostic odds radios. If |
num.threads |
Maximum number of threads the inla-program will use. xFor Windows this defaults to 1, otherwise its defaults to NULL (for which the system takes over control). |
seed |
A numerical value specifying the random seed to control the RNG for generating posterior samples if nsample > 0. If you want reproducible results, you ALSO need to control the seed for the RNG in R by controlling the variable .Random.seed or using the function set.seed. |
Details
The bivariate model has two levels, in the first level, the observed number of individuals in a specific group in a 2 by 2 table is binomial distributed, for example, the numbers of individuals in the group of true positive and true negative of a study i
are modelled jointly,
TP_{i} | Se_{i} \sim Binomial(TP_{i}+ FN_{i},Se_{i})
TN_{i} | Sp_{i} \sim Binomial(TN_{i}+ FP_{i},Sp_{i})
In the second level, two transformed accuracies with some link function (see argument link
) are bivariate Gaussian distributed, continuous with the previous example,
g(Se_{i}) = \mu + V_{i}\alpha + \phi_{i}
g(Sp_{i}) = \nu + U_{i}\beta + \psi_{i}
where \phi_{i}
and \psi_{i}
are bivariate Gaussian distributed with mean 0 and covariance matrix \Sigma
. The se
and sp
in the example could be changed to se
and (1-sp)
, (1-se)
and sp
or (1-se)
and (1-sp)
, see argument model.type
.
The function meta4diag()
depends on four internal functions which are also given in the meta4diag package in order to flexibly implement a list of dataset with the same prior setting. The four internal functions are makeData()
, makePriors()
, runModel()
and makeObject()
. Details can be seen the corresponding documentations and examples.
After running the function meta4diag()
, a meta4diag
object will be returned which contains various estimated results for later analysis, such as the posterior marginals, estimated value, standard deviations and the coresponding quaniles of the accuracies. See Values
.
Value
meta4diag
returns a meta4diag
object with components:
data |
The provided input data. |
outdata |
The internal data that could be used in INLA from function |
priors.density |
Prior distributions for the variance components and correlation from function |
names.fitted |
Names of the jointly modelled accuracies in the model. For example, se and sp or (1-se) and sp. |
cpu.used |
The cpu time used for running the model. |
call |
The matched call. |
summary.fixed |
Matrix containing the mean and standard deviation (plus, possibly quantiles) of the fixed effects of the model. |
marginals.fixed |
A list containing the posterior marginal densities of the fixed effects of the model. |
summary.expected.(...).accuracy |
Matrix containing the mean and standard deviation (plus, possibly quantiles) of the mean of accuracies transformed with the link function, i.e. E(g(Se)), E(g(Sp)), E(g(1-Se)) and E(g(1-Sp)). Dynamic name for this output. (...) indicates the name of link function used in |
marginals.expected.(...).accuracy |
A list containing the posterior marginal densities of the mean of accuracies transformed with the link function, i.e. E(g(Se)), E(g(Sp)), E(g(1-Se)) and E(g(1-Sp)). Dynamic name for this output. (...) indicates the name of link function used in |
summary.expected.accuracy |
Matrix containing the mean and standard deviation (plus, possibly quantiles) of the mean of the accuracies, i.e. E(Se), E(Sp), E(1-Se) and E(1-Sp). |
marginals.expected.accuracy |
A list containing the posterior marginal densities of of the mean of the accuracies, i.e. E(Se), E(Sp), E(1-Se) and E(1-Sp). |
summary.hyperpar |
A matrix containing the mean and sd (plus, possibly quantiles) of the hyperparameters of the model. |
marginals.hyperpar |
A list containing the posterior marginal densities of the hyperparameters of the model. |
correlation.expected.(...).accuracy |
A correlation matrix between the mean of the accuracies transformed with the link function. Dynamic name for this output. (...) indicates the name of link function used in |
covariance.expected.(...).accuracy |
A covariance matrix between the mean of the accuracies transformed with the link function. Dynamic name for this output. (...) indicates the name of link function used in |
summary.predictor.(...) |
A matrix containing the mean and sd (plus, possibly quantiles) of the linear predictors one transformed accuracy in the model. The accuracy type depends on the model type. See argument |
marginals.predictor.(...) |
A list containing the posterior marginals of the linear predictors of one transformed accuracy in the model. The accuracy type depends on the model type. See argument |
misc |
Some other settings that maybe useful retruned by meta4diag. |
dic |
The deviance information criteria and effective number of parameters. |
cpo |
A list of three elements: |
waic |
A list of two elements: |
mlik |
The log marginal likelihood of the model |
inla.result |
A |
samples.fixed |
A matrix of the fixed effects samples if |
samples.hyperpar |
A matrix of the hyperparameter samples if |
samples.overall.Se |
A matrix containing the mean and sd (plus, possibly quantiles) of overall sensitivity samples if |
samples.overall.Sp |
A matrix containing the mean and sd (plus, possibly quantiles) of overall specificity samples if |
summary.overall.statistics |
A matrix containing the mean and sd (plus, possibly quantiles) of mean positive and negative likelihood ratios and mean diagnostic odds ratios if |
samples.study.specific.Se |
A matrix containing the mean and sd (plus, possibly quantiles) of study specific sensitivity samples if |
samples.study.specific.Sp |
A matrix containing the mean and sd (plus, possibly quantiles) of study specific specificity samples if |
summary.study.specific.LRpos |
A matrix containing the mean and sd (plus, possibly quantiles) of positive likelihood ratios for each study if |
summary.study.specific.LRneg |
A matrix containing the mean and sd (plus, possibly quantiles) of negative likelihood ratios for each study if |
summary.study.specific.DOR |
A matrix containing the mean and sd (plus, possibly quantiles) of diagnostic odds ratios for each study if |
summary.study.specific.RD |
A matrix containing the mean and sd (plus, possibly quantiles) of risk difference for each study if |
summary.study.specific.LDOR |
A matrix containing the mean and sd (plus, possibly quantiles) of log diagnostic odds ratios for each study if |
summary.study.specific.LLRpos |
A matrix containing the mean and sd (plus, possibly quantiles) of log positive likelihood ratios for each study if |
summary.study.specific.LLRneg |
A matrix containing the mean and sd (plus, possibly quantiles) of log negative likelihood ratios for each study if |
Author(s)
Jingyi Guo and Andrea Riebler
References
Rue H., Martino S, and Chopin N. (2009). Approximate Bayesian Inference for Latent Gaussian Models Using Integrated Nested Laplace Approximations. Journal of the Royal Statistical Society B 71: 319–392. (www.r-inla.org)
Simpson DP, Martins TG, Riebler A, Fuglstad GA, Rue H, Sorbye SH (2014) Penalised Model Component Complexity: A principled, Practical Approach to Constructing Priors. Arxiv e-prints. 1403.4630
Guo, J., Riebler, A. and Rue H. (2017) Bayesian bivariate meta-analysis of diagnostic test studies with interpretable priors. Statistics in Medicine 36(19): 3039–3058.
See Also
makeData, makePrior, runModel, forest, SROC, crosshair.
Examples
## Not run:
if(requireNamespace("INLA", quietly = TRUE)){
require("INLA", quietly = TRUE)
data(Catheter)
meta4diag(data = Catheter, model.type = 1, var.prior = "invgamma", cor.prior = "normal",
var.par = c(0.25, 0.025), cor.par = c(0, 5), init = c(0.01, 0.01, 0),
link = "logit", quantiles = c(0.025, 0.5, 0.975), verbose = FALSE, covariates = NULL,
nsample = FALSE)
}
## End(Not run)