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.
Sourcepub fn sharp_binary(ml_g: impl Classifier + 'static) -> Self
pub fn sharp_binary(ml_g: impl Classifier + 'static) -> Self
Sharp design with a binary (0/1) outcome learned by the classifier
ml_g (its class-1 probability), as DoubleML with a classifier.
Sourcepub fn fuzzy_binary(
ml_g: impl Classifier + 'static,
ml_m: impl Classifier + 'static,
) -> Self
pub fn fuzzy_binary( ml_g: impl Classifier + 'static, ml_m: impl Classifier + 'static, ) -> Self
Fuzzy design with a binary outcome learned by the classifier ml_g.
Sourcepub fn from_boxed_binary(
ml_g: Box<dyn Classifier>,
ml_m: Option<Box<dyn Classifier>>,
) -> Self
pub fn from_boxed_binary( ml_g: Box<dyn Classifier>, ml_m: Option<Box<dyn Classifier>>, ) -> Self
Binary outcome with a boxed classifier; ml_m = Some(_) fits a fuzzy
design.
Sourcepub fn rd_options(self, options: RdOptions) -> Self
pub fn rd_options(self, options: RdOptions) -> Self
Options of the RD estimator (rdrobust’s keyword arguments in
DoubleML: polynomial order, kernel, bandwidth selector, variance, …).
The initial first-stage bandwidth is always selected with the defaults.
Sourcepub fn rd_covariates(self, covs: Array2<f64>) -> Self
pub fn rd_covariates(self, covs: Array2<f64>) -> Self
Covariates for the RD estimator itself (rdrobust’s covs), one row
per observation; the first stage uses the data’s covariates.
Sourcepub fn rd_clusters(self, labels: Vec<i64>) -> Self
pub fn rd_clusters(self, labels: Vec<i64>) -> Self
Cluster labels for cluster-robust RD standard errors (rdrobust’s
cluster); the sample splits are not clustered, as in DoubleML.
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
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> ⓘ
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