4.1.4. doubleml.utils.DoubleMLBLP#
- class doubleml.utils.DoubleMLBLP(orth_signal, basis, is_gate=False)#
Best linear predictor (BLP) for DoubleML with orthogonal signals. Manily used for CATE and GATE estimation for IRM models.
- Parameters:
orth_signal (
numpy.array) – The orthogonal signal to be predicted. Has to be of shape(n_obs,)or(n_obs, n_rep), wheren_obsis the number of observations andn_repis the number of repetitions.basis (
pandas.DataFrameor list ofpandas.DataFrame) – The basis for estimating the best linear predictor. Either a single DataFrame of shape(n_obs, d)(shared across all repetitions) or a list of DataFrames of lengthn_rep(one basis per repetition, e.g. for PLR CATE where the basis is multiplied by per-rep residuals). When a list is passed, every entry must have the same column names so per-rep coefficients can be aggregated.is_gate (bool) – Indicates whether the basis is constructed for GATEs (dummy-basis). Default is
False.
Methods
confint([basis, joint, level, n_rep_boot])Confidence intervals for the BLP model.
fit([cov_type])Estimate DoubleMLBLP models.
Attributes
all_coefCoefficients for each repetition with shape
(d, n_rep).all_seStandard errors for each repetition with shape
(d, n_rep).basisBasis.
basis_listPer-repetition list of basis DataFrames with length
n_rep.blp_modelBest-Linear-Predictor models.
blp_omegaCovariance matrix.
coefAggregated coefficients over repetitions.
n_repNumber of repetitions.
orth_signalOrthogonal signal.
seAggregated standard errors over repetitions.
summaryA summary for the best linear predictor effect after calling
fit().
- DoubleMLBLP.confint(basis=None, joint=False, level=0.95, n_rep_boot=500)#
Confidence intervals for the BLP model.
- Parameters:
basis (
pandas.DataFrame) – The basis for constructing the confidence interval. Has to have the same form as the basis from the construction. IfNoneis passed, if the basis is constructed for GATEs, the GATEs are returned. Else, the confidence intervals for the basis coefficients are returned (with pointwise cofidence intervals). Default isNone.joint (bool) – Indicates whether joint confidence intervals are computed. Default is
False.level (float) – The confidence level. Default is
0.95.n_rep_boot (int) – The number of bootstrap repetitions (only relevant for joint confidence intervals). Default is
500.
- Returns:
df_ci – A data frame with the confidence interval(s).
- Return type:
pd.DataFrame
- DoubleMLBLP.fit(cov_type='HC0', **kwargs)#
Estimate DoubleMLBLP models.
- Parameters:
cov_type (str) – The covariance type to be used in the estimation. Default is
'HC0'. Seestatsmodels.regression.linear_model.OLS.fit()for more information.**kwargs (dict) – Additional keyword arguments to be passed to
statsmodels.regression.linear_model.OLS.fit().
- Returns:
self
- Return type: