wtrg_est {causaldrf} | R Documentation |
The weighted regression estimator
Description
This method uses weight matrices to estimate parameters for an ADRF with quadratic or linear fits.
Usage
wtrg_est(Y,
treat,
covar_formula,
data,
e_treat_1,
e_treat_2,
e_treat_3,
e_treat_4,
degree)
Arguments
Y |
is the output |
treat |
is the treatment variable |
covar_formula |
is the formula for the covariates model of the form: ~ X.1 + .... |
data |
will contain all the data: X, treat, and Y |
e_treat_1 |
is estimated treatment |
e_treat_2 |
is estimated treatment squared |
e_treat_3 |
is estimated treatment cubed |
e_treat_4 |
is estimated treatment to the fourth |
degree |
is 1 for linear fit and 2 for quadratic fit |
Details
This function estimates the ADRF by the method described in Schafer and Galagate (2015) which uses weight matrices to adjust for possible bias.
Value
wtrg_est
returns an object of class "causaldrf",
a list that contains the following components:
param |
the estimated parameters. |
call |
the matched call. |
References
Schafer, J.L., Galagate, D.L. (2015). Causal inference with a continuous treatment and outcome: alternative estimators for parametric dose-response models. Manuscript in preparation.
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
t_mod_list <- t_mod(treat = T,
treat_formula = T ~ B.1 + B.2 + B.3 + B.4 + B.5 + B.6 + B.7 + B.8,
data = example_data,
treat_mod = "Normal")
cond_exp_data <- t_mod_list$T_data
full_data <- cbind(example_data, cond_exp_data)
wtrg_list <- wtrg_est(Y = Y,
treat = T,
covar_formula = ~ B.1 + B.2 + B.3 + B.4 + B.5 + B.6 + B.7 + B.8,
data = example_data,
e_treat_1 = full_data$est_treat,
e_treat_2 = full_data$est_treat_sq,
e_treat_3 = full_data$est_treat_cube,
e_treat_4 = full_data$est_treat_quartic,
degree = 1)
sample_index <- sample(1:1000, 100)
plot(example_data$T[sample_index],
example_data$Y[sample_index],
xlab = "T",
ylab = "Y",
main = "weighted regression estimate")
abline(wtrg_list$param[1],
wtrg_list$param[2],
lty = 2,
lwd = 2,
col = "blue")
legend('bottomright',
"weighted regression estimate",
lty = 2,
lwd = 2,
col = "blue",
bty='Y',
cex=1)
rm(example_data, t_mod_list, cond_exp_data, full_data, wtrg_list, sample_index)