Skip to contents

Posterior summaries of model parameters in stan_nma objects may be produced using the summary() method and plotted with the plot() method. NOTE: To produce relative effects, absolute predictions, or posterior ranks, see relative_effects(), predict.stan_nma(), posterior_ranks(), posterior_rank_probs().

Usage

# S3 method for stan_nma
summary(object, ..., pars, include, probs = c(0.025, 0.25, 0.5, 0.75, 0.975))

# S3 method for stan_nma
plot(
  x,
  ...,
  pars,
  include,
  stat = "pointinterval",
  orientation = c("horizontal", "vertical", "y", "x"),
  ref_line = NA_real_
)

Arguments

...

Additional arguments passed on to other methods

pars, include

See rstan::extract()

probs

Numeric vector of specifying quantiles of interest, default c(0.025, 0.25, 0.5, 0.75, 0.975)

x, object

A stan_nma object

stat

Character string specifying the ggdist plot stat to use, default "pointinterval"

orientation

Whether the ggdist geom is drawn horizontally ("horizontal") or vertically ("vertical"), default "horizontal"

ref_line

Numeric vector of positions for reference lines, by default no reference lines are drawn

summary

Logical, calculate posterior summaries? Default TRUE.

Value

A nma_summary object

Details

The plot() method is a shortcut for plot(summary(stan_nma)). For details of plotting options, see plot.nma_summary().

Examples

## Smoking cessation
# \donttest{
# Run smoking RE NMA example if not already available
if (!exists("smk_fit_RE")) example("example_smk_re", run.donttest = TRUE)
# }
# \donttest{
# Summary and plot of all model parameters
summary(smk_fit_RE)
#>                                    mean   sd  2.5%   25%   50%   75% 97.5%
#> mu[1]                             -2.79 0.33 -3.46 -3.00 -2.78 -2.56 -2.16
#> mu[2]                             -2.58 0.77 -4.19 -3.06 -2.57 -2.08 -1.12
#> mu[3]                             -2.14 0.12 -2.39 -2.22 -2.14 -2.06 -1.92
#> mu[4]                             -4.05 0.56 -5.22 -4.41 -4.03 -3.66 -3.03
#> mu[5]                             -2.15 0.14 -2.43 -2.25 -2.15 -2.06 -1.89
#> mu[6]                             -3.42 0.73 -5.07 -3.85 -3.36 -2.92 -2.16
#> mu[7]                             -3.02 0.44 -3.96 -3.29 -2.99 -2.71 -2.25
#> mu[8]                             -2.72 0.62 -4.06 -3.11 -2.68 -2.29 -1.63
#> mu[9]                             -1.85 0.43 -2.72 -2.11 -1.84 -1.55 -1.06
#> mu[10]                            -2.08 0.12 -2.32 -2.16 -2.08 -2.00 -1.85
#> mu[11]                            -3.62 0.23 -4.10 -3.77 -3.61 -3.46 -3.20
#> mu[12]                            -2.22 0.13 -2.48 -2.30 -2.22 -2.13 -1.97
#> mu[13]                            -2.69 0.44 -3.58 -2.98 -2.67 -2.39 -1.87
#> mu[14]                            -2.41 0.23 -2.88 -2.57 -2.40 -2.26 -1.97
#> mu[15]                            -2.69 0.73 -4.30 -3.12 -2.63 -2.18 -1.43
#> mu[16]                            -2.61 0.34 -3.33 -2.84 -2.60 -2.38 -1.99
#> mu[17]                            -2.38 0.11 -2.60 -2.45 -2.37 -2.30 -2.17
#> mu[18]                            -2.57 0.28 -3.14 -2.74 -2.56 -2.38 -2.06
#> mu[19]                            -1.90 0.12 -2.14 -1.99 -1.90 -1.82 -1.68
#> mu[20]                            -2.80 0.12 -3.05 -2.88 -2.80 -2.72 -2.57
#> mu[21]                            -1.11 0.80 -2.69 -1.62 -1.10 -0.60  0.47
#> mu[22]                            -2.41 0.85 -4.09 -2.96 -2.39 -1.86 -0.80
#> mu[23]                            -2.32 0.80 -3.87 -2.85 -2.31 -1.79 -0.74
#> mu[24]                            -2.82 0.84 -4.55 -3.36 -2.81 -2.29 -1.14
#> d[Group counselling]               1.11 0.43  0.28  0.83  1.09  1.38  1.96
#> d[Individual counselling]          0.85 0.24  0.38  0.69  0.85  1.00  1.34
#> d[Self-help]                       0.50 0.40 -0.30  0.25  0.50  0.76  1.28
#> tau                                0.83 0.18  0.54  0.70  0.81  0.93  1.23
#> delta[1: Individual counselling]   1.07 0.39  0.31  0.81  1.07  1.33  1.86
#> delta[1: Group counselling]        0.37 0.43 -0.50  0.09  0.37  0.65  1.23
#> delta[2: Self-help]                0.68 0.79 -0.82  0.17  0.66  1.16  2.27
#> delta[2: Individual counselling]   0.77 0.77 -0.72  0.27  0.76  1.25  2.35
#> delta[2: Group counselling]        1.00 0.78 -0.49  0.49  0.98  1.49  2.60
#> delta[3: Individual counselling]   2.17 0.14  1.89  2.07  2.17  2.26  2.44
#> delta[4: Individual counselling]   0.90 0.58 -0.21  0.52  0.89  1.27  2.06
#> delta[5: Individual counselling]   0.44 0.15  0.15  0.33  0.44  0.54  0.74
#> delta[6: Individual counselling]   1.71 0.72  0.50  1.20  1.65  2.14  3.35
#> delta[7: Individual counselling]   2.13 0.49  1.26  1.80  2.11  2.44  3.17
#> delta[8: Individual counselling]   1.66 0.63  0.51  1.23  1.63  2.06  3.01
#> delta[9: Individual counselling]   0.60 0.47 -0.31  0.27  0.60  0.90  1.53
#> delta[10: Self-help]               0.00 0.17 -0.32 -0.11  0.00  0.11  0.34
#> delta[11: Self-help]               0.41 0.31 -0.22  0.20  0.41  0.61  1.02
#> delta[12: Individual counselling]  0.41 0.17  0.09  0.30  0.41  0.53  0.74
#> delta[13: Individual counselling]  0.40 0.50 -0.55  0.07  0.40  0.72  1.43
#> delta[14: Individual counselling]  0.63 0.29  0.05  0.43  0.63  0.82  1.21
#> delta[15: Group counselling]       2.15 0.75  0.81  1.62  2.10  2.61  3.77
#> delta[16: Self-help]               0.65 0.40 -0.10  0.38  0.65  0.91  1.43
#> delta[17: Individual counselling]  0.55 0.14  0.28  0.45  0.55  0.65  0.84
#> delta[18: Individual counselling]  0.03 0.31 -0.58 -0.17  0.03  0.24  0.68
#> delta[19: Individual counselling] -0.19 0.17 -0.52 -0.31 -0.19 -0.07  0.14
#> delta[20: Individual counselling]  0.08 0.19 -0.30 -0.05  0.08  0.20  0.43
#> delta[21: Self-help]               0.68 0.80 -0.89  0.18  0.66  1.19  2.26
#> delta[21: Individual counselling]  0.63 0.78 -0.95  0.14  0.63  1.14  2.19
#> delta[22: Self-help]               0.32 0.84 -1.33 -0.23  0.32  0.86  2.02
#> delta[22: Group counselling]       1.28 0.85 -0.30  0.74  1.26  1.82  2.99
#> delta[23: Individual counselling]  0.67 0.78 -0.91  0.17  0.67  1.18  2.16
#> delta[23: Group counselling]       1.28 0.79 -0.28  0.75  1.28  1.80  2.84
#> delta[24: Individual counselling]  1.07 0.82 -0.53  0.54  1.05  1.57  2.80
#> delta[24: Group counselling]       0.91 0.84 -0.76  0.36  0.91  1.46  2.59
#>                                   Bulk_ESS Tail_ESS Rhat
#> mu[1]                                 5721     3121    1
#> mu[2]                                 2739     2354    1
#> mu[3]                                 7281     3087    1
#> mu[4]                                 4649     2750    1
#> mu[5]                                 6408     2986    1
#> mu[6]                                 3052     2287    1
#> mu[7]                                 4486     2888    1
#> mu[8]                                 4104     2933    1
#> mu[9]                                 5637     2874    1
#> mu[10]                                7633     3017    1
#> mu[11]                                6723     2840    1
#> mu[12]                                7081     3186    1
#> mu[13]                                4599     2805    1
#> mu[14]                                4830     2956    1
#> mu[15]                                3275     2521    1
#> mu[16]                                5542     2995    1
#> mu[17]                                7637     2637    1
#> mu[18]                                5825     2592    1
#> mu[19]                                8801     2983    1
#> mu[20]                                7216     3235    1
#> mu[21]                                3000     2832    1
#> mu[22]                                2838     2694    1
#> mu[23]                                3095     2901    1
#> mu[24]                                3352     2569    1
#> d[Group counselling]                  2243     2523    1
#> d[Individual counselling]             1190     2147    1
#> d[Self-help]                          1897     2560    1
#> tau                                   1286     1830    1
#> delta[1: Individual counselling]      5647     3246    1
#> delta[1: Group counselling]           5616     3405    1
#> delta[2: Self-help]                   2819     2736    1
#> delta[2: Individual counselling]      2848     2718    1
#> delta[2: Group counselling]           2821     2614    1
#> delta[3: Individual counselling]      5896     3387    1
#> delta[4: Individual counselling]      4151     3089    1
#> delta[5: Individual counselling]      6226     2954    1
#> delta[6: Individual counselling]      2700     2108    1
#> delta[7: Individual counselling]      3947     2899    1
#> delta[8: Individual counselling]      3738     2840    1
#> delta[9: Individual counselling]      5164     3128    1
#> delta[10: Self-help]                  5594     3428    1
#> delta[11: Self-help]                  5464     3345    1
#> delta[12: Individual counselling]     5747     3160    1
#> delta[13: Individual counselling]     4835     3334    1
#> delta[14: Individual counselling]     4971     2971    1
#> delta[15: Group counselling]          2563     2175    1
#> delta[16: Self-help]                  4916     2763    1
#> delta[17: Individual counselling]     6046     2677    1
#> delta[18: Individual counselling]     5402     3004    1
#> delta[19: Individual counselling]     6111     3427    1
#> delta[20: Individual counselling]     6150     3577    1
#> delta[21: Self-help]                  2917     2812    1
#> delta[21: Individual counselling]     2961     2740    1
#> delta[22: Self-help]                  2938     2576    1
#> delta[22: Group counselling]          2739     2711    1
#> delta[23: Individual counselling]     3163     2744    1
#> delta[23: Group counselling]          3104     3138    1
#> delta[24: Individual counselling]     3559     2694    1
#> delta[24: Group counselling]          3664     2935    1
plot(smk_fit_RE)


# Summary and plot of heterogeneity tau only
summary(smk_fit_RE, pars = "tau")
#>     mean   sd 2.5% 25%  50%  75% 97.5% Bulk_ESS Tail_ESS Rhat
#> tau 0.83 0.18 0.54 0.7 0.81 0.93  1.23     1286     1830    1
plot(smk_fit_RE, pars = "tau")


# Customising plot output
plot(smk_fit_RE,
     pars = c("d", "tau"),
     stat = "halfeye",
     ref_line = 0)

# }