Skip to contents

Generate (population-average) relative treatment effects. If a ML-NMR or meta-regression model was fitted, these are specific to each study population.

Usage

relative_effects(
  x,
  newdata = NULL,
  study = NULL,
  all_contrasts = FALSE,
  trt_ref = NULL,
  probs = c(0.025, 0.25, 0.5, 0.75, 0.975),
  predictive_distribution = FALSE,
  summary = TRUE
)

Arguments

x

A stan_nma object created by nma()

newdata

Only used if a regression model is fitted. A data frame of study details, one row per study, giving the covariate values at which to produce relative effects. Column names must match variables in the regression model. If NULL, relative effects are produced for all studies in the network.

study

Column of newdata which specifies study names, otherwise studies will be labelled by row number.

all_contrasts

Logical, generate estimates for all contrasts (TRUE), or just the "basic" contrasts against the network reference treatment (FALSE)? Default FALSE.

trt_ref

Reference treatment to construct relative effects against, if all_contrasts = FALSE. By default, relative effects will be against the network reference treatment. Coerced to character string.

probs

Numeric vector of quantiles of interest to present in computed summary, default c(0.025, 0.25, 0.5, 0.75, 0.975)

predictive_distribution

Logical, when a random effects model has been fitted, should the predictive distribution for relative effects in a new study be returned? Default FALSE.

summary

Logical, calculate posterior summaries? Default TRUE.

Value

A nma_summary object if summary = TRUE, otherwise a list containing a 3D MCMC array of samples and (for regression models) a data frame of study information.

See also

plot.nma_summary() for plotting the relative effects.

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{
# Produce relative effects
smk_releff_RE <- relative_effects(smk_fit_RE)
smk_releff_RE
#>                           mean   sd  2.5%  25%  50%  75% 97.5% Bulk_ESS
#> d[Group counselling]      1.11 0.43  0.28 0.83 1.09 1.38  1.96     2243
#> d[Individual counselling] 0.85 0.24  0.38 0.69 0.85 1.00  1.34     1190
#> d[Self-help]              0.50 0.40 -0.30 0.25 0.50 0.76  1.28     1897
#>                           Tail_ESS Rhat
#> d[Group counselling]          2523    1
#> d[Individual counselling]     2147    1
#> d[Self-help]                  2560    1
plot(smk_releff_RE, ref_line = 0)


# Relative effects for all pairwise comparisons
relative_effects(smk_fit_RE, all_contrasts = TRUE)
#>                                                  mean   sd  2.5%   25%   50%
#> d[Group counselling vs. No intervention]         1.11 0.43  0.28  0.83  1.09
#> d[Individual counselling vs. No intervention]    0.85 0.24  0.38  0.69  0.85
#> d[Self-help vs. No intervention]                 0.50 0.40 -0.30  0.25  0.50
#> d[Individual counselling vs. Group counselling] -0.26 0.41 -1.07 -0.52 -0.25
#> d[Self-help vs. Group counselling]              -0.61 0.48 -1.60 -0.92 -0.60
#> d[Self-help vs. Individual counselling]         -0.35 0.41 -1.19 -0.61 -0.35
#>                                                   75% 97.5% Bulk_ESS Tail_ESS
#> d[Group counselling vs. No intervention]         1.38  1.96     2243     2523
#> d[Individual counselling vs. No intervention]    1.00  1.34     1190     2147
#> d[Self-help vs. No intervention]                 0.76  1.28     1897     2560
#> d[Individual counselling vs. Group counselling]  0.00  0.53     3067     2803
#> d[Self-help vs. Group counselling]              -0.29  0.34     3251     2655
#> d[Self-help vs. Individual counselling]         -0.09  0.44     2409     2741
#>                                                 Rhat
#> d[Group counselling vs. No intervention]           1
#> d[Individual counselling vs. No intervention]      1
#> d[Self-help vs. No intervention]                   1
#> d[Individual counselling vs. Group counselling]    1
#> d[Self-help vs. Group counselling]                 1
#> d[Self-help vs. Individual counselling]            1

# Relative effects against a different reference treatment
relative_effects(smk_fit_RE, trt_ref = "Self-help")
#>                            mean   sd  2.5%   25%   50%   75% 97.5% Bulk_ESS
#> d[No intervention]        -0.50 0.40 -1.28 -0.76 -0.50 -0.25  0.30     1897
#> d[Group counselling]       0.61 0.48 -0.34  0.29  0.60  0.92  1.60     3251
#> d[Individual counselling]  0.35 0.41 -0.44  0.09  0.35  0.61  1.19     2409
#>                           Tail_ESS Rhat
#> d[No intervention]            2560    1
#> d[Group counselling]          2655    1
#> d[Individual counselling]     2741    1

# Transforming to odds ratios
# We work with the array of relative effects samples
LOR_array <- as.array(smk_releff_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
#>                           mean   sd 2.5%  25%  50%  75% 97.5% Bulk_ESS Tail_ESS
#> d[Group counselling]      3.32 1.54 1.32 2.28 2.97 3.99  7.10     2243     2523
#> d[Individual counselling] 2.41 0.60 1.47 2.00 2.33 2.73  3.83     1190     2147
#> d[Self-help]              1.78 0.74 0.74 1.28 1.64 2.13  3.59     1897     2560
#>                           Rhat
#> d[Group counselling]         1
#> d[Individual counselling]    1
#> d[Self-help]                 1
plot(smk_OR_RE, ref_line = 1)

# }

## Plaque psoriasis ML-NMR
# \donttest{
# Run plaque psoriasis ML-NMR example if not already available
if (!exists("pso_fit")) example("example_pso_mlnmr", run.donttest = TRUE)
# }
# \donttest{
# Produce population-adjusted relative effects for all study populations in
# the network
pso_releff <- relative_effects(pso_fit)
pso_releff
#> ---------------------------------------------------------------- Study: FIXTURE ---- 
#> 
#> Covariate values:
#>  durnpso prevsys  bsa weight  psa
#>      1.6    0.62 0.34   8.34 0.14
#> 
#>                     mean   sd 2.5%  25%  50%  75% 97.5% Bulk_ESS Tail_ESS Rhat
#> d[FIXTURE: ETN]     1.66 0.09 1.49 1.60 1.66 1.72  1.84     4598     3403    1
#> d[FIXTURE: IXE_Q2W] 3.03 0.10 2.85 2.96 3.03 3.09  3.22     6002     3534    1
#> d[FIXTURE: IXE_Q4W] 2.62 0.09 2.43 2.55 2.61 2.68  2.81     6290     3002    1
#> d[FIXTURE: SEC_150] 2.22 0.12 2.00 2.14 2.22 2.30  2.45     4332     3534    1
#> d[FIXTURE: SEC_300] 2.53 0.12 2.30 2.45 2.52 2.60  2.77     4934     3331    1
#> 
#> -------------------------------------------------------------- Study: UNCOVER-1 ---- 
#> 
#> Covariate values:
#>  durnpso prevsys  bsa weight  psa
#>        2    0.73 0.28   9.24 0.28
#> 
#>                       mean   sd 2.5%  25%  50%  75% 97.5% Bulk_ESS Tail_ESS
#> d[UNCOVER-1: ETN]     1.51 0.09 1.34 1.45 1.51 1.56  1.67     5094     3396
#> d[UNCOVER-1: IXE_Q2W] 2.92 0.09 2.76 2.87 2.92 2.98  3.09     5939     3525
#> d[UNCOVER-1: IXE_Q4W] 2.51 0.08 2.35 2.46 2.51 2.57  2.67     6261     3139
#> d[UNCOVER-1: SEC_150] 2.12 0.12 1.88 2.03 2.11 2.20  2.35     5012     3511
#> d[UNCOVER-1: SEC_300] 2.42 0.12 2.18 2.34 2.42 2.50  2.66     5648     3752
#>                       Rhat
#> d[UNCOVER-1: ETN]        1
#> d[UNCOVER-1: IXE_Q2W]    1
#> d[UNCOVER-1: IXE_Q4W]    1
#> d[UNCOVER-1: SEC_150]    1
#> d[UNCOVER-1: SEC_300]    1
#> 
#> -------------------------------------------------------------- Study: UNCOVER-2 ---- 
#> 
#> Covariate values:
#>  durnpso prevsys  bsa weight  psa
#>     1.87    0.64 0.27   9.17 0.24
#> 
#>                       mean   sd 2.5%  25%  50%  75% 97.5% Bulk_ESS Tail_ESS
#> d[UNCOVER-2: ETN]     1.51 0.08 1.34 1.45 1.51 1.56  1.67     5035     3505
#> d[UNCOVER-2: IXE_Q2W] 2.92 0.08 2.76 2.87 2.92 2.98  3.09     6035     3397
#> d[UNCOVER-2: IXE_Q4W] 2.51 0.08 2.35 2.46 2.51 2.57  2.67     6391     3232
#> d[UNCOVER-2: SEC_150] 2.12 0.12 1.89 2.03 2.11 2.20  2.35     5005     3667
#> d[UNCOVER-2: SEC_300] 2.42 0.12 2.19 2.34 2.42 2.50  2.66     5603     3444
#>                       Rhat
#> d[UNCOVER-2: ETN]        1
#> d[UNCOVER-2: IXE_Q2W]    1
#> d[UNCOVER-2: IXE_Q4W]    1
#> d[UNCOVER-2: SEC_150]    1
#> d[UNCOVER-2: SEC_300]    1
#> 
#> -------------------------------------------------------------- Study: UNCOVER-3 ---- 
#> 
#> Covariate values:
#>  durnpso prevsys  bsa weight psa
#>     1.78    0.59 0.28   9.01 0.2
#> 
#>                       mean   sd 2.5%  25%  50%  75% 97.5% Bulk_ESS Tail_ESS
#> d[UNCOVER-3: ETN]     1.53 0.08 1.37 1.48 1.53 1.58  1.69     4966     3444
#> d[UNCOVER-3: IXE_Q2W] 2.94 0.08 2.78 2.88 2.94 3.00  3.10     6124     3454
#> d[UNCOVER-3: IXE_Q4W] 2.53 0.08 2.37 2.48 2.53 2.58  2.69     6486     3242
#> d[UNCOVER-3: SEC_150] 2.13 0.11 1.91 2.06 2.13 2.21  2.36     4870     3615
#> d[UNCOVER-3: SEC_300] 2.44 0.12 2.21 2.36 2.44 2.51  2.67     5469     3246
#>                       Rhat
#> d[UNCOVER-3: ETN]        1
#> d[UNCOVER-3: IXE_Q2W]    1
#> d[UNCOVER-3: IXE_Q4W]    1
#> d[UNCOVER-3: SEC_150]    1
#> d[UNCOVER-3: SEC_300]    1
#> 
plot(pso_releff, ref_line = 0)


# Produce population-adjusted relative effects for a different target
# population
new_agd_means <- data.frame(
  bsa = 0.6,
  prevsys = 0.1,
  psa = 0.2,
  weight = 10,
  durnpso = 3)

relative_effects(pso_fit, newdata = new_agd_means)
#> ------------------------------------------------------------------ Study: New 1 ---- 
#> 
#> Covariate values:
#>  durnpso prevsys bsa weight psa
#>        3     0.1 0.6     10 0.2
#> 
#>                   mean   sd 2.5%  25%  50%  75% 97.5% Bulk_ESS Tail_ESS Rhat
#> d[New 1: ETN]     1.25 0.23 0.82 1.09 1.25 1.40  1.71     7482     3159    1
#> d[New 1: IXE_Q2W] 2.89 0.22 2.46 2.74 2.88 3.03  3.36     8703     3138    1
#> d[New 1: IXE_Q4W] 2.48 0.22 2.06 2.32 2.47 2.62  2.93     8985     3121    1
#> d[New 1: SEC_150] 2.08 0.22 1.65 1.93 2.08 2.23  2.53     8107     3052    1
#> d[New 1: SEC_300] 2.38 0.23 1.94 2.23 2.38 2.54  2.86     8676     3121    1
#> 
# }