mtc.model: Generate network meta-analysis models

View source: R/mtc.model.R

mtc.modelR Documentation

Generate network meta-analysis models


The mtc.model function generates network meta-analysis models from an object.


mtc.model(network, type = "consistency", factor = 2.5, n.chain = 4,
  likelihood=NULL, link=NULL, linearModel="random",
  om.scale=NULL, hy.prior=mtc.hy.prior("", "dunif", 0, "om.scale"), * om.scale, dic=TRUE, powerAdjust=NA, ...)



An object of S3 class


A string literal indicating the type of model (allowed values are "consistency", "regression", "nodesplit", "ume", or "use").


Variance scaling factor for the starting values


Number of chains in the model


The likelihood to be used. If unspecified, a suitable likelihood will be inferred for the given data.


The link function to be used. If unspecified, a suitable link function will be inferred for the given data.


The type of linear model to be generated. Can be "random" for a random effects model, or "fixed" for a fixed effect model.


Outcome measure scale. Represents a "very large" difference on the analysis' outcome scale. This is used to set vague priors. For the log odds-ratio, values between 2 and 5 are considered reasonable. For continuous outcomes, this depends heavily on the specific outcome. If left unspecified, it is determined from the data.


Heterogeneity prior. See mtc.hy.prior.

Standard deviation for the relative effects prior (normal distribution).


When set to TRUE, deviance and fitted values will be monitored to allow computation of the Deviance Information Criterion (DIC) at residual.


Optional: the name of a column in the studies data frame of the This column must contain values between 0 and 1. The likelihood for each study will be adjusted by inflating the variance, where 0 means the study is excluded and 1 means it receives full weight. See details for more.


Additional arguments to be passed to the type-specific model generation function.


The mtc.model function generates an object of S3 class mtc.model, which can be visualized by the generic plot function or summarized by the generic summary function.

These likelihood/links are supported:

  • normal/identity: for continuous (mean difference) data.

    Required columns: [mean, std.err] or [mean,, sampleSize].

    Result: relative mean difference.

  • binom/logit: for dichotomous data.

    Required columns [responders, sampleSize].

    Result: (log) odds ratio.

  • binom/log: for dichotomous data.

    Required columns [responders, sampleSize].

    Result: (log) risk ratio.

  • binom/cloglog: for rate (survival) data - equal follow-up in each arm.

    Required columns [responders, sampleSize].

    Result: (log) hazard ratio.

  • poisson/log: for rate (survival) data.

    Required columns [responders, exposure].

    Result: (log) hazard ratio.

Most likelihood/links follow [Dias et al. 2013a], and the binom/log model follows [Warn et al. 2002].

The following model types are supported:

  • consistency: ordinary consistency model. No additional parameters. [Dias et al. 2013a, van Valkenhoef et al. 2012]

  • nodesplit: node-splitting model. Removes both arms used to estimate the direct evidence from the network of indirect evidence, rather than just one of those arms. This means that three-arm trials do not contribute any evidence in the network of indirect evidence. When relative effect data are present, these are transformed appropriately (using an assumption of normality) to enable this direct/indirect evidence split. Additional parameters: t1 and t2, which indicate the comparison to be split. [Dias et al. 2010, van Valkenhoef et al. 2015]

  • regression: meta-regression model. Additional parameters: regressor, which indicates how to structure the treatment-interaction model for the regression. See below for details.

  • use: unrelated study effects. Models the effects within each study as if the studies are independent. No additional parameters. [van Valkenhoef et al. (draft)]

  • ume: unrelated mean effects. Models the effects within each comparison as if they are independent. Does not properly handle multi-arm trials, and warns when they are present in the network. No additional parameters. [Dias et al. 2013b, van Valkenhoef et al. (draft)]

Regressor specification: a list with elements: variable, coefficient, and either control or classes. The variable is the name of the covariate to include in the regression analysis, and must be a column of the studies data frame in the network. The regressor variable is automatically centered and standardized using the method recommended by Gelman et al. (2008). The coefficient indicates the type of treatment-interaction model: "shared", "unrelated", or "exchangeable". control, if specified, must be the ID of a treatment in the network. All other treatments have a coefficient relative to the control, which can be the same for all treatments ("shared"), different for all treatments ("unrelated") or exchangeable between treatments ("exchangeable"). classes is a named list of treatment classes, the first of which will act as the control class. Each class is a vector of treatment IDs from the network. Only "shared" coefficients can currently be used, meaning a single coefficient per class (except the control class). See also atrialFibrillation, certolizumab, and hfPrevention for examples of meta-regression analyses.

Studies can be downweighted by using the powerAdjust argument, which applies a variance inflation (also known as "power prior") to the likelihood. This allows a weight \alpha_i \in [0, 1] to be specified for each study i. The log-likelihood will be multiplied by a factor \alpha_i, or equivalently for normal distributions the variance will be multiplied by 1/\alpha_i. Setting \alpha_i = 0 will completely exclude that study, whereas setting \alpha_i = 1 will weight it fully. Essentially, down-weighted models modify the data and hence model fit statistics such as DIC can not be compared between models with different weightings.


An object of class mtc.model. The following elements are descriptive:


The type of model


Network the model was generated from


Spanning tree formed by the basic parameters


The scaling factor used to over-disperse starting values


The likelihood used


The link function used


The scale for the variance parameters


Regressor specification (regression models only): includes additional elements "center" and "scale" describing how the regressor input was standardized

These elements determine the model run by JAGS:


The number of chains


Model code in JAGS syntax. Use cat() for proper formatting.


Data in JAGS compatible format


Initial values in JAGS compatible format


The nodes of the JAGS model to monitor


Whether to compute the DIC

These latter fields can be modified to alter the statistical model, but such changes may break the model or assumptions made elsewhere in the package.


Calling the generic plot method on an S3 mtc.model object will show a graph with the treatments as vertices and the comparisons as edges. The lines with solid arrows represent basic parameters, and the other lines represent comparisons that are not associated with any parameter but do have direct evidence from trials.

The example code will generate the following graph:

Graph showing structure of a consistency model generated from parkison example data The default layout algorithm is, other layout algorithms can be used by passing them as an optional argument called layout to plot. The igraph::layout.fruchterman.reingold algorithm also seems to produce nice results and may be better for large graphs.

Reproducible results

It is possible to get reproducible results, but as JAGS uses its own pseudo-random number generator, this is somewhat more involved.

mtc.model generates random numbers using the R functions (for example to generate initial values). Therefore, set.seed must be called before calling mtc.model.

Then, before calling, the random number generator type and seed must be set for each of the chains. This can be done as documented in jags.model, by setting the and .RNG.seed for each chain in model$inits. See below for an example.


Gert van Valkenhoef, Joël Kuiper

See Also,


# Random effects consistency model for Parkinson network
model <- mtc.model(parkinson)

# Fixed effect meta-regression for heart failure prevention
regressor <- list(coefficient='shared',

model <- mtc.model(hfPrevention,

# Reproducible results
# Set the R RNG seed
model <- mtc.model(parkinson, likelihood='normal', link='identity')
# By default, the model will have 4 chains - generate a seed for each
seeds <-, n = .Machine$integer.max)
# Apply JAGS RNG settings to each chain
model$inits <- mapply(c, model$inits, list(
  list("base::Wichmann-Hill", .RNG.seed=seeds[1]),
  list("base::Marsaglia-Multicarry", .RNG.seed=seeds[2]),
  list("base::Super-Duper", .RNG.seed=seeds[3]),
  list("base::Mersenne-Twister", .RNG.seed=seeds[4])), SIMPLIFY=FALSE)

gemtc documentation built on July 9, 2023, 5:33 p.m.