overlap_fun {causaldrf}  R Documentation 
This function creates an overlapping dataset
Description
This function ensures that the units overlap according to the estimated gps
values. The overlapping dataset depends on the number of classes
n_class
to subclassify on.
Usage
overlap_fun(Y,
treat,
treat_formula,
data_set,
n_class,
treat_mod,
link_function,
...)
Arguments
Y 
is the the name of the outcome variable contained in 
treat 
is the name of the treatment variable contained in

treat_formula 
an object of class "formula" (or one that can be
coerced to that class) that regresses 
data_set 
is a dataframe containing 
n_class 
is the number of classes to split 
treat_mod 
a description of the error distribution to be used in the
model for treatment. Options include: 
link_function 
is either "log", "inverse", or "identity" for the
"Gamma" 
... 
additional arguments to be passed to the treatment regression function 
Value
overlap_fun
returns a list containing the following
elements:
overlap_dataset 
dataframe containing overlapping data. 
median_vec 
a vector containing median values. 
overlap_treat_result 
the resulting treatment fit. 
References
Schafer, J.L., Galagate, D.L. (2015). Causal inference with a continuous treatment and outcome: alternative estimators for parametric doseresponse models. Manuscript in preparation.
Bia, Michela, et al. "A Stata package for the application of semiparametric estimators of dose response functions." Stata Journal 14.3 (2014): 580604.
See Also
iptw_est
, ismw_est
,
reg_est
, aipwee_est
, wtrg_est
,
etc. for other estimates.
t_mod
, overlap_fun
to prepare the data
for use in the different estimates.
Examples
## Example from Schafer (2015).
example_data < sim_data
overlap_list < overlap_fun(Y = Y,
treat = T,
treat_formula = T ~ B.1 + B.2 + B.3 + B.4 + B.5 + B.6 + B.7 + B.8,
data_set = example_data,
n_class = 3,
treat_mod = "Normal")
overlapped_data < overlap_list$overlap_dataset
summary(overlapped_data)
rm(example_data, overlap_list, overlapped_data)