generate_pseudo_pop {CausalGPS} | R Documentation |
Generates pseudo population data set based on user-defined causal inference approach. The function uses an adaptive approach to satisfies covariate balance requirements. The function terminates either by satisfying covariate balance or completing the requested number of iteration, whichever comes first.
generate_pseudo_pop(
Y,
w,
c,
ci_appr,
pred_model,
gps_model = "parametric",
use_cov_transform = FALSE,
transformers = list("pow2", "pow3"),
bin_seq = NULL,
trim_quantiles = c(0.01, 0.99),
optimized_compile = FALSE,
params = list(),
nthread = 1,
...
)
Y |
A vector of observed outcome variable. |
w |
A vector of observed continuous exposure variable. |
c |
A data.frame or matrix of observed covariates variable. |
ci_appr |
The causal inference approach. Possible values are:
|
pred_model |
a prediction model (use "sl" for SuperLearner) |
gps_model |
Model type which is used for estimating GPS value, including parametric (default) and non-parametric. |
use_cov_transform |
If TRUE, the function uses transformer to meet the covariate balance. |
transformers |
A list of transformers. Each transformer should be a unary function. You can pass name of customized function in the quotes. Available transformers:
|
bin_seq |
Sequence of w (treatment) to generate pseudo population. If
NULL is passed the default value will be used, which is
|
trim_quantiles |
A numerical vector of two. Represents the trim quantile level. Both numbers should be in the range of [0,1] and in increasing order (default: c(0.01,0.99)). |
optimized_compile |
If TRUE, uses counts to keep track of number of replicated pseudo population. |
params |
Includes list of params that is used internally. Unrelated parameters will be ignored. |
nthread |
An integer value that represents the number of threads to be used by internal packages. |
... |
Additional arguments passed to different models. |
if ci.appr = 'matching':
matching_fun: Matching function. Available options:
matching_l1: Manhattan distance matching
delta_n: caliper parameter.
scale: a specified scale parameter to control the relative weight that is attributed to the distance measures of the exposure versus the GPS.
covar_bl_method: covariate balance method. Available options:
'absolute'
covar_bl_trs: covariate balance threshold
covar_bl_trs_type: covariate balance type (mean, median, maximal)
max_attempt: maximum number of attempt to satisfy covariate balance.
See create_matching()
for more details about the parameters and default
values.
if ci.appr = 'weighting':
covar_bl_method: Covariate balance method.
covar_bl_trs: Covariate balance threshold
max_attempt: Maximum number of attempt to satisfy covariate balance.
if pred_model = 'sl':
sl_lib: A vector of prediction algorithms.
Returns a pseudo population (gpsm_pspop) object that is generated or augmented based on the selected causal inference approach (ci_appr). The object includes the following objects:
params
ci_appr
pred_model
params
pseudo_pop
adjusted_corr_results
original_corr_results
optimized_compile (True or False)
m_d <- generate_syn_data(sample_size = 100)
pseuoo_pop <- generate_pseudo_pop(m_d$Y,
m_d$treat,
m_d[c("cf1","cf2","cf3","cf4","cf5","cf6")],
ci_appr = "matching",
pred_model = "sl",
gps_model = "parametric",
bin_seq = NULL,
trim_quantiles = c(0.01,0.99),
optimized_compile = FALSE,
use_cov_transform = FALSE,
transformers = list(),
sl_lib = c("m_xgboost"),
params = list(xgb_nrounds=c(10,20,30),
xgb_eta=c(0.1,0.2,0.3)),
nthread = 1,
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)