pub struct DmlFit { /* private fields */ }Expand description
A fitted DML model: estimates, standard errors and the per-repetition scores and nuisance predictions behind them.
Arrays indexed by treatment have length k = n_treat; per-repetition
arrays have shape (k, n_rep).
Implementations§
Source§impl DmlFit
impl DmlFit
Source§impl DmlFit
impl DmlFit
pub fn model_name(&self) -> &str
pub fn treatment_names(&self) -> &[String]
pub fn n_obs(&self) -> usize
pub fn n_treat(&self) -> usize
pub fn n_rep(&self) -> usize
pub fn n_folds(&self) -> usize
Sourcepub fn n_clusters(&self) -> Option<usize>
pub fn n_clusters(&self) -> Option<usize>
Number of clusters (two-way: the smaller dimension) for a clustered
fit, None otherwise.
Sourcepub fn coef(&self) -> ArrayView1<'_, f64>
pub fn coef(&self) -> ArrayView1<'_, f64>
Point estimates θ̂ (median over repetitions).
Sourcepub fn se(&self) -> ArrayView1<'_, f64>
pub fn se(&self) -> ArrayView1<'_, f64>
Standard errors (aggregated over repetitions).
pub fn t_stat(&self) -> Array1<f64>
Sourcepub fn p_value(&self) -> Array1<f64>
pub fn p_value(&self) -> Array1<f64>
Two-sided p-values for H0: θ = 0 from the aggregated t-statistic,
as DoubleML’s pval. (Multiple-testing adjustments in
p_adjust instead take the median over repetitions.)
Sourcepub fn confint(&self, level: f64) -> Result<Array2<f64>>
pub fn confint(&self, level: f64) -> Result<Array2<f64>>
Pointwise Wald confidence intervals at level, shape (k, 2)
(median over repetitions of each repetition’s interval).
Sourcepub fn p_adjust(&self, method: PAdjust) -> Array1<f64>
pub fn p_adjust(&self, method: PAdjust) -> Array1<f64>
Multiple-testing adjusted p-values across treatments (applied per
repetition, then the median is taken). For the bootstrap-based
Romano–Wolf procedure see Bootstrap::romano_wolf.
Sourcepub fn all_coef(&self) -> ArrayView2<'_, f64>
pub fn all_coef(&self) -> ArrayView2<'_, f64>
Estimates for every repetition, shape (k, n_rep).
pub fn all_se(&self) -> ArrayView2<'_, f64>
Sourcepub fn psi(&self) -> ArrayView3<'_, f64>
pub fn psi(&self) -> ArrayView3<'_, f64>
Score values ψ at θ̂, shape (n, k, n_rep).
Sourcepub fn psi_elements(&self) -> (ArrayView3<'_, f64>, ArrayView3<'_, f64>)
pub fn psi_elements(&self) -> (ArrayView3<'_, f64>, ArrayView3<'_, f64>)
Score elements ψ_a and ψ_b (ψ = ψ_a·θ + ψ_b), shape (n, k, n_rep).
Sourcepub fn cate(&self, basis: ArrayView2<'_, f64>) -> Result<Blp>
pub fn cate(&self, basis: ArrayView2<'_, f64>) -> Result<Blp>
Best linear predictor of the CATE on basis (shape (n, p), include a
constant column for an intercept), with HC0 inference (Semenova and
Chernozhukov, 2021), as DoubleML’s cate. Available for a single
treatment of Plr (outcome residual on the basis scaled by
the treatment residual), Irm with the ATE score and
Apo (orthogonal signal on the basis).
Sourcepub fn gate(&self, groups: ArrayView2<'_, f64>) -> Result<Blp>
pub fn gate(&self, groups: ArrayView2<'_, f64>) -> Result<Blp>
Group average treatment effects for mutually exclusive groups given as
0/1 dummy columns (shape (n, n_groups)), as DoubleML’s gate.
Sourcepub fn policy_tree(
&self,
features: ArrayView2<'_, f64>,
depth: usize,
min_samples_leaf: usize,
ccp_alpha: f64,
) -> Result<PolicyTree>
pub fn policy_tree( &self, features: ArrayView2<'_, f64>, depth: usize, min_samples_leaf: usize, ccp_alpha: f64, ) -> Result<PolicyTree>
Policy tree recommending treatment where the estimated effect is
positive, as DoubleML’s policy_tree (for Irm with the
ATE score, one treatment and one repetition). DoubleML’s defaults:
depth = 2, min_samples_leaf = 8, ccp_alpha = 0.01.
Sourcepub fn nuisance_loss(&self, name: &str) -> Option<ArrayView2<'_, f64>>
pub fn nuisance_loss(&self, name: &str) -> Option<ArrayView2<'_, f64>>
Out-of-sample loss of a nuisance learner, shape (n_treat, n_rep):
RMSE for regression learners, log loss for classifiers (DoubleML’s
nuisance_loss). Computed on the rows where the nuisance applies.
Sourcepub fn nuisance_losses(
&self,
) -> impl Iterator<Item = (&str, LossKind, ArrayView2<'_, f64>)>
pub fn nuisance_losses( &self, ) -> impl Iterator<Item = (&str, LossKind, ArrayView2<'_, f64>)>
(name, loss kind, losses) for every evaluated nuisance learner.
Sourcepub fn nuisance_targets(&self, name: &str) -> Option<ArrayView3<'_, f64>>
pub fn nuisance_targets(&self, name: &str) -> Option<ArrayView3<'_, f64>>
Targets of a nuisance learner, shape (n, n_rep, n_treat), with NaN
where the nuisance does not apply (to evaluate custom metrics).
Sourcepub fn nuisance_names(&self) -> impl Iterator<Item = &str>
pub fn nuisance_names(&self) -> impl Iterator<Item = &str>
Names of the stored nuisance predictions (e.g. ml_l, ml_m).
Sourcepub fn predictions(&self, name: &str) -> Option<ArrayView3<'_, f64>>
pub fn predictions(&self, name: &str) -> Option<ArrayView3<'_, f64>>
All predictions of one nuisance, shape (n, n_rep, k).
Source§impl DmlFit
impl DmlFit
Sourcepub fn concat(fits: &[DmlFit]) -> Result<DmlFit>
pub fn concat(fits: &[DmlFit]) -> Result<DmlFit>
Stack fits of the same data and sample splits into one fit with all
their estimates (DoubleML’s concat), for joint inference: the
bootstrap, simultaneous confidence bands and linear combinations then
account for the correlation between the estimates.
Predictions and learner losses are stacked by nuisance name (NaN where
a fit has no such nuisance); sensitivity elements are kept if every fit
has them.
Source§impl DmlFit
impl DmlFit
Sourcepub fn sensitivity_analysis(
&self,
params: &SensitivityParams,
) -> Result<SensitivityResult>
pub fn sensitivity_analysis( &self, params: &SensitivityParams, ) -> Result<SensitivityResult>
Bounds on θ, their confidence bounds and robustness values under the
confounding scenario params (PLR, IRM and DID models).
Sourcepub fn sensitivity_elements(
&self,
) -> Option<(ArrayView2<'_, f64>, ArrayView2<'_, f64>)>
pub fn sensitivity_elements( &self, ) -> Option<(ArrayView2<'_, f64>, ArrayView2<'_, f64>)>
Sensitivity elements (σ², ν²), each of shape (n_treat, n_rep):
the residual variance of the outcome and the variance of the Riesz
representer. None for models without sensitivity analysis.
Sourcepub fn sensitivity_benchmark(
&self,
short: &DmlFit,
) -> Result<SensitivityBenchmark>
pub fn sensitivity_benchmark( &self, short: &DmlFit, ) -> Result<SensitivityBenchmark>
Calibrate a confounding scenario against observed covariates: short
must be the same model refitted on the same sample splits without
the benchmarking covariates (see sensitivity_benchmark on the models).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DmlFit
impl RefUnwindSafe for DmlFit
impl Send for DmlFit
impl Sync for DmlFit
impl Unpin for DmlFit
impl UnsafeUnpin for DmlFit
impl UnwindSafe for DmlFit
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more