Wrapper for Double machine learning data-backend initialization from data.frame.
Source:R/double_ml_data.R
double_ml_data_from_data_frame.Rd
Initalization of DoubleMLData from data.frame
.
Usage
double_ml_data_from_data_frame(
df,
x_cols = NULL,
y_col = NULL,
d_cols = NULL,
z_cols = NULL,
cluster_cols = NULL,
use_other_treat_as_covariate = TRUE
)
Arguments
- df
(
data.frame()
)
Data object.- x_cols
(
NULL
,character()
)
The covariates. IfNULL
, all variables (columns ofdata
) which are neither specified as outcome variabley_col
, nor as treatment variablesd_cols
, nor as instrumental variablesz_cols
are used as covariates. Default isNULL
.- y_col
(
character(1)
)
The outcome variable.- d_cols
(
character()
)
The treatment variable(s).- z_cols
(
NULL
,character()
)
The instrumental variables. Default isNULL
.- cluster_cols
(
NULL
,character()
)
The cluster variables. Default isNULL
.- use_other_treat_as_covariate
(
logical(1)
)
Indicates whether in the multiple-treatment case the other treatment variables should be added as covariates. Default isTRUE
.
Examples
df = make_plr_CCDDHNR2018(return_type = "data.frame")
x_names = names(df)[grepl("X", names(df))]
obj_dml_data = double_ml_data_from_data_frame(
df = df, x_cols = x_names,
y_col = "y", d_cols = "d")
# Input: Data frame, Output: DoubleMLData object