crosnma.run: Run JAGS to synthesize cross-design evidence and cross-format...

Description Usage Arguments Value See Also Examples

View source: R/crosnma.run.R

Description

Takes the JAGS model from an object produced by crosnma.model and runs it using jags package.

Usage

1
2
3
4
5
6
7
8
9
crosnma.run(
  model,
  n.adapt = 1000,
  n.burnin = floor(n.iter/2),
  n.iter,
  thin = 1,
  n.chains = 2,
  quiet = TRUE
)

Arguments

model

A crosnmaModel object produced by crosnma.model.

n.adapt

Number of adaptations for the MCMC chains.

n.burnin

Number of burnin iterations for the MCMC chains.

n.iter

Number of iterations for the MCMC chains.

thin

Number of thinning for the MCMC chains. Default is 1.

n.chains

Number of MCMC chains. Default is 2.

quiet

A logical. If TRUE, the warning message will not be displayed See jags.model for more info.

Value

crosnma.run returns an object of class crosrun which is a list containing the following components:

samples The MCMC samples produced by running the JAGS model.

model The crosnmaModel object obtained from crosnma.model which was used to run jags.

trt.key A table of the treatment names and their correspondence to integers used in the JAGS model.

See Also

crosnma.model,jags.model

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# An example from participant-level data and study-level data.
# data
data(prt.data)
data(std.data)
 #=========================#
  # Create a jags model  #
 #=========================#
 # We conduct a network meta-analysis assuming a random effect model.
 # The data comes from randomised-controlled trials and non-randomised studies. They will be combined naively.
 # The data has 2 different formats: individual participant data (prt.data) and study-level data (std.data).
mod <- crosnma.model(prt.data=prt.data,
                  std.data=std.data,
                  trt=c('trt','trt'),
                  study=c('study','study'),
                  outcome=c('outcome','outcome'),
                  n='n',
                  design=c('design','design'),
                  reference='A',
                  trt.effect='random',
                  covariate = NULL,
                  method.bias='naive'
                   )
 #=========================#
    # Fit jags model  #
 #=========================#
fit <- crosnma.run(model=mod,
                n.adapt = 20,
                n.iter=50,
                thin=1,
                n.chains=3)

 #=========================#
   # Display the output   #
 #=========================#
summary(fit)
plot(fit)

TasnimHamza/crosnma documentation built on Dec. 18, 2021, 4:05 p.m.