API Reference
Models
DoubleMLPLR
Partially Linear Regression model.
DoubleML.DoubleMLPLR — Type
DoubleMLPLR{T<:AbstractFloat, L<:Supervised, M<:Supervised, G} <: AbstractDoubleML{T}Double Machine Learning for Partially Linear Regression models.
Implements: Y = $\theta$·D + g(X) + ε
Type Parameters
T<:AbstractFloat: Numeric type (inferred from data)L<:Supervised: Type of ml_l learnerM<:Supervised: Type of ml_m learnerG: Type of ml_g learner (Union{Supervised, Nothing})
Fields
data::DoubleMLData{T}: Data containerml_l::L: Model for l(X) = E[Y|X]ml_m::M: Model for m(X) = E[D|X]ml_g::G: Model for g(X) = E[Y - D·$\theta$|X] (IV-type only)n_folds::Int: Number of cross-fitting foldsn_rep::Int: Number of sample splitting repetitionsscore_obj::AbstractScore: Score function typen_folds_tune::Int: Folds for tuning (0 = full sample)coef::T: Estimated treatment effectse::T: Standard errorall_coef::Vector{T}: Coefficient estimates for each repetitionall_se::Vector{T}: Standard errors for each repetitionall_psi::Matrix{T}: Influence function values (nobs × nrep)all_psi_a::Matrix{T}: Score coefficient component (nobs × nrep)all_psi_b::Matrix{T}: Score constant component (nobs × nrep)has_bootstrapped::Bool: Whether bootstrap has been performedboot_t_stat::Array{T, 3}: Bootstrap t-statistics (nrepboot × ncoefs × nrep)boot_method::Union{AbstractBootstrapMethod, Symbol, Nothing}: Bootstrap method usedn_rep_boot::Int: Number of bootstrap replicationsfitted_learners_l::Vector{MLJ.Machine}: Fitted machines for ml_lfitted_learners_m::Vector{MLJ.Machine}: Fitted machines for ml_mfitted_learners_g::Vector{MLJ.Machine}: Fitted machines for ml_glearner_performance::NamedTuple: Performance metrics
Constructor:
DoubleMLPLR(data, ml_l, ml_m; ml_g=nothing, n_folds=5, n_rep=1, score=:partialling_out, n_folds_tune=0, T=Float64)| Parameter | Description |
|---|---|
data | DoubleMLData container |
ml_l | MLJ regressor for E[Y|X] |
ml_m | MLJ model for E[D|X] |
ml_g | MLJ regressor for E[Y-D·θ|X] (IV-type only) |
n_folds | Cross-fitting folds (default: 5) |
n_rep | Sample splitting repetitions (default: 1) |
score | :partialling_out or :IV_type |
Methods:
StatsAPI.fit! — Method
fit!(obj::DoubleMLPLR; verbose=0, max_iter=1, tol=1e-4, force=false, rng=Random.default_rng())Fit the DoubleML PLR model using cross-fitting.
The rng keyword controls sample splitting only. Randomness internal to the MLJ learners is configured on the learners themselves.
fit!(obj::DoubleMLIRM; verbose=0, force=false, rng=Random.default_rng())Fit the DoubleML IRM model using cross-fitting.
The rng keyword controls sample splitting only. Randomness internal to the MLJ learners is configured on the learners themselves.
fit!(obj::DoubleMLLPLR; verbose=0, force=false, rng=Random.default_rng())Fit the DoubleML LPLR model using double cross-fitting with bracket-based root finding.
Arguments
verbose::Int=0: Verbosity levelforce::Bool=false: Force refit if already fittedrng::AbstractRNG=Random.default_rng(): Random number generator for sample splitting
DoubleML.learner_l — Method
learner_l(dml::DoubleMLPLR)Return the ml_l learner.
DoubleML.learner_m — Method
learner_m(dml::DoubleMLPLR)Return the ml_m learner.
StatsAPI.isfitted — Method
isfitted(obj::AbstractDoubleML) -> BoolCheck if the model has been fitted.
DoubleMLIRM
Interactive Regression Model for binary treatments.
DoubleML.DoubleMLIRM — Type
DoubleMLIRM{T<:AbstractFloat, G<:Supervised, M<:Supervised} <: AbstractDoubleML{T}Double Machine Learning for Interactive Regression Models.
Implements: Y = g_0(D, X) + $\zeta$, where D is binary.
Type Parameters
T<:AbstractFloat: Numeric type (inferred from data)G<:Supervised: Type of ml_g learnerM<:Supervised: Type of ml_m learner
Fields
data::DoubleMLData{T}: Data containerml_g::G: Model for g(X, D) = E[Y|X, D]ml_m::M: Model for m(X) = E[D|X] (propensity score)n_folds::Int: Number of cross-fitting foldsn_rep::Int: Number of sample splitting repetitionsscore_obj::AbstractScore: Score function type (ATEScore or ATTEScore)normalize_ipw::Bool: Whether to normalize IPW weightsclipping_threshold::T: Threshold for propensity score clippingn_folds_tune::Int: Folds for tuning (0 = full sample)coef::T: Estimated treatment effectse::T: Standard errorall_coef::Vector{T}: Coefficient estimates for each repetitionall_se::Vector{T}: Standard errors for each repetitionall_psi::Matrix{T}: Influence function values (nobs × nrep)all_psi_a::Matrix{T}: Score coefficient component (nobs × nrep)all_psi_b::Matrix{T}: Score constant component (nobs × nrep)has_bootstrapped::Bool: Whether bootstrap has been performedboot_t_stat::Array{T, 3}: Bootstrap t-statistics (nrepboot × ncoefs × nrep)boot_method::Union{AbstractBootstrapMethod, Symbol, Nothing}: Bootstrap method usedn_rep_boot::Int: Number of bootstrap replicationsfitted_learners_g0::Vector{MLJ.Machine}: Fitted machines for control group (D=0)fitted_learners_g1::Vector{MLJ.Machine}: Fitted machines for treated group (D=1)fitted_learners_m::Vector{MLJ.Machine}: Fitted machines for propensity scorelearner_performance::NamedTuple: Performance metrics
Constructor:
DoubleMLIRM(data, ml_g, ml_m; n_folds=5, n_rep=1, score=:ATE, normalize_ipw=false, clipping_threshold=0.01, n_folds_tune=0, T=Float64)| Parameter | Description |
|---|---|
data | DoubleMLData container (binary treatment) |
ml_g | MLJ regressor for E[Y|X,D] |
ml_m | MLJ classifier for P(D=1|X) |
n_folds | Cross-fitting folds (default: 5) |
score | :ATE or :ATTE |
normalize_ipw | Hajek normalization (default: false) |
clipping_threshold | Propensity clip threshold (default: 0.01) |
Methods:
StatsAPI.fit! — Method
fit!(obj::DoubleMLPLR; verbose=0, max_iter=1, tol=1e-4, force=false, rng=Random.default_rng())Fit the DoubleML PLR model using cross-fitting.
The rng keyword controls sample splitting only. Randomness internal to the MLJ learners is configured on the learners themselves.
fit!(obj::DoubleMLIRM; verbose=0, force=false, rng=Random.default_rng())Fit the DoubleML IRM model using cross-fitting.
The rng keyword controls sample splitting only. Randomness internal to the MLJ learners is configured on the learners themselves.
fit!(obj::DoubleMLLPLR; verbose=0, force=false, rng=Random.default_rng())Fit the DoubleML LPLR model using double cross-fitting with bracket-based root finding.
Arguments
verbose::Int=0: Verbosity levelforce::Bool=false: Force refit if already fittedrng::AbstractRNG=Random.default_rng(): Random number generator for sample splitting
DoubleML.learner_g — Method
learner_g(dml::DoubleMLIRM)Return the ml_g learner.
DoubleML.learner_m — Method
learner_m(dml::DoubleMLIRM)Return the ml_m learner.
DoubleMLLPLR
⚠️ Experimental - Logistic Partially Linear Regression for binary outcomes.
DoubleML.DoubleMLLPLR — Type
DoubleMLLPLR{T<:AbstractFloat, M<:Supervised, Tt<:Supervised,
Mm<:Supervised, Ma<:Supervised} <: AbstractDoubleML{T}Double Machine Learning for Logistic Partially Linear Regression.
Implements: E[Y | D, X] = expit{β0·D + r0(X)} where Y ∈ {0, 1}
Type Parameters
T<:AbstractFloat: Numeric type (inferred from data)M<:Supervised: Type of ml_M learner (probabilistic classifier)Tt<:Supervised: Type of ml_t learner (regressor)Mm<:Supervised: Type of ml_m learnerMa<:Supervised: Type of ml_a learner
Fields
data::DoubleMLData{T}: Data containerml_M::M: Model for M(D,X) = P(Y=1 | D, X) - probabilistic classifierml_t::Tt: Model for t(X) = E[logit(M(D,X)) | X]ml_m::Mm: Model for m(X) = E[D | X, Y=0] (nuisance_space) or E[D | X] (instrument)ml_a::Ma: Model for a(X) = E[D | X]n_folds::Int: Number of outer cross-fitting foldsn_folds_inner::Int: Number of inner folds for preliminary estimationn_rep::Int: Number of sample splitting repetitionsscore_obj::AbstractScore: Score function type (NuisanceSpaceScore or InstrumentScore)n_folds_tune::Int: Folds for tuning (0 = full sample)coef::T: Estimated treatment effect (log-odds ratio)se::T: Standard errorall_coef::Vector{T}: Coefficient estimates for each repetitionall_se::Vector{T}: Standard errors for each repetitioncoef_start_val::T: Preliminary estimate used as starting valueall_psi::Matrix{T}: Influence function values (nobs × nrep)all_psi_a::Matrix{T}: Derivative of score (nobs × nrep)all_psi_b::Matrix{T}: Score values at estimated coefficient (nobs × nrep)has_bootstrapped::Bool: Whether bootstrap has been performedboot_t_stat::Array{T, 3}: Bootstrap t-statistics (nrepboot × ncoefs × nrep)boot_method::Union{AbstractBootstrapMethod, Symbol, Nothing}: Bootstrap method usedn_rep_boot::Int: Number of bootstrap replicationsfitted_learners_M::Vector{MLJ.Machine}: Fitted machines for ml_Mfitted_learners_t::Vector{MLJ.Machine}: Fitted machines for ml_tfitted_learners_m::Vector{MLJ.Machine}: Fitted machines for ml_mfitted_learners_a::Vector{MLJ.Machine}: Fitted machines for ml_alearner_performance::NamedTuple: Performance metrics
References
- Liu et al. (2021): Double/debiased machine learning for logistic partially linear models https://doi.org/10.1093/ectj/utab019
Constructor:
DoubleMLLPLR(data, ml_M, ml_t, ml_m; ml_a=nothing, score=:nuisance_space, n_folds=5, n_folds_inner=5, n_rep=1, n_folds_tune=0)| Parameter | Description |
|---|---|
data | DoubleMLData container (binary outcome required) |
ml_M | MLJ classifier for P(Y=1|D,X) |
ml_t | MLJ regressor for E[logit(M)|X] |
ml_m | MLJ regressor for nuisance estimation |
ml_a | Optional regressor for E[D|X] (defaults to ml_m) |
score | :nuisance_space or :instrument |
Methods:
StatsAPI.fit! — Method
fit!(obj::DoubleMLPLR; verbose=0, max_iter=1, tol=1e-4, force=false, rng=Random.default_rng())Fit the DoubleML PLR model using cross-fitting.
The rng keyword controls sample splitting only. Randomness internal to the MLJ learners is configured on the learners themselves.
fit!(obj::DoubleMLIRM; verbose=0, force=false, rng=Random.default_rng())Fit the DoubleML IRM model using cross-fitting.
The rng keyword controls sample splitting only. Randomness internal to the MLJ learners is configured on the learners themselves.
fit!(obj::DoubleMLLPLR; verbose=0, force=false, rng=Random.default_rng())Fit the DoubleML LPLR model using double cross-fitting with bracket-based root finding.
Arguments
verbose::Int=0: Verbosity levelforce::Bool=false: Force refit if already fittedrng::AbstractRNG=Random.default_rng(): Random number generator for sample splitting
DoubleML.learner_M — Method
learner_M(dml::DoubleMLLPLR)Return the ml_M learner.
DoubleML.learner_t — Method
learner_t(dml::DoubleMLLPLR)Return the ml_t learner.
DoubleML.learner_m — Method
learner_m(dml::DoubleMLLPLR)Return the ml_m learner.
DoubleML.learner_a — Method
learner_a(dml::DoubleMLLPLR)Return the ml_a learner.
Data
DoubleML.DoubleMLData — Type
DoubleMLData{T<:AbstractFloat, D<:AbstractVector}Container for data used in Double Machine Learning models.
Stores outcome variable, treatment variable, and covariates. The outcome (y) and covariates (x) are stored as Float32 by default for ML performance.
Type Parameters
T<:AbstractFloat: Numeric type for y and x (Float32 or Float64)D<:AbstractVector: Type for treatment d (preserves CategoricalVector if applicable)
Fields
y::Vector{T}: Outcome variabled::D: Treatment variable (preserves original type for MLJ compatibility)x::Matrix{T}: Covariate matrix (nobs × dimx)n_obs::Int: Number of observationsdim_x::Int: Number of covariatesy_col::Symbol: Name of outcome variabled_col::Symbol: Name of treatment variablex_cols::Vector{Symbol}: Names of covariate columns
DoubleML.make_plr_CCDDHNR2018 — Function
make_plr_CCDDHNR2018(
n_obs;
dim_x=20,
alpha=0.5,
a_0=1.0, a_1=0.25,
b_0=1.0, b_1=0.25,
s_1=1.0, s_2=1.0,
return_type=:DoubleMLData,
rng=nothing
) -> Union{DoubleMLData, DataFrame}Generate synthetic data for a Partially Linear Regression (PLR) model based on Chernozhukov et al. (2018).
This function generates data from the model:
Y = α·D + g(X) + ζ (Outcome equation)
D = m(X) + v (Treatment equation)where:
g(X) = b_0·exp(X_1)/(1 + exp(X_1)) + b_1·X_3m(X) = a_0·X_1 + a_1·exp(X_3)/(1 + exp(X_3))
The covariates X follow a multivariate normal distribution with Toeplitz covariance structure (correlation 0.7^|j-k| between Xj and Xk).
Arguments
n_obs::Int: Number of observations to generatedim_x::Int=20: Number of covariates (dimension of X)alpha::Real=0.5: True treatment effect parameter (α)a_0::Real=1.0: Parameter for treatment equation linear terma_1::Real=0.25: Parameter for treatment equation nonlinear termb_0::Real=1.0: Parameter for outcome equation nonlinear termb_1::Real=0.25: Parameter for outcome equation linear terms_1::Real=1.0: Standard deviation of treatment error (v)s_2::Real=1.0: Standard deviation of outcome error (ζ)return_type::Symbol=:DoubleMLData: Output format (:DoubleMLDataor:DataFrame)rng::Union{AbstractRNG, Nothing}=nothing: Random number generator (uses global RNG if nothing)
Returns
DoubleMLDataobject ifreturn_type=:DoubleMLData(default)DataFrameifreturn_type=:DataFrame
Generated Data Structure
The generated data contains:
y: Outcome variable (Vector{Float32})d: Treatment variable (Vector{Float32})X1,X2, ...,X{dim_x}: Covariates (Float32)
Examples
using DoubleML
# Generate default dataset
data = make_plr_CCDDHNR2018(1000)
# Generate with custom parameters
data = make_plr_CCDDHNR2018(
500,
dim_x=10,
alpha=1.0,
return_type=:DoubleMLData
)
# Get DataFrame instead
df = make_plr_CCDDHNR2018(1000, return_type=:DataFrame)
# Use with specific RNG
using StableRNGs
rng = StableRNG(123)
data = make_plr_CCDDHNR2018(1000, rng=rng)References
Chernozhukov et al. (2018): "Double/Debiased Machine Learning for Treatment and Causal Parameters"
See also: DoubleMLPLR, DoubleMLData
DoubleML.make_irm_data — Function
make_irm_data(
n_obs;
dim_x=20,
theta=0.0,
R2_d=0.5,
R2_y=0.5,
return_type=:DoubleMLData,
rng=nothing
) -> Union{DoubleMLData, DataFrame}Generate synthetic data for an Interactive Regression Model (IRM) based on Belloni et al. (2017).
This function generates data from the model:
d = 1{exp(c_d * X' * beta) / (1 + exp(c_d * X' * beta)) > v} (Treatment)
y = theta * d + c_y * X' * beta * d + zeta (Outcome)where:
v ~ U(0, 1)(uniform error for treatment)zeta ~ N(0, 1)(standard normal error for outcome)X ~ N(0, Sigma)withSigma_kj = 0.5^|j-k|(covariates with Toeplitz covariance)beta_j = 1/j^2for j = 1, ..., dim_x- Constants:
c_y = sqrt(R2_y / ((1 - R2_y) * beta' * Sigma * beta))c_d = sqrt((pi^2 / 3) * R2_d / ((1 - R2_d) * beta' * Sigma * beta))
The data generating process is inspired by the simulation experiment in Appendix P of Belloni et al. (2017).
Arguments
n_obs::Int: Number of observations to generatedim_x::Int=20: Number of covariates (dimension of X)theta::Real=0.0: True treatment effect parameterR2_d::Real=0.5: The value of the parameter R²_dR2_y::Real=0.5: The value of the parameter R²_yreturn_type::Symbol=:DoubleMLData: Output format (:DoubleMLDataor:DataFrame)rng::Union{AbstractRNG, Nothing}=nothing: Random number generator (uses global RNG if nothing)
Returns
DoubleMLDataobject ifreturn_type=:DoubleMLData(default)DataFrameifreturn_type=:DataFrame
Generated Data Structure
The generated data contains:
y: Outcome variable (Vector{Float32})d: Treatment variable (Vector{Float32}, binary 0/1)X1,X2, ...,X{dim_x}: Covariates (Float32)
Examples
using DoubleML
# Generate default dataset
data = make_irm_data(1000)
# Generate with custom parameters
data = make_irm_data(
500,
dim_x=10,
theta=1.0,
R2_d=0.6,
R2_y=0.4,
return_type=:DoubleMLData
)
# Get DataFrame instead
df = make_irm_data(1000, return_type=:DataFrame)
# Use with specific RNG
using StableRNGs
rng = StableRNG(123)
data = make_irm_data(1000, rng=rng)References
Belloni, A., Chernozhukov, V., Fernández-Val, I. and Hansen, C. (2017). "Program Evaluation and Causal Inference With High-Dimensional Data." Econometrica, 85: 233-298.
See also: DoubleMLIRM, DoubleMLData
DoubleML.make_lplr_LZZ2020 — Function
make_lplr_LZZ2020(n_obs; dim_x=20, alpha=0.5, balanced_r0=true,
treatment="continuous", return_type=:DoubleMLData, rng=nothing)Generate synthetic data for a Logistic Partially Linear Regression (LPLR) model, as in Liu et al. (2021).
Arguments
n_obs::Int: Number of observations to generatedim_x::Int=20: Number of covariatesalpha::Real=0.5: Value of the causal parameter (treatment effect on log-odds)balanced_r0::Bool=true: Use balanced r_0 specification (smaller magnitude). If false, uses unbalanced specification with larger share of Y=0.treatment::String="continuous": Treatment type - "continuous", "binary", or "binary_unbalanced"return_type::Symbol=:DoubleMLData: Output format (:DoubleMLDataor:DataFrame)rng::Union{AbstractRNG, Nothing}=nothing: Random number generator
Returns
DoubleMLDataobject ifreturn_type=:DoubleMLData(default)DataFrameifreturn_type=:DataFrame
Data Generating Process
- Covariates: X ~ N(0, Σ) where Σ_kj = 0.2^|j-k|, clipped to [-2, 2]
- Treatment: d = a0(x) (continuous) or d ~ Bernoulli(sigmoid(a0(x)))
- Propensity: p = σ(α·d + r_0(x)) where σ is logistic function
- Outcome: y ~ Bernoulli(p)
Nuisance Functions
a0(x) = ``2/(1+exp(x1)) - 2/(1+exp(x2)) + sin(x3) + cos(x4)
+ 0.5·I(x5>0) - 0.5·I(x6>0) + 0.2·x7·x8 - 0.2·x9·x_{10}``r0(x) = ``0.1·x1·x2·x3 + 0.1·x4·x5 + 0.1·x6^3 - 0.5·sin^2(x7) \ + 0.5·cos(x8) + 1/(1+x9^2) - 1/(1+exp(x{10})) \ + 0.25·I(x{11}>0) - 0.25·I(x_{13}>0)`` (balanced) Or with different coefficients for unbalanced
Examples
using DoubleML
# Generate default dataset
data = make_lplr_LZZ2020(1000)
# Generate with custom parameters
data = make_lplr_LZZ2020(500, dim_x=10, alpha=1.0, treatment="binary")
# Get DataFrame instead
df = make_lplr_LZZ2020(1000, return_type=:DataFrame)
# Use with specific RNG
using StableRNGs
rng = StableRNG(123)
data = make_lplr_LZZ2020(1000, rng=rng)References
Liu, L., Zhang, Y. and Zhou, D. (2021). "Double/Debiased Machine Learning for Logistic Partially Linear Model." The Econometrics Journal, 24(3): 559-588. doi: 10.1093/ectj/utab019
See also: DoubleMLLPLR, DoubleMLData
Data access: data.y, data.d, data.x, data.n_obs, data.dim_x
Inference
StatsAPI.coef — Method
coef(obj::AbstractDoubleML) -> Vector{Float64}Return the estimated coefficient(s) from the fitted model.
Returns a vector with the treatment effect estimate.
StatsAPI.stderror — Method
stderror(obj::AbstractDoubleML) -> Vector{Float64}Return the standard error(s) of the estimated coefficient(s).
StatsAPI.confint — Method
confint(obj::AbstractDoubleML; joint::Bool=false, level::Real=0.95)Compute confidence intervals for the estimated coefficient(s).
Arguments
obj: Fitted DoubleML modeljoint::Bool=false: If true, compute joint confidence intervals (requires bootstrap)level::Real=0.95: Confidence level (default 95%), must be in (0, 1)
Returns
A matrix with two columns: lower and upper bounds of the confidence interval.
Throws
DomainErroriflevel <= 0orlevel >= 1
StatsAPI.vcov — Method
vcov(obj::AbstractDoubleML) -> Matrix{Float64}Return the variance-covariance matrix of the estimated coefficient(s).
StatsAPI.nobs — Method
nobs(obj::AbstractDoubleML) -> IntReturn the number of observations in the data.
DoubleML.bootstrap! — Function
bootstrap!(obj; n_rep_boot=1000, method=NormalBootstrap(), rng)Perform multiplier bootstrap on a fitted DoubleML model.
Uses per-repetition score functions (psi) computed at each repetition's coefficient to properly handle multiple sample splits (n_rep > 1).
Arguments
obj: Fitted DoubleML modeln_rep_boot::Int=1000: Number of bootstrap replicationsmethod: Bootstrap method -NormalBootstrap(),WildBootstrap(),BayesBootstrap(), or a Symbol (:normal,:wild,:Bayes)rng::AbstractRNG: Random number generator
DoubleML.has_bootstrapped — Function
has_bootstrapped(obj) -> BoolCheck if bootstrap has been performed.
Score Functions
DoubleML.AbstractScore — Type
AbstractScoreAbstract base type for score functions in DoubleML models.
Score functions define how the DML estimator computes the estimating equations for different model types and estimands.
DoubleML.PartiallingOutScore — Type
PartiallingOutScore <: AbstractScoreScore function for partialling out in Partially Linear Regression.
The score is: $\psi(W; \theta, \eta) = (Y - l(X) - \theta(D - m(X))) \cdot (D - m(X))$
DoubleML.IVTypeScore — Type
IVTypeScore <: AbstractScoreIV-type score for Partially Linear Regression.
The score is: $\psi(W; \theta, \eta) = (Y - g(X) - \theta \cdot D) \cdot (D - m(X))$
DoubleML.ATEScore — Type
ATEScore <: AbstractScoreScore function for Average Treatment Effect in Interactive Regression Models.
Uses doubly robust AIPW estimator.
DoubleML.ATTEScore — Type
ATTEScore <: AbstractScoreScore function for Average Treatment Effect on the Treated.
Focuses on treated population only.
DoubleML.NuisanceSpaceScore — Type
NuisanceSpaceScore <: AbstractScoreScore function for LPLR using nuisance space estimation.
Computes: $\psi(W, \beta, \eta) = \psi(X){Ye^{(\beta D)} - (1-Y)e^{(r_0(X))}}{D - m_0(X)}$ where $\psi(X) = \text{expit}(-r_0(X))$
References
- Liu et al. (2021): Double/debiased machine learning for logistic partially linear models
DoubleML.InstrumentScore — Type
InstrumentScore <: AbstractScoreScore function for LPLR using instrument approach.
Computes: $\psi(W; \beta, \eta) = {Y - \text{expit}(\beta_0 D + r_0(X))}(D - m(X))$
References
- Liu et al. (2021): Double/debiased machine learning for logistic partially linear models
DoubleML.dml2_solve — Function
dml2_solve(psi_a::AbstractVector, psi_b::AbstractVector)Solve for $\theta$ using DML2 estimator: $\hat{\theta}$ = -mean(psib) / mean(psia)
Utilities
DoubleML.draw_sample_splitting — Function
draw_sample_splitting(n_obs, n_folds, n_rep; shuffle=true, rng)Generate sample splitting indices for cross-fitting.
Returns
Vector of length n_rep, each containing n_folds tuples of (trainidx, testidx).
DoubleML.get_conditional_sample_splitting — Function
get_conditional_sample_splitting(n_obs, n_folds, n_rep, d; shuffle=true, rng)
get_conditional_sample_splitting(all_smpls, d)Create conditional sample splits for control (D=0) and treated (D=1) groups.
Used for IRM where separate models are fit for each treatment group.
Pass existing sample splits to ensure that the conditional and unconditional learners use the same outer folds.
Returns
Vector of length n_rep, each a tuple (smplsd0, smplsd1).
MLJModelInterface.fitted_params — Method
fitted_params(dml::DoubleMLPLR) -> NamedTupleReturn fitted parameters from nuisance models.
For partialling out score: returns (mll, mlm) For IV-type score: returns (mll, mlm, ml_g)
MLJModelInterface.fitted_params — Method
fitted_params(dml::DoubleMLIRM) -> NamedTupleReturn fitted parameters from nuisance models.
Returns (mlg0, mlg1, mlm) where mlg1 is empty for ATTE score.
Additional Functions
DoubleML.multiplier_bootstrap — Function
multiplier_bootstrap(psi, psi_a, n_rep_boot=1000; method=NormalBootstrap(), rng)Perform multiplier bootstrap for inference.
Returns
Vector of bootstrap t-statistics.
DoubleML.summary_stats — Function
summary_stats(obj::AbstractDoubleML; level=0.95)Compute summary statistics as a NamedTuple.
DoubleML.check_binary — Function
check_binary(v::AbstractVector) -> BoolCheck if a variable is binary with values 0 and 1.
DoubleML.dtype — Function
dtype(data::DoubleMLData{T}) where {T} -> Type{T}Return the numeric type used in the data container.
Can be called as a function dtype(data) or as a property data.dtype.
DoubleML.to_numeric — Function
to_numeric(d::AbstractVector)Convert treatment vector to numeric for arithmetic operations. Type-stable via dispatch.
DoubleML.compute_score — Function
compute_score(::PartiallingOutScore, Y_test, D_test, l_hat, m_hat)Compute partialling out score components.
Returns
- $\psi_{a} = -(D - \hat{m})^2$
- $\psi_{b} = (Y - \hat{l}) \cdot (D - \hat{m})$
compute_score(::IVTypeScore, Y_test, D_test, g_hat, m_hat)Compute IV-type score components.
Returns
- $\psi_{a} = -(D - \hat{m}) \cdot D$
- $\psi_{b} = (Y - \hat{g}) \cdot (D - \hat{m})$
compute_score(::ATEScore, Y_test, D_test, g_hat0, g_hat1, m_hat_adj)Compute ATE score components using doubly robust AIPW estimator.
Returns
psi_a = -1(constant)psi_b =\hat{\tau}(X)` + IPW_correction
compute_score(::ATTEScore, Y_test, D_test, g_hat0, g_hat1, m_hat_adj, E_D_global)Compute ATTE score components focusing on treated population.
Returns
psi_a = -D / E[D]psi_b = (D/E[D])·\hat{\tau}+ (\hat{m}/E[D])·IPW_correction
compute_score(::NuisanceSpaceScore, coef, score_elements)Compute score value for given coefficient using dynamic r_hat computation.
Score: $\psi = \hat{\psi} \cdot (Y \cdot \exp(-\text{coef} \cdot D) \cdot d\_\text{tilde} - \text{score\_const})$ where rhat = that - coef * a_hat (computed dynamically)
compute_score(::InstrumentScore, coef, score_elements)Compute score value for given coefficient using dynamic r_hat computation.
Score: $\psi = (Y - \text{expit}(\text{coef} \cdot D + r\_\text{hat})) \cdot d\_\text{tilde}$ where rhat = that - coef * a_hat (computed dynamically)
DoubleML.get_score_name — Function
get_score_name(score::AbstractScore) -> SymbolReturn the symbol name of the score type.
DoubleML.learner_g — Method
learner_g(dml::DoubleMLPLR)Return the ml_g learner (or nothing for partialling out).
StatsAPI Methods
All models implement:
coef(model)- Treatment effect(s)stderror(model)- Standard error(s)confint(model)- Confidence intervalsvcov(model)- Variance-covariance matrixnobs(model)- Number of observationscoeftable(model)- Formatted summary tabledof(model)- Degrees of freedomdof_residual(model)- Residual degrees of freedom