Create a dataset that can be used to produce a PHR propensity score histogram

hist_phr(
  ...,
  cat = 2,
  binwidth = 0.02,
  weight = FALSE,
  wt_and_un_wt = FALSE,
  by_treat = TRUE
)

Arguments

...

ipw objects supplied as a list or as seperate arguments

cat

For multinomial propensity score, the arguments specifies which category probabilities are plotted.

binwidth

The width of the histogram bins (default is 0.05).

weight

If true, the histogram will be weighted with the treatment weights (default = FALSE)

wt_and_un_wt

If true, both weighted and unweighted results will be created (default = FALSE)

by_treat

If TRUE, the histogram will be stratified by treatment group, otherwise it will depict the overall distribution of the PS in the sample. (default = TRUE)

Value

A tibble in the format for upload to a PHR using nswpr

Examples

models = specify_models(identify_treatment(Statin, formula = ~DxRisk ),
                        identify_censoring(EndofEnrollment, formula = ~DxRisk),
                        identify_outcome(Death))

fit = estimate_ipwrisk(example1, models,
                       times = seq(0,24,0.1),
                       labels = c("IPTCW main analysis"))

hist_phr(fit)
#> # A tibble: 102 × 4
#>    panel                    y     x group  
#>    <fct>                <dbl> <dbl> <fct>  
#>  1 IPTCW main analysis 0.0156  0    Control
#>  2 IPTCW main analysis 0.234   0.02 Control
#>  3 IPTCW main analysis 0.391   0.04 Control
#>  4 IPTCW main analysis 0.484   0.06 Control
#>  5 IPTCW main analysis 0.672   0.08 Control
#>  6 IPTCW main analysis 0.687   0.1  Control
#>  7 IPTCW main analysis 0.828   0.12 Control
#>  8 IPTCW main analysis 0.781   0.14 Control
#>  9 IPTCW main analysis 1.34    0.16 Control
#> 10 IPTCW main analysis 0.875   0.18 Control
#> # … with 92 more rows