View source: R/prepare.functions.R
getjagsdata | R Documentation |
Converts MBNMA data frame to a list for use in JAGS model
getjagsdata(
data.ab,
fun = NULL,
class = FALSE,
rho = NULL,
covstruct = "CS",
link = "identity",
sdscale = FALSE,
cfb = NULL
)
data.ab |
A data frame of arm-level data in "long" format containing the columns:
|
fun |
An object of class |
class |
A boolean object indicating whether or not |
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. |
covstruct |
A character to indicate the covariance structure required for modelling correlation between
time points (if any), since
this determines some of the data. Can be either |
link |
Can take either |
sdscale |
Logical object to indicate whether to write a model that specifies a reference SD
for standardising when modelling using Standardised Mean Differences. Specifying |
cfb |
A logical vector whose length is equal to the unique number of studies in |
A named list of numbers, vector, matrices and arrays to be sent to JAGS. List elements are:
y
An array of mean responses for each observation in each arm within each study
se
An array of standard errors for each observation in each arm within each study
time
A matrix of follow-up times within each study
fups
A numeric vector with the number of follow-up measurements per study
narm
A numeric vector with the number of arms per study
NS
The total number of studies in the dataset
NT
The total number of treatments in the dataset
treat
A matrix of treatment codes within each study
Nclass
Optional. The total number of classes in the dataset
class
Optional. A matrix of class codes within each study
classkey
Optional. A vector of class codes that correspond to treatment codes.
Same length as the number of treatment codes.
mat.triangle
Optional. A matrix with number indicating how to fill covariance
matrices within the JAGS code.
mat.order
Optional. A matrix with number indicating what order to fill
covariance matrices within the JAGS code.
timedif.0
Optional. A vector of the difference in times between the first and second
follow-up time in each study.
# Using the alogliptin dataset
network <- mb.network(alog_pcfb)
jagsdat <- getjagsdata(network$data.ab)
# Get JAGS data with class
netclass <- mb.network(goutSUA_CFBcomb)
jagsdat <- getjagsdata(netclass$data.ab, class=TRUE)
# Get JAGS data that allows for modelling correlation between time points
painnet <- mb.network(osteopain)
jagsdat <- getjagsdata(painnet$data.ab, rho="dunif(0,1)", covstruct="AR1")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.