Description Usage Arguments Value Note Examples
Compare weighted and unweighted (naive analysis) standardized difference
1 2 3 4 5 6 7 8 9 10 11 12 |
data.in |
input data, patients in rows and variables in columns. This could be an output from ipw_strata() or ps_match_strata(). |
data.in.unadj |
data set to use for the unadjusted analysis. For example, if PSM is used, the adjusted analysis should be done on the matched population but the unadjusted analysis should be done on the original population |
trt |
( |
vars |
variables of interest. standardized difference of each variable |
indicator.var |
( |
class.of.int |
( |
prob.names |
column names for the probability scores to be used as weights. The order of probnames should match the order of class.of.int. if probnames is NULL, the function will assume that the probnames are pred0, pred1, prod2, prod1or2 in the example in class.of.int. |
return.levels |
whether to return levels of each factor within each class. |
subj.aggr |
whether aggregate multiple entries from the same patients to one record |
usubjid.var |
column name indiacts subjuect id |
return a list
, each list
element is a data.frame
containing absolute standardized difference for each variable.
Calculation from Austin and Stuart (2015)
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 | 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)
)
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"
)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.