*! version 30aug2024

help ddml crossfit, ddml estimate v1.4.4

ddml crossfit and estimate 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 crossfit implements the cross-fitting algorithm.
Each learner is fitted iteratively on training folds and out-of-sample predicted values are obtained.

ddml estimate estimates the model using the conditional expectations obtained from the cross-fitting step.

Before cross-fitting, the model must be defined using ddml init and the learners specified using ddml eq.

See the help for ddml stacking for a detailed discussion and examples of stacking with ddml.

Syntax

ddml crossfit [ , mname(name) shortstack poolstack NOSTDstack finalest(name) ]

ddml estimate [ , mname(name) robust cluster(varname) vce(type)
atet ateu trim(real)
mname(name) shortstack poolstack stdstack finalest(name) ]

Replay options (available after model estimation):

ddml estimate [ , mname(name) spec(integer or string) rep(integer or string) allcombos notable replay ]

Using a user-specified combination of ddml crossfit conditional expectations (models partial, partialiv, fiv):

ddml estimate , y(varname) d(varlist) [ z(varlist) dh(varname) foldvar(varname) mname(name) robust cluster(varname) vce(type) ]

Using a user-specified combination of ddml crossfit conditional expectations (models interactive, interactiviv):

ddml estimate , y0(varname) y1(varname) [ d(varname) d0(varname) d1(varname) z(varname) mname(name) robust cluster(varname) vce(type) ]

Cross-fitting

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

shortstack asks for short-stacking to be used.
Short-stacking uses the
cross-fitted predicted values to obtain a weighted average
of the multiple base learners.
It is computationally faster (often much faster) than standard stacking
(implemented via pystacked) is used to specify the base learners

poolstack is available as an alternative to standard stacking
when pystacked is used to specify the base learners.
Pooled-stacking adds additional regularization
by obtaining a single set of stacking weights
from the full set of out-of-sample base learner predicted values
(in contrast to pystacked, which stacks each cross-fit fold separately).

nostdstack is used in conjunction with short-stacking and pystacked.
It tells pystacked to generate the base learner predictions without
the computationally-expensive additional step of obtaining the stacking weights.
This option should be used if short-stacking is the only stacking method needed.

finalest(name) sets the final estimator for all stacking methods;
the default is the pystacked default of non-negative nonlinear least squares.
See pystacked for alternative stacking final estimators.
NB: use of this option is incompatible with use of the finalest(.) option
when pystacked is the learner specified in an equation using ddml eq;
use finalest in one or the other, or neither (the default), but not both.

Estimation

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

robust
report SEs that are robust to the
presence of arbitrary heteroskedasticity.

cluster(varname)
select cluster-robust variance-covariance estimator, e.g. vce(hc3) or vce(cluster id).

vce(type)
select variance-covariance estimator; see here.

noconstant
suppress constant term (partial, iv, fiv models only). Since the residualized outcome
and treatment may not be exactly mean-zero in finite samples, ddml includes the constant by
default in the estimation stage of partially linear models.

showconstant
display constant term in summary estimation output table (partial, iv, fiv models only).

atet
report average treatment effect of the treated (default is ATE).

ateu
report average treatment effect of the untreated (default is ATE).

trim(real)
trimming of propensity scores for the Interactive and Interactive IV models. The default is 0.01
(that is, values below 0.01 and above 0.99 are set
to 0.01 and 0.99, respectively).

shortstack requests re-stacking of the short-stacking results
using the final estimator specified with finalest(.);
this option is available only if pystacked is the single learner for each equation.
Re-stacking is fast because it doesn't require re-cross-fitting.

poolstack requests re-stacking of the pooled stacking results
using the final estimator specified with finalest(.);
this option is available only if pystacked is the single learner for each equation.
Re-stacking is fast because it doesn't require re-cross-fitting.

stdstack requests re-stacking of the standard stacking results
using the final estimator specified with finalest(.);
this option is available only if pystacked is the single learner for each equation.
Re-stacking is fast because it doesn't require re-cross-fitting.

finalest(name) sets the final estimator for all stacking methods;
the default is the pystacked default of non-negative nonlinear least squares.
See pystacked for alternative stacking final estimators.

Replay

spec(integer/string)
select specification. This can either be the specification number,
mse for minimum-MSE specification (the default with non-pystacked multiple learners),
or st, ss or ps for standard stacking (via pystacked), short-stacking or pooled stacking, respectively.

rep(integer/string)
select resampling iteration. This can either be the cross-fit repetition number, mn for mean aggregation or md for median aggregation (the default).

allcombos
estimates all possible specifications. By default, only the min-MSE, short-stacking or or pooled-stacking
specification is estimated and displayed.

replay
used in combination with spec() and rep() to display and return estimation results.

User-specified vars

y(varname)
estimated conditional expectation of dependent variable (models partial, partialiv, fiv)

d(varname)
estimated conditional expectation of causal variable of interest (models partial, partialiv, fiv)

z(varname)
estimated conditional expectation of instrumental variables (models partialiv, interactiv)

dh(varname)
estimated optimal IV = E[D|X,Z] - E[D^|X] (model fiv only)

y0(varname)
estimated E[Y|X,D=0] (model interactive) or E[Y|X,Z=0] (model interactiveiv)

y1(varname)
estimated E[Y|X,D=1] (model interactive) or E[Y|X,Z=1] (model interactiveiv)

d0(varname)
estimated E[D|X,Z=0] (model interactiveiv)

d1(varname)
estimated E[D|X,Z=1] (model interactiveiv)

foldvar(varname)
cross-fit fold ID variable; required with interactive model and ATET or ATEU