| 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":-
yAn array of mean responses for each arm within each study -
seAn array of standard errors for each arm within each study
-
If
likelihood="binomial":-
rAn array of the number of responses/count for each each arm within each study -
nAn array of the number of participants for each arm within each study
-
If
likelihood="poisson":-
rAn array of the number of responses/count for each each arm within each study -
EAn array of the total exposure time for each arm within each study
-
-
doseA matrix of doses for each arm within each study (iflevel="agent") -
narmA numeric vector with the number of arms per study -
NSThe total number of studies in the dataset -
NagentThe total number of agents in the dataset (iflevel="agent") -
agentA matrix of agent codes within each study (iflevel="agent") -
NTThe total number of treatment in the dataset (iflevel="treatment") -
treatmentA matrix of treatment codes within each study (iflevel="treatment") -
NclassOptional. The total number of classes in the dataset -
classOptional. A matrix of class codes within each study -
classkeyOptional. A vector of class codes that correspond to agent codes. Same length as the number of agent codes. -
split.indOptional. 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")