Skip to contents

Extracts one hazard ratio per model: a single exposure coefficient for the conventional analyses (M1–M5, via hr_term()) and the always-treat-vs-never contrast for the marginal models (M6–M7, via hr_msm()). In M4 the exposure is the follow-up dose drug2, with the baseline dose drug1 and baseline_hr acting as confounders.

Usage

build_forest(fits, labels = forest_labels())

Arguments

fits

The list returned by fit_all_models().

labels

Method labels, one per model. Defaults to forest_labels().

Value

A tibble with columns method (an ordered factor), hr, lo, hi, and correct (TRUE for the reportable MSM, M7).

Examples

dat <- simulate_hr_agent(n = 2000)
build_forest(fit_all_models(dat))
#> Warning: The default delta method standard errors for `coxph` models only take into account uncertainty in the regression coefficients. Standard errors may be too small. Use the `inferences()` function or set `vcov` to "rsample", "boot"  or "fwb" to compute confidence intervals by bootstrapping. Set `vcov` to `FALSE` or `options(marginaleffects_safe=FALSE)` to silence this warning.
#> Warning: The default delta method standard errors for `coxph` models only take into account uncertainty in the regression coefficients. Standard errors may be too small. Use the `inferences()` function or set `vcov` to "rsample", "boot"  or "fwb" to compute confidence intervals by bootstrapping. Set `vcov` to `FALSE` or `options(marginaleffects_safe=FALSE)` to silence this warning.
#> # A tibble: 7 × 5
#>   method                                                 hr     lo    hi correct
#>   <fct>                                               <dbl>  <dbl> <dbl> <lgl>  
#> 1 M1  Crude (baseline dose)                           0.546 0.369  0.808 FALSE  
#> 2 M2  Crude (follow-up dose)                          0.918 0.521  1.62  FALSE  
#> 3 M3  Adjust baseline HR (baseline dose)              0.321 0.210  0.489 FALSE  
#> 4 M4  Adjust baseline HR + prior dose (follow-up dos… 0.632 0.355  1.12  FALSE  
#> 5 M5  PS-adjusted (follow-up dose)                    0.490 0.272  0.884 FALSE  
#> 6 M6  Marginal model, both doses (unweighted)         0.516 0.258  1.03  FALSE  
#> 7 M7  IPTW / MSM (always vs never)                    0.179 0.0850 0.377 TRUE