check_covar_balance: Check Covariate Balance

Description Usage Arguments Details Value Examples

View source: R/check_covar_balance.R

Description

Checks the covariate balance of original population or pseudo population.

Usage

1
check_covar_balance(pseudo_pop, ci_appr, nthread = 1, optimized_compile, ...)

Arguments

pseudo_pop

The generated pseudo population. In the following format:

  • 1st column: outcome (Y)

  • 2nd column: exposure (w)

  • 3rd column: gps

  • 4th column to the end: covariates (c)

ci_appr

The causal inference approach.

nthread

The number of available threads.

optimized_compile

If TRUE, use optimized compile approach.

...

Additional arguments passed to different models.

Details

Additional parameters

Value

output object:

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
30
31
32
33
34
set.seed(422)
n <- 100
mydata <- generate_syn_data(sample_size=100)
year <- sample(x=c("2001","2002","2003","2004","2005"),size = n, replace = TRUE)
region <- sample(x=c("North", "South", "East", "West"),size = n, replace = TRUE)
mydata$year <- as.factor(year)
mydata$region <- as.factor(region)
mydata$cf5 <- as.factor(mydata$cf5)

pseudo_pop <- generate_pseudo_pop(mydata$Y,
                                 mydata$treat,
                                 mydata[c("cf1","cf2","cf3","cf4","cf5","cf6","year","region")],
                                 ci_appr = "matching",
                                 pred_model = "sl",
                                 gps_model = "non-parametric",
                                 trim_quantiles = c(0.01,0.99),
                                 optimized_compile = TRUE,
                                 sl_lib = c("m_xgboost"),
                                 covar_bl_method = "absolute",
                                 covar_bl_trs = 0.1,
                                 covar_bl_trs_type = "mean",
                                 max_attempt = 1,
                                 matching_fun = "matching_l1",
                                 delta_n = 1,
                                 scale = 0.5,
                                 nthread = 1)

adjusted_corr_obj <- check_covar_balance(pseudo_pop$pseudo_pop,
                                        ci_appr="matching",
                                        nthread=1,
                                        covar_bl_method = "absolute",
                                        covar_bl_trs = 0.1,
                                        covar_bl_trs_type = "mean",
                                        optimized_compile=FALSE)

CausalGPS documentation built on Feb. 7, 2022, 5:12 p.m.