dmphillippo / multinma

Network meta-analysis of individual and aggregate data in Stan
https://dmphillippo.github.io/multinma
33 stars 15 forks source link

output the SE of coefficients #5

Closed Rednose22 closed 7 months ago

Rednose22 commented 2 years ago

Hi David, I just wonder why using PRINT function could get the SE of coefficients, but SE didn't appear in the nma_summary class. Thus, how can I get the SE of coefficients without additional derivations?

dmphillippo commented 2 years ago

Hi @Rednose22. Sorry for the delay, I'm away from work at the moment. To get the summary statistics (including standard errors) in a data frame, you can use as.data.frame() on an nma_summary object. For example:

smk_net <- set_agd_arm(smoking,
                       study = studyn,
                       trt = trtc,
                       r = r,
                       n = n,
                       trt_ref = "No intervention")

smk_fit_FE <- nma(smk_net, 
                  trt_effects = "fixed",
                  prior_intercept = normal(scale = 100),
                  prior_trt = normal(scale = 100))

# Get summary statistics in a data frame
as.data.frame(summary(smk_fit_FE, pars = "d"))

#                   parameter      mean         sd        2.5%       25%       50%       75%     97.5% Bulk_ESS
# 1      d[Group counselling] 0.8357669 0.17755288  0.49374783 0.7128768 0.8364599 0.9539250 1.1876955 2225.955
# 2 d[Individual counselling] 0.7626663 0.05873427  0.64969340 0.7219572 0.7624985 0.8034936 0.8794246 1690.450
# 3              d[Self-help] 0.2263671 0.12661442 -0.02095008 0.1408166 0.2272111 0.3089894 0.4792801 2910.445
#   Tail_ESS     Rhat
# 1 2701.575 1.000602
# 2 2880.733 1.001648
# 3 2679.147 1.001052

(The summary statistics are actually stored in the nma_summary class, under $summary. E.g. summary(smk_fit_FE)$summary. Calling as.data.frame() just accesses these.)