riantr/moonbit_dowhy/identifiers does not have a README file

    AdjustmentSet

    pub struct AdjustmentSet {
    adjustment_type : String
    adjustment_variables : Array[String]
    }

    The adjustment set that an identifier found.

    This is the port of dowhy.causal_identifier.adjustment_set.AdjustmentSet.

    AdjustmentSet::adjustment_type

    fn AdjustmentSet::adjustment_type(self : AdjustmentSet) -> String

    The technique the adjustment set belongs to, "backdoor" or "general".

    AdjustmentSet::adjustment_variables

    fn AdjustmentSet::adjustment_variables(self : AdjustmentSet) -> Array[String]

    The variables of the adjustment set.

    AdjustmentSet::new

    fn AdjustmentSet::new(adjustment_type : String, adjustment_variables : Array[String]) -> AdjustmentSet

    A new adjustment set of the given type.

    CompleteTestCase

    pub struct CompleteTestCase {
    nodes : Array[String]
    edges : Array[String]
    action_nodes : Array[String]
    outcome_nodes : Array[String]
    observed_nodes : Array[String]
    minimal_sets : Array[Array[String]]
    }

    A complete adjustment example graph.

    CompleteTestCase::new

    fn CompleteTestCase::new(nodes : Array[String], edges : Array[String], action_nodes : Array[String], outcome_nodes : Array[String], observed_nodes : Array[String], minimal_sets : Array[Array[String]]) -> CompleteTestCase

    A new complete adjustment test case.

    FrontdoorTestCase

    pub struct FrontdoorTestCase {
    nodes : Array[String]
    edges : Array[String]
    action_nodes : Array[String]
    outcome_nodes : Array[String]
    observed_nodes : Array[String]
    valid_sets : Array[Array[String]]
    invalid_sets : Array[Array[String]]
    }

    A frontdoor example graph with the valid and the invalid sets.

    FrontdoorTestCase::new

    fn FrontdoorTestCase::new(nodes : Array[String], edges : Array[String], action_nodes : Array[String], outcome_nodes : Array[String], observed_nodes : Array[String], valid_sets : Array[Array[String]], invalid_sets : Array[Array[String]]) -> FrontdoorTestCase

    A new frontdoor test case.

    IdentifiedEstimand

    pub struct IdentifiedEstimand {
    treatment_variable : Array[String]
    outcome_variable : Array[String]
    estimand_type : String
    estimands : Map[String, Array[String]]
    backdoor_variables : Map[String, Array[String]]
    general_adjustment_variables : Map[String, Array[String]]
    instrumental_variables : Array[String]
    frontdoor_variables : Array[String]
    mediator_variables : Array[String]
    mediation_first_stage_confounders : Map[String, Array[String]]
    mediation_second_stage_confounders : Map[String, Array[String]]
    default_backdoor_id : String
    default_adjustment_set_id : String
    identifier_method : String
    no_directed_path : Bool
    }

    The estimand that the identification step produced.

    This is the port of dowhy.causal_identifier.identified_estimand.

    An identified estimand carries the treatment and the outcome, the adjustment variables that the chosen identifier selected, the instruments, the frontdoor variables and the mediators. The estimators consume it and the refuters replace it, so it has to be cheap to copy.

    IdentifiedEstimand::copy

    A copy of the estimand.

    The variable lists and the registries are copied as well, so the copy and the original share no state. This matters for the refuters: they replace the adjustment set of a copy, and the estimator they were handed has to keep the adjustment set it was fitted with.

    IdentifiedEstimand::default_backdoor_id

    fn IdentifiedEstimand::default_backdoor_id(self : IdentifiedEstimand) -> String

    The identifier of the default backdoor set, e.g. "backdoor1".

    IdentifiedEstimand::estimand_assumptions

    fn IdentifiedEstimand::estimand_assumptions(self : IdentifiedEstimand, key : String) -> Array[String]

    The assumptions of an estimand in the registry.

    The registry stores the assumption names of every estimand; the strings match the ones dowhy reports.

    IdentifiedEstimand::estimand_keys

    fn IdentifiedEstimand::estimand_keys(self : IdentifiedEstimand) -> Array[String]

    The names of the estimands in the registry.

    IdentifiedEstimand::estimand_type

    fn IdentifiedEstimand::estimand_type(self : IdentifiedEstimand) -> String

    The estimand type, e.g. "nonparametric-ate".

    IdentifiedEstimand::get_adjustment_set

    fn IdentifiedEstimand::get_adjustment_set(self : IdentifiedEstimand, key : String) -> Array[String]

    The adjustment variables of the current identifier.

    Mirrors IdentifiedEstimand.get_adjustment_set: general adjustment sets are used when the identifier is "general_adjustment", otherwise the backdoor variables are.

    IdentifiedEstimand::get_backdoor_variables

    fn IdentifiedEstimand::get_backdoor_variables(self : IdentifiedEstimand, key : String) -> Array[String]

    The backdoor variables of the current identifier.

    IdentifiedEstimand::get_frontdoor_variables

    fn IdentifiedEstimand::get_frontdoor_variables(self : IdentifiedEstimand) -> Array[String]

    The frontdoor variables of the estimand.

    IdentifiedEstimand::get_general_adjustment_variables

    fn IdentifiedEstimand::get_general_adjustment_variables(self : IdentifiedEstimand, key : String) -> Array[String]

    The adjustment variables of the complete adjustment criterion.

    IdentifiedEstimand::get_instrumental_variables

    fn IdentifiedEstimand::get_instrumental_variables(self : IdentifiedEstimand) -> Array[String]

    The instruments of the estimand.

    IdentifiedEstimand::get_mediator_variables

    fn IdentifiedEstimand::get_mediator_variables(self : IdentifiedEstimand) -> Array[String]

    The mediator variables of the estimand.

    IdentifiedEstimand::has_estimand

    fn IdentifiedEstimand::has_estimand(self : IdentifiedEstimand, key : String) -> Bool

    Whether the registry contains the given estimand.

    IdentifiedEstimand::has_no_directed_path

    fn IdentifiedEstimand::has_no_directed_path(self : IdentifiedEstimand) -> Bool

    Whether the causal graph has no directed path from treatment to outcome.

    IdentifiedEstimand::identifier_method

    fn IdentifiedEstimand::identifier_method(self : IdentifiedEstimand) -> String

    The name of the identifier that produced the estimand.

    IdentifiedEstimand::new

    fn IdentifiedEstimand::new(treatment_variable : Array[String], outcome_variable : Array[String]) -> IdentifiedEstimand

    A fresh estimand for a treatment and an outcome.

    IdentifiedEstimand::outcome

    fn IdentifiedEstimand::outcome(self : IdentifiedEstimand) -> Array[String]

    The outcome variables.

    IdentifiedEstimand::set_adjustment_set

    fn IdentifiedEstimand::set_adjustment_set(self : IdentifiedEstimand, variables : Array[String], key : String) -> Unit

    Replace the adjustment variables of the current identifier.

    IdentifiedEstimand::set_default_adjustment_set_id

    fn IdentifiedEstimand::set_default_adjustment_set_id(self : IdentifiedEstimand, id : String) -> Unit

    Set the identifier of the default general adjustment set.

    IdentifiedEstimand::set_default_backdoor_id

    fn IdentifiedEstimand::set_default_backdoor_id(self : IdentifiedEstimand, id : String) -> Unit

    Set the identifier of the default backdoor set.

    IdentifiedEstimand::set_estimand

    fn IdentifiedEstimand::set_estimand(self : IdentifiedEstimand, key : String, assumptions : Array[String]) -> Unit

    Register an estimand with its assumptions.

    IdentifiedEstimand::set_estimand_type

    fn IdentifiedEstimand::set_estimand_type(self : IdentifiedEstimand, estimand_type : String) -> Unit

    Set the type of the estimand, e.g. "nonparametric-ate".

    IdentifiedEstimand::set_frontdoor_variables

    fn IdentifiedEstimand::set_frontdoor_variables(self : IdentifiedEstimand, variables : Array[String]) -> Unit

    Set the frontdoor variables of the estimand.

    IdentifiedEstimand::set_general_adjustment_variables

    fn IdentifiedEstimand::set_general_adjustment_variables(self : IdentifiedEstimand, variables : Array[String], key : String) -> Unit

    Set the adjustment variables of the complete adjustment criterion.

    IdentifiedEstimand::set_identifier_method

    fn IdentifiedEstimand::set_identifier_method(self : IdentifiedEstimand, name : String) -> Unit

    Set the name of the identifier that produced the estimand.

    IdentifiedEstimand::set_instrumental_variables

    fn IdentifiedEstimand::set_instrumental_variables(self : IdentifiedEstimand, variables : Array[String]) -> Unit

    Set the instruments of the estimand.

    IdentifiedEstimand::set_no_directed_path

    fn IdentifiedEstimand::set_no_directed_path(self : IdentifiedEstimand, flag : Bool) -> Unit

    Set whether the causal graph has no directed path from treatment to outcome.

    IdentifiedEstimand::treatment

    fn IdentifiedEstimand::treatment(self : IdentifiedEstimand) -> Array[String]

    The treatment variables.

    IdentifiedEstimand::with_adjustment_variables

    fn IdentifiedEstimand::with_adjustment_variables(self : IdentifiedEstimand, variables : Array[String]) -> IdentifiedEstimand

    A copy of the estimand with a different adjustment set.

    The random common cause refuter uses this to add the noise variable to the adjustment set.

    IdentifiedEstimand::with_no_directed_path

    fn IdentifiedEstimand::with_no_directed_path(self : IdentifiedEstimand, flag : Bool) -> IdentifiedEstimand

    A copy of the estimand with the "no directed path" flag set.

    The identification returns such an estimand when the causal graph has no directed path from the treatment to the outcome.

    IdentifierTestCase

    pub struct IdentifierTestCase {
    nodes : Array[String]
    edges : Array[String]
    action_nodes : Array[String]
    outcome_nodes : Array[String]
    observed_nodes : Array[String]
    biased_sets : Array[Array[String]]
    minimal_sets : Array[Array[String]]
    maximal_sets : Array[Array[String]]
    direct_maximal_sets : Array[Array[String]]
    }

    One example graph with the adjustment sets it has to produce.

    IdentifierTestCase::new

    fn IdentifierTestCase::new(nodes : Array[String], edges : Array[String], action_nodes : Array[String], outcome_nodes : Array[String], observed_nodes : Array[String], biased_sets : Array[Array[String]], minimal_sets : Array[Array[String]], maximal_sets : Array[Array[String]], direct_maximal_sets : Array[Array[String]]) -> IdentifierTestCase

    A new test case.

    BACKDOOR_DEFAULT

    let BACKDOOR_DEFAULT : String

    The default backdoor strategy: the maximal and the minimal set.

    BACKDOOR_EFFICIENT

    let BACKDOOR_EFFICIENT : String

    The efficient backdoor strategy of Smucler, Sapienza and Rotnitzky.

    BACKDOOR_EXHAUSTIVE

    let BACKDOOR_EXHAUSTIVE : String

    The exhaustive backdoor strategy: every valid set.

    BACKDOOR_MAX

    let BACKDOOR_MAX : String

    The maximal backdoor strategy: the largest valid set.

    BACKDOOR_MIN

    let BACKDOOR_MIN : String

    The minimal backdoor strategy: the smallest valid set.

    BACKDOOR_MINCOST_EFFICIENT

    let BACKDOOR_MINCOST_EFFICIENT : String

    The efficient minimum cost backdoor strategy.

    BACKDOOR_MIN_EFFICIENT

    let BACKDOOR_MIN_EFFICIENT : String

    The efficient minimal backdoor strategy.

    EFFICIENT_BACKDOOR_NOT_IMPLEMENTED

    let EFFICIENT_BACKDOOR_NOT_IMPLEMENTED : String

    The message that the efficient backdoor search is not implemented yet.

    backdoor_adjustment_error

    fn backdoor_adjustment_error(backdoor_adjustment : String) -> String

    The error message of a backdoor strategy, or an empty string when the strategy is supported.

    backdoor_cases

    fn backdoor_cases() -> Array[IdentifierTestCase]

    Every backdoor example graph of the upstream test suite.

    complete_cases

    fn complete_cases() -> Array[CompleteTestCase]

    Every complete adjustment example graph of the upstream test suite.

    frontdoor_cases

    fn frontdoor_cases() -> Array[FrontdoorTestCase]

    Every frontdoor example graph of the upstream test suite.

    identify_backdoor

    fn identify_backdoor(graph :
    DirectedGraph
    , action_nodes : Array[String], outcome_nodes : Array[String], observed_nodes : Array[String], backdoor_adjustment : String, direct_effect? : Bool) -> (Array[AdjustmentSet], String)

    The backdoor adjustment sets of the graph.

    The first component holds the adjustment sets, the second one an error message that is empty when the search succeeded. The three "efficient" strategies are not implemented yet: they return an empty list of adjustment sets and a message that says so, rather than a wrong set.

    The candidate sets are enumerated in sorted order. The Python code iterates over a set of variables, so the order in which it finds the valid sets depends on the hash of the variable names and changes between runs; the sorted order makes the result reproducible.

    identify_effect

    fn identify_effect(graph :
    DirectedGraph
    , action_nodes : Array[String], outcome_nodes : Array[String], observed_nodes : Array[String]) -> IdentifiedEstimand

    The identified estimand of the causal effect of the treatment.

    This is the same as identify_effect_auto with the default backdoor strategy and the average total effect.

    identify_effect_auto

    fn identify_effect_auto(graph :
    DirectedGraph
    , action_nodes : Array[String], outcome_nodes : Array[String], observed_nodes : Array[String], estimand_type : String, backdoor_adjustment : String) -> IdentifiedEstimand

    The identified estimand of the causal effect of the treatment.

    The estimand carries the adjustment sets of the backdoor criterion, the instruments and the frontdoor variables, together with the assumptions that every one of them needs.

    identify_frontdoor

    fn identify_frontdoor(graph :
    DirectedGraph
    , action_nodes : Array[String], outcome_nodes : Array[String], observed_nodes : Array[String]) -> Array[String]

    The frontdoor variables of the graph.

    The result is the smallest set that satisfies the three conditions of the frontdoor criterion; it is empty when no such set exists. The Python code keeps the last set it finds, which is the largest one because of the break that only leaves the inner loop; the smallest set is the one the frontdoor criterion asks for.

    identify_generalized_adjustment_set

    fn identify_generalized_adjustment_set(graph :
    DirectedGraph
    , action_nodes : Array[String], outcome_nodes : Array[String], observed_nodes : Array[String]) -> Array[AdjustmentSet]

    The adjustment set of the complete adjustment criterion.

    The complete criterion of Shpitser et al. finds an adjustment set that is not a backdoor set. The set is a minimal d-separator of the treatment and the outcome in the proper backdoor graph, restricted to the observed variables that are not descendants of a proper causal path node.

    Powered by MoonBit

    Site sourceReport issueModulesSkillsBuild queueStatistics

    © 2026 mooncakes.io