View source: R/compute_counter_weight.R
compute_counter_weight | R Documentation |
Computes counter (for matching approach) or weight (for weighting) approach.
compute_counter_weight(gps_obj, ci_appr, nthread = 1, ...)
gps_obj |
A gps object that is generated with |
ci_appr |
The causal inference approach. Possible values are:
|
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':
bin_seq: A sequence of w (treatment) to generate pseudo population.
If NULL
is passed the default value will be used, which is
seq(min(w)+delta_n/2,max(w), by=delta_n)
.
dist_measure: Matching function. Available options:
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.
Returns a counter_weight (cgps_cw) object that includes .data
and params
attributes.
.data
: includes id
and counter_weight
columns. In case of matching
the counter_weight
column is integer values, which represent how many times
the provided observational data was mached during the matching process. In
case of weighting
the column is double values.
params
: Include related parameters that is used for the process.
m_d <- generate_syn_data(sample_size = 100)
gps_obj <- estimate_gps(.data = m_d,
.formula = w ~ cf1 + cf2 + cf3 + cf4 + cf5 + cf6,
gps_density = "normal",
sl_lib = c("SL.xgboost"))
cw_object <- compute_counter_weight(gps_obj = gps_obj,
ci_appr = "matching",
bin_seq = NULL,
nthread = 1,
delta_n = 0.1,
dist_measure = "l1",
scale = 0.5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.