API Reference

Models

DoubleMLPLR

Partially Linear Regression model.

DoubleML.DoubleMLPLRType
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 learner
  • M<:Supervised: Type of ml_m learner
  • G: Type of ml_g learner (Union{Supervised, Nothing})

Fields

  • data::DoubleMLData{T}: Data container
  • ml_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 folds
  • n_rep::Int: Number of sample splitting repetitions
  • score_obj::AbstractScore: Score function type
  • n_folds_tune::Int: Folds for tuning (0 = full sample)
  • coef::T: Estimated treatment effect
  • se::T: Standard error
  • all_coef::Vector{T}: Coefficient estimates for each repetition
  • all_se::Vector{T}: Standard errors for each repetition
  • all_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 performed
  • boot_t_stat::Array{T, 3}: Bootstrap t-statistics (nrepboot × ncoefs × nrep)
  • boot_method::Union{AbstractBootstrapMethod, Symbol, Nothing}: Bootstrap method used
  • n_rep_boot::Int: Number of bootstrap replications
  • fitted_learners_l::Vector{MLJ.Machine}: Fitted machines for ml_l
  • fitted_learners_m::Vector{MLJ.Machine}: Fitted machines for ml_m
  • fitted_learners_g::Vector{MLJ.Machine}: Fitted machines for ml_g
  • learner_performance::NamedTuple: Performance metrics
source

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)
ParameterDescription
dataDoubleMLData container
ml_lMLJ regressor for E[Y|X]
ml_mMLJ model for E[D|X]
ml_gMLJ regressor for E[Y-D·θ|X] (IV-type only)
n_foldsCross-fitting folds (default: 5)
n_repSample 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.

source
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.

source
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 level
  • force::Bool=false: Force refit if already fitted
  • rng::AbstractRNG=Random.default_rng(): Random number generator for sample splitting
source

DoubleMLIRM

Interactive Regression Model for binary treatments.

DoubleML.DoubleMLIRMType
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 learner
  • M<:Supervised: Type of ml_m learner

Fields

  • data::DoubleMLData{T}: Data container
  • ml_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 folds
  • n_rep::Int: Number of sample splitting repetitions
  • score_obj::AbstractScore: Score function type (ATEScore or ATTEScore)
  • normalize_ipw::Bool: Whether to normalize IPW weights
  • clipping_threshold::T: Threshold for propensity score clipping
  • n_folds_tune::Int: Folds for tuning (0 = full sample)
  • coef::T: Estimated treatment effect
  • se::T: Standard error
  • all_coef::Vector{T}: Coefficient estimates for each repetition
  • all_se::Vector{T}: Standard errors for each repetition
  • all_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 performed
  • boot_t_stat::Array{T, 3}: Bootstrap t-statistics (nrepboot × ncoefs × nrep)
  • boot_method::Union{AbstractBootstrapMethod, Symbol, Nothing}: Bootstrap method used
  • n_rep_boot::Int: Number of bootstrap replications
  • fitted_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 score
  • learner_performance::NamedTuple: Performance metrics
source

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)
ParameterDescription
dataDoubleMLData container (binary treatment)
ml_gMLJ regressor for E[Y|X,D]
ml_mMLJ classifier for P(D=1|X)
n_foldsCross-fitting folds (default: 5)
score:ATE or :ATTE
normalize_ipwHajek normalization (default: false)
clipping_thresholdPropensity 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.

source
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.

source
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 level
  • force::Bool=false: Force refit if already fitted
  • rng::AbstractRNG=Random.default_rng(): Random number generator for sample splitting
source

DoubleMLLPLR

⚠️ Experimental - Logistic Partially Linear Regression for binary outcomes.

DoubleML.DoubleMLLPLRType
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 learner
  • Ma<:Supervised: Type of ml_a learner

Fields

  • data::DoubleMLData{T}: Data container
  • ml_M::M: Model for M(D,X) = P(Y=1 | D, X) - probabilistic classifier
  • ml_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 folds
  • n_folds_inner::Int: Number of inner folds for preliminary estimation
  • n_rep::Int: Number of sample splitting repetitions
  • score_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 error
  • all_coef::Vector{T}: Coefficient estimates for each repetition
  • all_se::Vector{T}: Standard errors for each repetition
  • coef_start_val::T: Preliminary estimate used as starting value
  • all_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 performed
  • boot_t_stat::Array{T, 3}: Bootstrap t-statistics (nrepboot × ncoefs × nrep)
  • boot_method::Union{AbstractBootstrapMethod, Symbol, Nothing}: Bootstrap method used
  • n_rep_boot::Int: Number of bootstrap replications
  • fitted_learners_M::Vector{MLJ.Machine}: Fitted machines for ml_M
  • fitted_learners_t::Vector{MLJ.Machine}: Fitted machines for ml_t
  • fitted_learners_m::Vector{MLJ.Machine}: Fitted machines for ml_m
  • fitted_learners_a::Vector{MLJ.Machine}: Fitted machines for ml_a
  • learner_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
source

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)
ParameterDescription
dataDoubleMLData container (binary outcome required)
ml_MMLJ classifier for P(Y=1|D,X)
ml_tMLJ regressor for E[logit(M)|X]
ml_mMLJ regressor for nuisance estimation
ml_aOptional 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.

source
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.

source
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 level
  • force::Bool=false: Force refit if already fitted
  • rng::AbstractRNG=Random.default_rng(): Random number generator for sample splitting
source

Data

DoubleML.DoubleMLDataType
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 variable
  • d::D: Treatment variable (preserves original type for MLJ compatibility)
  • x::Matrix{T}: Covariate matrix (nobs × dimx)
  • n_obs::Int: Number of observations
  • dim_x::Int: Number of covariates
  • y_col::Symbol: Name of outcome variable
  • d_col::Symbol: Name of treatment variable
  • x_cols::Vector{Symbol}: Names of covariate columns
source
DoubleML.make_plr_CCDDHNR2018Function
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_3
  • m(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 generate
  • dim_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 term
  • a_1::Real=0.25: Parameter for treatment equation nonlinear term
  • b_0::Real=1.0: Parameter for outcome equation nonlinear term
  • b_1::Real=0.25: Parameter for outcome equation linear term
  • s_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 (:DoubleMLData or :DataFrame)
  • rng::Union{AbstractRNG, Nothing}=nothing: Random number generator (uses global RNG if nothing)

Returns

  • DoubleMLData object if return_type=:DoubleMLData (default)
  • DataFrame if return_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

source
DoubleML.make_irm_dataFunction
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) with Sigma_kj = 0.5^|j-k| (covariates with Toeplitz covariance)
  • beta_j = 1/j^2 for 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 generate
  • dim_x::Int=20: Number of covariates (dimension of X)
  • theta::Real=0.0: True treatment effect parameter
  • R2_d::Real=0.5: The value of the parameter R²_d
  • R2_y::Real=0.5: The value of the parameter R²_y
  • return_type::Symbol=:DoubleMLData: Output format (:DoubleMLData or :DataFrame)
  • rng::Union{AbstractRNG, Nothing}=nothing: Random number generator (uses global RNG if nothing)

Returns

  • DoubleMLData object if return_type=:DoubleMLData (default)
  • DataFrame if return_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

source
DoubleML.make_lplr_LZZ2020Function
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 generate
  • dim_x::Int=20: Number of covariates
  • alpha::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 (:DoubleMLData or :DataFrame)
  • rng::Union{AbstractRNG, Nothing}=nothing: Random number generator

Returns

  • DoubleMLData object if return_type=:DoubleMLData (default)
  • DataFrame if return_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(x
    5>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

source

Data access: data.y, data.d, data.x, data.n_obs, data.dim_x

Inference

StatsAPI.coefMethod
coef(obj::AbstractDoubleML) -> Vector{Float64}

Return the estimated coefficient(s) from the fitted model.

Returns a vector with the treatment effect estimate.

source
StatsAPI.stderrorMethod
stderror(obj::AbstractDoubleML) -> Vector{Float64}

Return the standard error(s) of the estimated coefficient(s).

source
StatsAPI.confintMethod
confint(obj::AbstractDoubleML; joint::Bool=false, level::Real=0.95)

Compute confidence intervals for the estimated coefficient(s).

Arguments

  • obj: Fitted DoubleML model
  • joint::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

  • DomainError if level <= 0 or level >= 1
source
StatsAPI.vcovMethod
vcov(obj::AbstractDoubleML) -> Matrix{Float64}

Return the variance-covariance matrix of the estimated coefficient(s).

source
StatsAPI.nobsMethod
nobs(obj::AbstractDoubleML) -> Int

Return the number of observations in the data.

source
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 model
  • n_rep_boot::Int=1000: Number of bootstrap replications
  • method: Bootstrap method - NormalBootstrap(), WildBootstrap(), BayesBootstrap(), or a Symbol (:normal, :wild, :Bayes)
  • rng::AbstractRNG: Random number generator
source

Score Functions

DoubleML.AbstractScoreType
AbstractScore

Abstract 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.

source
DoubleML.PartiallingOutScoreType
PartiallingOutScore <: AbstractScore

Score 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))$

source
DoubleML.IVTypeScoreType
IVTypeScore <: AbstractScore

IV-type score for Partially Linear Regression.

The score is: $\psi(W; \theta, \eta) = (Y - g(X) - \theta \cdot D) \cdot (D - m(X))$

source
DoubleML.ATEScoreType
ATEScore <: AbstractScore

Score function for Average Treatment Effect in Interactive Regression Models.

Uses doubly robust AIPW estimator.

source
DoubleML.ATTEScoreType
ATTEScore <: AbstractScore

Score function for Average Treatment Effect on the Treated.

Focuses on treated population only.

source
DoubleML.NuisanceSpaceScoreType
NuisanceSpaceScore <: AbstractScore

Score 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
source
DoubleML.InstrumentScoreType
InstrumentScore <: AbstractScore

Score 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
source
DoubleML.dml2_solveFunction
dml2_solve(psi_a::AbstractVector, psi_b::AbstractVector)

Solve for $\theta$ using DML2 estimator: $\hat{\theta}$ = -mean(psib) / mean(psia)

source

Utilities

DoubleML.draw_sample_splittingFunction
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).

source
DoubleML.get_conditional_sample_splittingFunction
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).

source
MLJModelInterface.fitted_paramsMethod
fitted_params(dml::DoubleMLPLR) -> NamedTuple

Return fitted parameters from nuisance models.

For partialling out score: returns (mll, mlm) For IV-type score: returns (mll, mlm, ml_g)

source
MLJModelInterface.fitted_paramsMethod
fitted_params(dml::DoubleMLIRM) -> NamedTuple

Return fitted parameters from nuisance models.

Returns (mlg0, mlg1, mlm) where mlg1 is empty for ATTE score.

source

Additional Functions

DoubleML.multiplier_bootstrapFunction
multiplier_bootstrap(psi, psi_a, n_rep_boot=1000; method=NormalBootstrap(), rng)

Perform multiplier bootstrap for inference.

Returns

Vector of bootstrap t-statistics.

source
DoubleML.dtypeFunction
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.

source
DoubleML.to_numericFunction
to_numeric(d::AbstractVector)

Convert treatment vector to numeric for arithmetic operations. Type-stable via dispatch.

source
DoubleML.compute_scoreFunction
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})$
source
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})$
source
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
source
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
source
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)

source
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)

source

StatsAPI Methods

All models implement:

  • coef(model) - Treatment effect(s)
  • stderror(model) - Standard error(s)
  • confint(model) - Confidence intervals
  • vcov(model) - Variance-covariance matrix
  • nobs(model) - Number of observations
  • coeftable(model) - Formatted summary table
  • dof(model) - Degrees of freedom
  • dof_residual(model) - Residual degrees of freedom