Learn R Programming

meta4diag (version 2.1.1)

makeObject: A function used to make a meta4diag object.

Description

Takes an internal data list, an internal prior setting list and an INLA object produced by makeData(), makePriors() and runModel(), respectively and makes a meta4diag object which contains various informations for later use. This function is used in the main function meta4diag() and can also be used as a separate function.

Usage

makeObject(model, nsample=FALSE, seed=0L)

Arguments

model

An INLA object. Get from function runModel().

nsample

A numerical value specifying the number of posterior samples, default is FALSE. The posterior samples are used to compute the marginals and estimates values of non-linear functions, such as log ratios and diagnostic odds ratios. If nsample is given, summary.summarized.statistics, summary.fitted.LRpos, summary.fitted.LRneg, summary.fitted.DOR and samples of \(E(se)\), \(E(sp)\), \(E(1-se)\) and \(E(1-sp)\) will be returned.

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.

Value

makeObject returns a meta4diag object with components:

data

The provided input data.

outdata

The internal data that could be used in INLA from function makeData().

priors.density

Prior distributions for the variance components and correlation from function makePriors().

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 runModel(), i.e. if link function is "logit", the full name of this output is "summary.expected.logit.accuracy".

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 runModel(), i.e. if link function is "logit", the full name of this output is "marginals.expected.logit.accuracy".

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 runModel().

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 runModel().

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 model.type. For example, the possible accuracy type could be \(g(se)\), \(g(sp)\), \((se)\) or \((sp)\), where \(g()\) is the link function.

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 model.type. For example, the possible accuracy type could be \(g(se)\), \(g(sp)\), \((se)\) or \((sp)\), where \(g()\) is the link function.

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: cpo$cpo are the values of the conditional predictive ordinate (CPO), cpo$pit are the values of the probability integral transform (PIT) and cpo$failure indicates whether some assumptions are violated. In short, if cpo$failure[i] > 0 then some assumption is violated, the higher the value (maximum 1) the more seriously.

waic

A list of two elements: waic$waic is the Watanabe-Akaike information criteria, and waic$p.eff is the estimated effective number of parameters.

mlik

The log marginal likelihood of the model

inla.result

A INLA object that from function runModel() which implements INLA.

samples.fixed

A matrix of the fixed effects samples if nsample is given.

samples.hyperpar

A matrix of the hyperparameter samples if nsample is given.

samples.overall.Se

A matrix containing the mean and sd (plus, possibly quantiles) of overall sensitivity samples if nsample is given.

samples.overall.Sp

A matrix containing the mean and sd (plus, possibly quantiles) of overall specificity samples if nsample is given.

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 nsample is given.

samples.study.specific.Se

A matrix containing the mean and sd (plus, possibly quantiles) of study specific sensitivity samples if nsample is given.

samples.study.specific.Sp

A matrix containing the mean and sd (plus, possibly quantiles) of study specific specificity samples if nsample is given.

summary.study.specific.LRpos

A matrix containing the mean and sd (plus, possibly quantiles) of positive likelihood ratios for each study if nsample is given.

summary.study.specific.LRneg

A matrix containing the mean and sd (plus, possibly quantiles) of negative likelihood ratios for each study if nsample is given.

summary.study.specific.DOR

A matrix containing the mean and sd (plus, possibly quantiles) of diagnostic odds ratios for each study if nsample is given.

summary.study.specific.RD

A matrix containing the mean and sd (plus, possibly quantiles) of risk difference for each study if nsample is given.

summary.study.specific.LDOR

A matrix containing the mean and sd (plus, possibly quantiles) of log diagnostic odds ratios for each study if nsample is given.

summary.study.specific.LLRpos

A matrix containing the mean and sd (plus, possibly quantiles) of log positive likelihood ratios for each study if nsample is given.

summary.study.specific.LLRneg

A matrix containing the mean and sd (plus, possibly quantiles) of log negative likelihood ratios for each study if nsample is given.

See Also

makeData, makePriors, runModel, meta4diag

Examples

Run this code
# NOT RUN {
if(requireNamespace("INLA", quietly = TRUE)){
  require("INLA", quietly = TRUE)
  data(Catheter)
  outdata = makeData(Catheter)
  outpriors = makePriors()
  model = runModel(outdata=outdata, outpriors=outpriors, link="logit")
  res = makeObject(outdata, outpriors, model, nsample=2000)
}
# }

Run the code above in your browser using DataLab