# NOT RUN {
## Smoking cessation
# Set up network of smoking cessation data
head(smoking)
smk_net <- set_agd_arm(smoking,
study = studyn,
trt = trtc,
r = r,
n = n,
trt_ref = "No intervention")
# Print details
smk_net
# }
# NOT RUN {
# Fitting a random effects model
smk_fit_RE <- nma(smk_net,
trt_effects = "random",
prior_intercept = normal(scale = 100),
prior_trt = normal(scale = 100),
prior_het = normal(scale = 5))
smk_fit_RE
# }
# NOT RUN {
# }
# NOT RUN {
# Working with arrays of posterior draws (as mcmc_array objects) is
# convenient when transforming parameters
# Transforming log odds ratios to odds ratios
LOR_array <- as.array(relative_effects(smk_fit_RE))
OR_array <- exp(LOR_array)
# mcmc_array objects can be summarised to produce a nma_summary object
smk_OR_RE <- summary(OR_array)
# This can then be printed or plotted
smk_OR_RE
plot(smk_OR_RE, ref_line = 1)
# Transforming heterogeneity SD to variance
tau_array <- as.array(smk_fit_RE, pars = "tau")
tausq_array <- tau_array^2
# Correct parameter names
names(tausq_array) <- "tausq"
# Summarise
summary(tausq_array)
# }
Run the code above in your browser using DataLab