Types¶
The public functions in idid use a small set of type aliases and typed-dict
configuration objects. They are documented here directly instead of being
re-exported from the top-level package.
Type Aliases¶
- idid._types.Control¶
Control-group rule accepted by
idid.estimate().Allowed values:
"never": use the never-exposed cohort, coded asE = 0."notyet": use units not yet exposed by timetas controls.
- idid._types.Method¶
Cell-level estimation method accepted by
idid.estimate().Allowed values:
"dr": doubly robust estimation."dml": double machine learning."reg": outcome regression."ipw": inverse-probability weighting."std_ipw": standardized inverse-probability weighting.
- idid._types.AggMethod¶
Aggregation method accepted by
idid.agg_latt().Allowed values:
"simple": aggregate all post-exposure LATTs."group"/"cohort": aggregate by exposure cohort."cohort_custom": aggregate using a user-supplied cohort grouping."calendar": aggregate by calendar time."calendar_cumu": cumulative calendar-time aggregation."dynamic": aggregate by event-time horizon."dynamic_bal": balanced dynamic aggregation.
- idid._types.FloatArray¶
Floating-point NumPy array type used in lower-level estimator and nuisance model interfaces.
Configuration Objects¶
- class idid._types.OutcomeModel[source]¶
Protocol for outcome nuisance models used by the DML estimators.
Required methods:
fit(X, y)predict(X)
- class idid._types.TreatmentModel[source]¶
Protocol for treatment / propensity nuisance models used by the DML estimators.
Required methods:
fit(X, y)predict_proba(X)
- class idid._types.OutcomeRegressionKwargs[source]¶
Bases:
typing.TypedDictKwargs passed to outcome-regression-style nuisance estimators.
ns_est: Nuisance estimator used for the outcome regression step. In the panel case this can be used for either E[Δ_{t-e+1}Y_t | X, E=0] directly or, when
use_levels=True, for separate models of E[Y_t | X, E=0] and E[Y_{e-1} | X, E=0].use_levels: If True, estimate post and pre outcome levels separately and take their difference. If False, estimate the change outcome directly.
- ns_est: idid._types.NuisanceEstimator¶
- class idid._types.DMLKwargs[source]¶
Bases:
typing.TypedDictKwargs passed to the DML LATT estimators.
nfolds: Number of folds used for cross-fitting. Set to 1 to disable cross-fitting and recover the estimating-equation version.
m_m: Outcome nuisance model.
g_m: Treatment nuisance model.
p_m: Propensity model for P(E_e = 1 | X, E_e + C = 1).
- m_m: OutcomeModel¶
- g_m: TreatmentModel¶
- p_m: TreatmentModel¶