std_diff_plot: Compare weighted and unweighted (naive analysis) standardized...

Description Usage Arguments Examples

View source: R/std_diff.R

Description

Compare weighted and unweighted (naive analysis) standardized difference in plot

Usage

1
2
3
4
5
6
7
std_diff_plot(
  diff.list,
  legend.pos = "right",
  prefix.title = "In strata:",
  xlim.low = 0,
  xlim.high = 1
)

Arguments

diff.list

data list returned by function std_diff.

legend.pos

legend position: "left", "top", "right", "bottom".

prefix.title

prefix for title

xlim.low

(numeric) lower bound of xlim

xlim.high

(numeric) upper bound of xlim

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Not run: 
library(dplyr)
clinical_1 <- clinical %>% mutate( 
  indicator = case_when(
    STRATUM == "strata_1" ~ 0, 
    STRATUM == "strata_2" ~ 1,
    is.na(STRATUM) & ARM == "experimental" ~ 1,
    TRUE ~ -1 
  ),
  ARM  = factor(ARM, levels = c("control","experimental")),
  BNLR = case_when(
    is.na(BNLR) ~ median(BNLR, na.rm = TRUE),
    TRUE ~ BNLR
  )
)
ipw_res1 <- ipw_strata(
  data.in = clinical_1, formula = indicator ~ BECOG + SEX + BNLR,
  indicator.var = "indicator", tte = "OS_MONTH", event = "OS_EVENT", trt = "ARM",
  class.of.int = list("strata_1" = 1, "strata_2" = 0)
 )
ipw_diff <- std_diff(
  data.in = ipw_res1$data, vars = c("BECOG", "SEX", "BNLR"),
  indicator.var = "indicator", trt = "ARM",
  class.of.int = list("strata_1" = 1, "strata_2" = 0),
  usubjid.var = "SUBJID"
)
std_diff_plot(ipw_diff)

## End(Not run)

PropensitySub documentation built on July 29, 2021, 9:07 a.m.