getjagsdata {MBNMAdose} | R Documentation |
Prepares data for JAGS
Description
Converts MBNMA data frame to a list for use in JAGS model
Usage
getjagsdata(
data.ab,
class = FALSE,
sdscale = FALSE,
regress = NULL,
regress.effect = "common",
likelihood = check.likelink(data.ab)$likelihood,
link = check.likelink(data.ab)$link,
level = "agent",
fun = NULL,
nodesplit = NULL
)
Arguments
data.ab |
A data frame of arm-level data in "long" format containing the columns:
|
class |
A boolean object indicating whether or not |
sdscale |
Logical object to indicate whether to write a model that specifies a reference SD
for standardising when modelling using Standardised Mean Differences. Specifying |
regress |
A formula of effect modifiers (variables that
interact with the treatment effect) to incorporate using Network Meta-Regression
(E.g. |
regress.effect |
Indicates whether effect modification should be assumed to be
|
likelihood |
A string indicating the likelihood to use in the model. Can take either |
link |
A string indicating the link function to use in the model. Can take any link function
defined within JAGS (e.g. |
level |
Can take either |
fun |
An object of |
nodesplit |
A numeric vector of length 2 containing treatment codes on which to perform
an MBNMA nodesplit (see |
Value
A named list of numbers, vector, matrices and arrays to be sent to JAGS. List elements are:
If
likelihood="normal"
:-
y
An array of mean responses for each arm within each study -
se
An array of standard errors for each arm within each study
-
If
likelihood="binomial"
:-
r
An array of the number of responses/count for each each arm within each study -
n
An array of the number of participants for each arm within each study
-
If
likelihood="poisson"
:-
r
An array of the number of responses/count for each each arm within each study -
E
An array of the total exposure time for each arm within each study
-
-
dose
A matrix of doses for each arm within each study (iflevel="agent"
) -
narm
A numeric vector with the number of arms per study -
NS
The total number of studies in the dataset -
Nagent
The total number of agents in the dataset (iflevel="agent"
) -
agent
A matrix of agent codes within each study (iflevel="agent"
) -
NT
The total number of treatment in the dataset (iflevel="treatment"
) -
treatment
A matrix of treatment codes within each study (iflevel="treatment"
) -
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 agent codes. Same length as the number of agent codes. -
split.ind
Optional. A matrix indicating whether a specific arm contributes evidence to a nodesplit comparison.
Examples
# Using the triptans headache dataset
network <- mbnma.network(triptans)
jagsdat <- getjagsdata(network$data.ab, likelihood="binomial", link="logit")
# Get JAGS data with class
netclass <- mbnma.network(osteopain)
jagsdat <- getjagsdata(netclass$data.ab, class=TRUE)
# Get JAGS data at the treatment level for split Network Meta-Analysis
network <- mbnma.network(triptans)
jagsdat <- getjagsdata(network$data.ab, level="treatment")