riantr/moonbit_dowhy/estimators does not have a README file

    CausalEstimator

    pub struct CausalEstimator {
    target_estimand :
    IdentifiedEstimand

    kind : EstimatorKind
    weighting_scheme : WeightingScheme
    min_ps_score : Double
    max_ps_score : Double
    num_strata : NumStrata
    clipping_threshold : Int
    instrument_name : String
    rd_variable_name : String
    rd_threshold_value : Double
    rd_bandwidth : Double
    rd_local_data :
    DataFrame
    ?
    model :
    OlsFit

    first_stage : TwoStageModel?
    second_stage : TwoStageModel?
    glm_model :
    GlmFit

    glm_family :
    GlmFamily

    encoders :
    Encoders

    features : Array[String]
    propensities : Array[Double]
    propensity_beta : Array[Double]
    adjustment_names : Array[String]
    effect_modifier_names : Array[String]
    treatment_name : String
    outcome_name : String
    treatment_value : Double
    control_value : Double
    confidence_level : Double
    num_simulations : Int
    sample_size_fraction : Double
    compute_confidence_intervals : Bool
    test_significance : Bool
    }

    A causal estimator.

    The estimator owns the identified estimand and the state that fit produced; estimate_effect turns a data frame into a CausalEstimate.

    CausalEstimator::adjustment_set

    fn CausalEstimator::adjustment_set(self : CausalEstimator) -> Array[String]

    The adjustment variables the estimator uses.

    CausalEstimator::doubly_robust

    fn CausalEstimator::doubly_robust(estimand :
    IdentifiedEstimand
    , min_ps_score : Double, max_ps_score : Double) -> CausalEstimator

    A doubly robust estimator.

    CausalEstimator::effect_modifiers

    fn CausalEstimator::effect_modifiers(self : CausalEstimator) -> Array[String]

    The effect modifiers the estimator uses.

    The bootstrap refuter perturbs them, the way the upstream does.

    CausalEstimator::estimand

    The estimand the estimator was built for.

    CausalEstimator::estimate_conditional_effects

    fn CausalEstimator::estimate_conditional_effects(self : CausalEstimator, data :
    DataFrame
    , treatment_value : Double, control_value : Double) -> Array[(String, Double)]

    The conditional estimates of the effect, one per group of the effect modifier.

    The key of a group is the value of the discretised effect modifier, or the values of the discretised effect modifiers when there is more than one. The list is empty when the estimator has no effect modifier, which is what the upstream reports as a None.

    CausalEstimator::estimate_effect

    fn CausalEstimator::estimate_effect(self : CausalEstimator, data :
    DataFrame
    , treatment_value : Double, control_value : Double, target_units : String) ->
    CausalEstimate

    Estimate the treatment effect.

    target_units is one of "ate", "att" or "atc".

    CausalEstimator::estimator_kind

    fn CausalEstimator::estimator_kind(self : CausalEstimator) -> EstimatorKind

    The algorithm of the estimator.

    CausalEstimator::fit

    fn CausalEstimator::fit(self : CausalEstimator, data :
    DataFrame
    , effect_modifier_names : Array[String]) -> Unit

    Fit the estimator on the given data.

    The estimator remembers the adjustment variables of its estimand, fits the model it needs and stores the propensity scores when it uses them.

    CausalEstimator::generalized_linear_model

    A generalised linear model estimator for the given estimand.

    The family decides the link of the model: a binomial family fits a logistic regression, a poisson family fits a count model and the gaussian family fits an ordinary least squares model.

    CausalEstimator::instrument_name

    fn CausalEstimator::instrument_name(self : CausalEstimator) -> String

    The name of the instrument of an instrumental variable estimator.

    It is empty for every other estimator.

    CausalEstimator::instrumental_variable

    fn CausalEstimator::instrumental_variable(estimand :
    IdentifiedEstimand
    , instrument_name : String) -> CausalEstimator

    An instrumental variable estimator.

    CausalEstimator::intervene

    fn CausalEstimator::intervene(self : CausalEstimator, value : Double, data :
    DataFrame
    ) -> Double

    The mean outcome of the intervention do(treatment = value).

    This is the port of the do operator of the upstream estimators: the treatment is set to the given value in every row of the data and the model predicts the outcome of the modified data.

    CausalEstimator::linear_regression

    An ordinary least squares estimator for the given estimand.

    CausalEstimator::outcome

    fn CausalEstimator::outcome(self : CausalEstimator) -> String

    The outcome column the estimator uses.

    CausalEstimator::propensity_score_matching

    A propensity score matching estimator.

    CausalEstimator::propensity_score_stratification

    fn CausalEstimator::propensity_score_stratification(estimand :
    IdentifiedEstimand
    , num_strata : NumStrata, clipping_threshold : Int) -> CausalEstimator

    A propensity score stratification estimator.

    CausalEstimator::propensity_score_weighting

    fn CausalEstimator::propensity_score_weighting(estimand :
    IdentifiedEstimand
    , min_ps_score : Double, max_ps_score : Double, scheme : WeightingScheme) -> CausalEstimator

    An inverse propensity score weighting estimator.

    CausalEstimator::propensity_scores

    fn CausalEstimator::propensity_scores(self : CausalEstimator) -> Array[Double]

    The propensity scores the estimator computed.

    CausalEstimator::regression_discontinuity

    fn CausalEstimator::regression_discontinuity(estimand :
    IdentifiedEstimand
    , rd_variable_name : String, rd_threshold_value : Double, rd_bandwidth : Double) -> CausalEstimator

    A regression discontinuity estimator.

    CausalEstimator::set_compute_confidence_intervals

    fn CausalEstimator::set_compute_confidence_intervals(self : CausalEstimator, compute : Bool) -> Unit

    Ask the estimator to compute the confidence intervals.

    CausalEstimator::set_confidence_level

    fn CausalEstimator::set_confidence_level(self : CausalEstimator, level : Double) -> Unit

    Set the confidence level of the intervals.

    CausalEstimator::set_estimand

    Replace the estimand the estimator was built for.

    The refuters use this to estimate a different effect with the same estimator.

    CausalEstimator::set_num_simulations

    fn CausalEstimator::set_num_simulations(self : CausalEstimator, num_simulations : Int) -> Unit

    Set the number of bootstrap simulations.

    CausalEstimator::set_sample_size_fraction

    fn CausalEstimator::set_sample_size_fraction(self : CausalEstimator, fraction : Double) -> Unit

    Set the fraction of the sample a bootstrap resample takes.

    CausalEstimator::set_test_significance

    fn CausalEstimator::set_test_significance(self : CausalEstimator, do_test : Bool) -> Unit

    Ask the estimator to test the significance of the estimate.

    CausalEstimator::treatment

    fn CausalEstimator::treatment(self : CausalEstimator) -> String

    The treatment column the estimator uses.

    CausalEstimator::two_stage_error

    fn CausalEstimator::two_stage_error(self : CausalEstimator) -> String

    The error the two stage regression estimator reports for the estimand of the estimator, or an empty string when it can estimate the effect.

    The upstream raises a ValueError when the estimand holds no mediator variable or more than one, and it raises an Exception when the estimand holds more than one treatment variable or more than one outcome variable. MoonBit cannot catch an error, so the port aborts with the message of the upstream; this function reports the message of the error the upstream raises, so that a caller can check for it before it fits the estimator.

    CausalEstimator::two_stage_features

    fn CausalEstimator::two_stage_features(self : CausalEstimator) -> (Array[String], Array[String])

    The columns of the design matrix of the two stages of the two stage regression estimator.

    The first element holds the columns of the first stage, the one that regresses the mediator on the treatment, and the second one the columns of the second stage, the one that regresses the outcome on the mediator.

    CausalEstimator::two_stage_regression

    A two stage regression estimator.

    CausalEstimator::with_estimand

    A copy of the estimator that estimates a different estimand.

    The refuters use this to re-estimate the effect with the same algorithm on modified data. The copy starts without any fitted state, so the estimator that was handed in keeps the model and the adjustment set it was fitted with.

    CausalEstimator::with_instrument_name

    fn CausalEstimator::with_instrument_name(self : CausalEstimator, name : String) -> CausalEstimator

    A copy of the estimator that uses a different instrument.

    The placebo treatment refuter uses this for the instrumental variable method, whose instrument the placebo replaces.

    EstimatorKind

    pub enum EstimatorKind {
    LinearRegression
    PropensityScoreWeighting
    PropensityScoreMatching
    PropensityScoreStratification
    DoublyRobust
    InstrumentalVariable
    TwoStageRegression
    RegressionDiscontinuity
    GeneralizedLinearModel
    }

    The estimator family that DoWhy offers.

    The kind decides which algorithm fit and estimate_effect run; the estimator itself keeps the fitted state, exactly like the Python classes inherit from CausalEstimator.

    NumStrata

    pub enum NumStrata {
    Fixed(Int)
    Auto
    }

    The number of strata of the propensity score stratification estimator.

    The upstream takes the string "auto", which searches for the number of strata, and an integer, which is the number of strata.

    NumStrata::auto

    fn NumStrata::auto() -> NumStrata

    The number of strata is searched for, the way the upstream searches for it.

    NumStrata::fixed

    fn NumStrata::fixed(count : Int) -> NumStrata

    The given number of strata.

    TwoStageModel

    type TwoStageModel

    One stage of the two stage regression estimator.

    Every stage has its own encoders, because the treatment of the first stage is the column the second stage regresses on.

    WeightingScheme

    pub enum WeightingScheme {
    IpsWeight
    IpsStabilizedWeight
    IpsNormalizedWeight
    }

    The weighting scheme of the propensity score weighting estimator.

    WeightingScheme::ips_normalized_weight

    fn WeightingScheme::ips_normalized_weight() -> WeightingScheme

    The normalised inverse propensity score weighting scheme.

    WeightingScheme::ips_stabilized_weight

    fn WeightingScheme::ips_stabilized_weight() -> WeightingScheme

    The stabilised inverse propensity score weighting scheme.

    WeightingScheme::ips_weight

    fn WeightingScheme::ips_weight() -> WeightingScheme

    The inverse propensity score weighting scheme.

    WeightingScheme::name

    fn WeightingScheme::name(self : WeightingScheme) -> String

    The name of the weighting scheme.

    DEFAULT_CONFIDENCE_LEVEL

    let DEFAULT_CONFIDENCE_LEVEL : Double

    The default confidence level.

    DEFAULT_NUMBER_OF_SIMULATIONS_CI

    let DEFAULT_NUMBER_OF_SIMULATIONS_CI : Int

    The default number of simulations used for the confidence intervals.

    DEFAULT_NUMBER_OF_SIMULATIONS_STAT_TEST

    let DEFAULT_NUMBER_OF_SIMULATIONS_STAT_TEST : Int

    The default number of simulations used for the significance test.

    NUM_QUANTILES_TO_DISCRETIZE_CONT_COLS

    let NUM_QUANTILES_TO_DISCRETIZE_CONT_COLS : Int

    The default number of quantiles a continuous effect modifier is split into.

    Powered by MoonBit

    Site sourceReport issueModulesSkillsBuild queueStatistics

    © 2026 mooncakes.io