Description Usage Arguments Value References Examples
Implements the Double Machine Learning approach (Chernozhukov et al., 2018), which constructs estimates for low-dimensional target parameters in the presence of high-dimensional nuisance parameters.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
f |
an object of class formula representing the model to be fitted. |
d |
a dataframe containing the variables in |
model |
model type or list of user created moment functions.
The following model types are implementable:
The default is |
n |
number of times to repeat the sample splitting and take median of
results over the |
k |
number of folds for cross-fitting |
score |
takes either value |
workers |
number of workers to use in running the n dml calculations in
parallel. Default is |
drop_na |
if |
family |
if |
poly_degree |
degree of polynomial for the nuisance parameters,
to be used when |
lambda |
user supplied regularization parameter used when |
args |
list of additional arguments to be passed to cv.glmnet
or regression_forest (depending on the value for |
dml
returns an object of class "dml" with the following components:
a named vector of coefficients.
variance-covariance matrix of the main parameters.
number of observations used
original function call with given arguments
V. Chernozhukov, D. Chetverikov, M. Demirer, E. Duflo, C. Hansen, W. Newey, and J. Robins. Double/debiased machine learning for treatment and structural parameters.The Econometrics Journal, 21(1):C1–C68, 2018a.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | # Effect of temperature and precipitation on corn yield in the presence of
# time and locational effects
data(corn_yield)
library(magrittr)
dml_yield <-
"logcornyield ~ lower + higher + prec_lo + prec_hi | year + fips" %>%
as.formula() %>%
dml(corn_yield, "linear", n = 5, ml = "lasso", poly_degree = 3, score = "finite")
# use the modelsummary package to export regression tables
library(modelsummary)
modelsummary(list("Lasso" = dml_yield), fmt = 5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.