scalar_wts {causaldrf}  R Documentation 
This function calculates scalar weights for use in other models
Description
This function calculates the scalar weights
Usage
scalar_wts(treat,
treat_formula,
numerator_formula,
data,
treat_mod,
link_function,
...)
Arguments
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 
numerator_formula 
an object of class "formula" (or one that can be
coerced to that class) that regresses 
data 
is a dataframe containing 
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 fitting function. 
Value
scalar_wts
returns an object of class "causaldrf_wts",
a list that contains the following components:
param 
summary of estimated weights. 
t_mod 
the result of the treatment model fit. 
num_mod 
the result of the numerator model fit. 
weights 
estimated weights for each unit. 
call 
the matched call. 
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.
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
scalar_wts_list < scalar_wts(treat = T,
treat_formula = T ~ B.1 + B.2 + B.3 + B.4 + B.5 + B.6 + B.7 + B.8,
numerator_formula = T ~ 1,
data = example_data,
treat_mod = "Normal")
sample_index < sample(1:1000, 100)
plot(example_data$T[sample_index],
scalar_wts_list$weights[sample_index],
xlab = "T",
ylab = "weights",
main = "scalar_wts")
rm(example_data, scalar_wts_list, sample_index)