pub struct RdFlex { /* private fields */ }Expand description
RD with flexible covariate adjustment. A fuzzy design (RdFlex::fuzzy)
also adjusts the treatment with a classifier.
Implementations§
Source§impl RdFlex
impl RdFlex
Sourcepub fn sharp(ml_g: impl Regressor + 'static) -> Self
pub fn sharp(ml_g: impl Regressor + 'static) -> Self
Sharp design: treatment is 1{score ≥ cutoff}. ml_g learns the
outcome and must support sample weights.
Sourcepub fn fuzzy(
ml_g: impl Regressor + 'static,
ml_m: impl Classifier + 'static,
) -> Self
pub fn fuzzy( ml_g: impl Regressor + 'static, ml_m: impl Classifier + 'static, ) -> Self
Fuzzy design: ml_m (supporting sample weights) learns the treatment.
Sourcepub fn from_boxed(
ml_g: Box<dyn Regressor>,
ml_m: Option<Box<dyn Classifier>>,
) -> Self
pub fn from_boxed( ml_g: Box<dyn Regressor>, ml_m: Option<Box<dyn Classifier>>, ) -> Self
ml_m = Some(_) fits a fuzzy design.
pub fn cutoff(self, cutoff: f64) -> Self
Sourcepub fn h_fs(self, h: f64) -> Self
pub fn h_fs(self, h: f64) -> Self
Initial first-stage bandwidth (default: rdbwselect without covariates).
pub fn first_stage(self, spec: FirstStage) -> Self
pub fn kernel(self, kernel: RdKernel) -> Self
Sourcepub fn n_iterations(self, n: usize) -> Self
pub fn n_iterations(self, n: usize) -> Self
Rounds of first-stage fitting and bandwidth updating (default 2).
Sourcepub fn n_rep(self, n_rep: usize) -> Self
pub fn n_rep(self, n_rep: usize) -> Self
Number of independent sample splits (default 1), aggregated by the median.
Sourcepub fn fit(
&self,
data: &DmlData,
score: ArrayView1<'_, f64>,
) -> Result<RdFlexFit>
pub fn fit( &self, data: &DmlData, score: ArrayView1<'_, f64>, ) -> Result<RdFlexFit>
Fit with sample splits stratified by the treatment; score is the
running variable.
Sourcepub fn fit_with_folds(
&self,
data: &DmlData,
score: ArrayView1<'_, f64>,
splits: &[Vec<Fold>],
) -> Result<RdFlexFit>
pub fn fit_with_folds( &self, data: &DmlData, score: ArrayView1<'_, f64>, splits: &[Vec<Fold>], ) -> Result<RdFlexFit>
Fit on given sample splits (one Vec<Fold> per repetition).
Auto Trait Implementations§
impl !RefUnwindSafe for RdFlex
impl !UnwindSafe for RdFlex
impl Freeze for RdFlex
impl Send for RdFlex
impl Sync for RdFlex
impl Unpin for RdFlex
impl UnsafeUnpin for RdFlex
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
Converts
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> ⓘ
Converts
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