*! version 30aug2024

help ddml init, ddml eq, ddml sample v1.4.4

ddml init, eq and sample commands for Double Debiased Machine Learning

ddml implements algorithms for causal inference aided by supervised
machine learning as proposed in
Double/debiased machine learning for treatment and structural parameters
(Econometrics Journal, 2018). Five different models are supported, allowing for
binary or continuous treatment variables and endogeneity, high-dimensional
controls and/or instrumental variables.

ddml init model initializes the model,
where model is either partial, iv, interactive, fiv, or interactiveiv.

ddml eq: command adds supervised ML programs for estimating conditional expectations,
where eq is the conditional expectation to be estimated (e.g., E[Y|X])
and command is a supported supervised ML program.

ddml sample adds cross-fitting repetitions to an existing and possibly already-estimated model.

Syntax

ddml init
model [if] [in]
[ , mname(name)
prefix
kfolds(integer)
fcluster(varname)
foldvar(varlist)
reps(integer)
norandom
tabfold
vars(varlist) ]

where model is either partial, iv, interactive, fiv, interactiveiv.

ddml eq
[ , mname(name)
vname(varname)
learner(varname)
vtype(string)
predopt(string) ] :
command depvar vars [ , cmdopt ]

where, depending on model chosen in Step 1,
eq is either
E[Y|X] E[Y|D,X] E[Y|X,Z] E[D|X] E[D|X,Z] E[Z|X].
command is a supported supervised ML program (e.g. pystacked or cvlasso).

Note: Options before ":" and after the first comma refer to ddml.
Options that come after ":" and the final comma refer to the estimation command.

ddml sample [ , append[(integer)] foldvar(varlist) ]

adds cross-fitting repetitions to an existing and possibly already-estimated model,
where the additional repetitions is indicated either by append(#)
or by append and the cross-fit fold identifiers in foldvar(varlist).

init options

mname(name)
name of the DDML model. Allows to run multiple DDML
models simultaneously. Defaults to m0.

prefix
tells ddml to prefix the names of all created variables
with name of the DDML model.
Default is to prefix only the created sample and fold ID variables.

kfolds(integer)
number of cross-fitting folds. The default is 5.

fcluster(varname)
cluster identifiers for cluster randomization of random folds.

foldvar(varlist)
integer variable with user-specified cross-fitting folds (one per cross-fitting repetition).

norandom
use observations in existing order instead of randomizing before splitting into folds;
if multiple resamples, applies to first resample only;
ignored if user-defined fold variables are provided in foldvar(varlist).

reps(integer)
cross-fitting repetitions, i.e., how often the cross-fitting procedure is
repeated on randomly generated folds.

tabfold
prints a table with frequency of observations by fold.

vars(varlist)
tells ddml that the variables in varlist are used in the estimation.
Useful if you want the fold split to take account of
observations dropped because of missing values.

equation options

mname(name)
name of the DDML model. Defaults to m0.

vname(varname)
name of the dependent variable in the reduced form estimation.
This is usually inferred from the command line but is mandatory
for the fiv model.

learner(varname)
optional name of the variable to be created.

vtype(string)
(rarely used) optional variable type of the variable to be created. Defaults to double.
none can be used to leave the type field blank
(required when using ddml with rforest.)

predopt(string)
(rarely used) predict option to be used to get predicted values.
Typical values could be xb or pr. Default is
blank.

sample options

mname(name)
name of the DDML model. Defaults to m0.

append(#)
number of additional resamples to cross-fit.

append
when no number of resamples to append is provided, this is based on the list fold IDs in foldvar(varlist).

foldvar(varlist)
integer variable with user-specified cross-fitting folds (one per cross-fitting repetition).