Skip to contents

Writes JAGS code for a Bayesian time-course model for model-based network meta-analysis (MBNMA) that pools reference treatment effects from different studies. This model only pools single study arms and therefore does not pool relative effects.


  fun = tpoly(degree = 1),
  link = "identity",
  positive.scale = TRUE,
  intercept = TRUE,
  rho = 0,
  covar = "varadj",
  mu.synth = "random",
  priors = NULL



An object of class "timefun" generated (see Details) using any of tloglin(), tpoly(), titp(), temax(), tfpoly(), tspline() or tuser()


Can take either "identity" (the default), "log" (for modelling Ratios of Means (Friedrich et al. 2011) ) or "smd" (for modelling Standardised Mean Differences - although this also corresponds to an identity link function).


A boolean object that indicates whether all continuous mean responses (y) are positive and therefore whether the baseline response should be given a prior that constrains it to be positive (e.g. for scales that cannot be <0).


A boolean object that indicates whether an intercept (written as alpha in the model) is to be included. If left as NULL (the default), an intercept will be included only for studies reporting absolute means, and will be excluded for studies reporting change from baseline (as indicated in network$cfb).


The correlation coefficient when modelling within-study correlation between time points. The default is a string representing a prior distribution in JAGS, indicating that it be estimated from the data (e.g. rho="dunif(0,1)"). rho also be assigned a numeric value (e.g. rho=0.7), which fixes rho in the model to this value (e.g. for use in a deterministic sensitivity analysis). If set to rho=0 (the default) then this implies modelling no correlation between time points.


A character specifying the covariance structure to use for modelling within-study correlation between time-points. This can be done by specifying one of the following:

  • "varadj" - a univariate likelihood with a variance adjustment to assume a constant correlation between subsequent time points (Jansen et al. 2015) . This is the default.

  • "CS" - a multivariate normal likelihood with a compound symmetry structure

  • "AR1" - a multivariate normal likelihood with an autoregressive AR1 structure


A string that takes the value fixed or random, indicating the type of synthesis model to use


A named list of parameter values (without indices) and replacement prior distribution values given as strings using distributions as specified in JAGS syntax (see Plummer (2017) ).


A character object of JAGS MBNMA model code that includes beta parameter components of the model


# Write a log-linear time-course MBNMA synthesis model with:
# Common effects for synthesis of mu
# Modelled as ratio of means
model <- write.ref.synth(fun=tloglin(pool.rate="rel", method.rate="common"),
  mu.synth="common", link="log")

cat(model) # Concatenates model representations making code more easily readable
#> model{ 			# Begin Model Code dummy2 <- treat dummy1 <- NT rho2 <- rho*rho for(i in 1:NS){ # Run through all NS trials alpha[i] ~ dnorm(0,0.0001) for (k in 1:narm[i]){ # Run through all arms within a study for (m in 1:fups[i]) {	# Run through all observations within a study log(theta[i,k,m]) <- exp(alpha[i]) + mu.1 * log(time[i,m] + 1) y[i,k,m] ~ dnorm(theta[i,k,m], prec[i,k,m]) prec[i,k,m] <- pow(se[i,k,m], -2) resdev[i,k,m] <- pow((y[i,k,m] - theta[i,k,m]),2) * prec[i,k,m] # residual deviance for normal likelihood dev[i,k,m] <- -2* (log(pow((prec[i,k,m]/(2*3.14159)),0.5) * exp(-0.5*(pow((y[i,k,m]-theta[i,k,m]),2)*prec[i,k,m])))) # deviance for normal likelihood }  resarmdev[i,k] <- sum(resdev[i,k,1:fups[i]]) armdev[i,k] <- sum(dev[i,k,1:fups[i]]) }  resstudydev[i] <- sum(resarmdev[i, 1:narm[i]]) studydev[i] <- sum(armdev[i, 1:narm[i]])  }     totresdev <- sum(resstudydev[]) totdev <- sum(studydev[])  mu.1 ~ dnorm(0,0.0001) rho <- 0 # Model ends }