Write MBNMA time-course models JAGS code for synthesis of studies investigating reference treatment
write.ref.synth.Rd
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.
Usage
write.ref.synth(
fun = tpoly(degree = 1),
link = "identity",
positive.scale = TRUE,
intercept = TRUE,
rho = 0,
covar = "varadj",
mu.synth = "random",
priors = NULL
)
Arguments
- fun
An object of class
"timefun"
generated (see Details) using any oftloglin()
,tpoly()
,titp()
,temax()
,tfpoly()
,tspline()
ortuser()
- link
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).- positive.scale
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).
- intercept
A boolean object that indicates whether an intercept (written as
alpha
in the model) is to be included. If left asNULL
(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 innetwork$cfb
).- rho
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 fixesrho
in the model to this value (e.g. for use in a deterministic sensitivity analysis). If set torho=0
(the default) then this implies modelling no correlation between time points.- covar
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
- mu.synth
A string that takes the value
fixed
orrandom
, indicating the type of synthesis model to use- priors
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) ).
Value
A character object of JAGS MBNMA model code that includes beta parameter components of the model
Examples
# 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 }