Skip to content

DoubleMLBase

doubleml_pyspark.doubleml_base.DoubleMLBase

Base class for DoubleML classes.

Provides core functionality for Double Machine Learning estimators.

Methods:

Name Description
confint

Confidence intervals for DoubleML models.

sensitivity_analysis

Sensitivity analysis.

Attributes:

Name Type Description
all_coef ndarray

Estimates for each repetition, shape (n_thetas, n_rep). Same as :attr:all_thetas.

all_se ndarray

Standard errors for each repetition, shape (n_thetas, n_rep). Same as :attr:all_ses.

all_ses ndarray

All standard errors across repetitions and folds.

all_thetas ndarray

All estimated parameters across repetitions and folds.

coef ndarray

Estimated causal parameter(s), shape (n_thetas,). Same as :attr:thetas.

data_field_map dict[str, str | list[str]]

The data field map.

id_col str

The id column.

n_rep int

The number of repetitions for cross-validation.

p_val ndarray

The p-values.

pval ndarray

p-value(s), shape (n_thetas,). Same as :attr:p_val.

se ndarray

Standard error(s), shape (n_thetas,). Same as :attr:ses.

sensitivity_params dict[str, Any] | None

The sensitivity parameters.

sensitivity_summary str

Summary for the sensitivity analysis after calling sensitivity_analysis.

sensitivity_var_elements dict[str, ndarray] | None

The sensitivity variance elements.

ses ndarray

The standard errors.

summary DataFrame

Summary of the estimated causal parameter(s) after calling fit().

t_stat ndarray

The t-statistics.

thetas ndarray

The estimated parameters.

var_scaling ndarray

The variance scaling factors.

Attributes

doubleml_pyspark.doubleml_base.DoubleMLBase.all_coef property

all_coef: ndarray

Estimates for each repetition, shape (n_thetas, n_rep). Same as :attr:all_thetas.

doubleml_pyspark.doubleml_base.DoubleMLBase.all_se property

all_se: ndarray

Standard errors for each repetition, shape (n_thetas, n_rep). Same as :attr:all_ses.

doubleml_pyspark.doubleml_base.DoubleMLBase.all_ses property

all_ses: ndarray

All standard errors across repetitions and folds.

Returns:

Type Description
ndarray

Array of shape (n_thetas, n_rep) with all standard errors.

doubleml_pyspark.doubleml_base.DoubleMLBase.all_thetas property

all_thetas: ndarray

All estimated parameters across repetitions and folds.

Returns:

Type Description
ndarray

Array of shape (n_thetas, n_rep) with all estimated parameters.

doubleml_pyspark.doubleml_base.DoubleMLBase.coef property

coef: ndarray

Estimated causal parameter(s), shape (n_thetas,). Same as :attr:thetas.

doubleml_pyspark.doubleml_base.DoubleMLBase.data_field_map property

data_field_map: dict[str, str | list[str]]

The data field map.

Returns:

Type Description
dict of str

The mapping of field names.

doubleml_pyspark.doubleml_base.DoubleMLBase.id_col property

id_col: str

The id column.

Returns:

Type Description
str

The name of the id column.

doubleml_pyspark.doubleml_base.DoubleMLBase.n_rep property

n_rep: int

The number of repetitions for cross-validation.

Returns:

Type Description
int

The number of repetitions.

doubleml_pyspark.doubleml_base.DoubleMLBase.p_val property

p_val: ndarray

The p-values.

Returns:

Type Description
ndarray

Array of shape (n_thetas,) with p-values.

doubleml_pyspark.doubleml_base.DoubleMLBase.pval property

pval: ndarray

p-value(s), shape (n_thetas,). Same as :attr:p_val.

doubleml_pyspark.doubleml_base.DoubleMLBase.se property

se: ndarray

Standard error(s), shape (n_thetas,). Same as :attr:ses.

doubleml_pyspark.doubleml_base.DoubleMLBase.sensitivity_params property

sensitivity_params: dict[str, Any] | None

The sensitivity parameters.

Returns:

Type Description
dict or None

The sensitivity parameters, or None if not set.

doubleml_pyspark.doubleml_base.DoubleMLBase.sensitivity_summary property

sensitivity_summary: str

Summary for the sensitivity analysis after calling sensitivity_analysis.

Returns:

Type Description
str

Summary for the sensitivity analysis.

doubleml_pyspark.doubleml_base.DoubleMLBase.sensitivity_var_elements property

sensitivity_var_elements: dict[str, ndarray] | None

The sensitivity variance elements.

Returns:

Type Description
dict or None

Each element is an array of shape (n_thetas, n_rep), or None if not set.

doubleml_pyspark.doubleml_base.DoubleMLBase.ses property

ses: ndarray

The standard errors.

Returns:

Type Description
ndarray

Array of shape (n_thetas,) with standard errors.

doubleml_pyspark.doubleml_base.DoubleMLBase.summary property

summary: DataFrame

Summary of the estimated causal parameter(s) after calling fit().

Returns:

Type Description
DataFrame

Columns coef, std err, t, P>|t| and the 95 % confidence interval, one row per parameter. Empty before fit().

doubleml_pyspark.doubleml_base.DoubleMLBase.t_stat property

t_stat: ndarray

The t-statistics.

Returns:

Type Description
ndarray

Array of shape (n_thetas,) with t-statistics.

doubleml_pyspark.doubleml_base.DoubleMLBase.thetas property

thetas: ndarray

The estimated parameters.

Returns:

Type Description
ndarray

Array of shape (n_thetas,) with estimated parameters.

doubleml_pyspark.doubleml_base.DoubleMLBase.var_scaling property

var_scaling: ndarray

The variance scaling factors.

Returns:

Type Description
ndarray

Array of shape (n_thetas, n_rep) with variance scaling factors.

Functions

doubleml_pyspark.doubleml_base.DoubleMLBase.confint

confint(joint: bool = False, level: float = 0.95) -> pd.DataFrame

Confidence intervals for DoubleML models.

Parameters:

Name Type Description Default
joint bool

Indicates whether joint confidence intervals are computed. Default is False.

False
level float

The confidence level. Default is 0.95.

0.95

Returns:

Type Description
DataFrame

A data frame with the confidence interval(s).

Raises:

Type Description
TypeError

If input types are incorrect.

ValueError

If confidence level is not in (0, 1).

NotImplementedError

If joint confidence intervals are requested.

doubleml_pyspark.doubleml_base.DoubleMLBase.sensitivity_analysis

sensitivity_analysis(cf_y: float = 0.03, cf_d: float = 0.03, rho: float = 1.0, level: float = 0.95, null_hypothesis: float = 0.0) -> DoubleMLBase

Sensitivity analysis.

Parameters:

Name Type Description Default
cf_y float

Confounding strength for the outcome. Default is 0.03.

0.03
cf_d float

Confounding strength for the treatment. Default is 0.03.

0.03
rho float

Correlation parameter. Default is 1.0.

1.0
level float

Confidence level. Default is 0.95.

0.95
null_hypothesis float

Value for the null hypothesis. Default is 0.0.

0.0

Returns:

Type Description
DoubleMLBase

The fitted instance.