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.

    EfficientTestCase

    pub struct EfficientTestCase {
    nodes : Array[String]
    edges : Array[String]
    observed_nodes : Array[String]
    conditional_nodes : Array[String]
    costs : Array[(String, Double)]
    efficient : Array[String]?
    efficient_minimal : Array[String]?
    efficient_mincost : Array[String]?
    }

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

    EfficientTestCase::new

    fn EfficientTestCase::new(nodes : Array[String], edges : Array[String], observed_nodes : Array[String], conditional_nodes : Array[String], costs : Array[(String, Double)], efficient : Array[String]?, efficient_minimal : Array[String]?, efficient_mincost : Array[String]?) -> EfficientTestCase

    A new efficient backdoor 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.

    IDElement

    pub struct IDElement {
    predictor : IDPredictor?
    expression : IDExpression?
    }

    One element of a product: a predictor or a nested expression.

    The upstream holds the two kinds of element in one list, and tells them apart by their type. The port holds them in one struct, and the element with a predictor is the one without an expression.

    IDElement::as_expression

    fn IDElement::as_expression(self : IDElement) -> IDExpression?

    The expression of the element, when it has one.

    IDElement::as_predictor

    fn IDElement::as_predictor(self : IDElement) -> IDPredictor?

    The predictor of the element, when it has one.

    IDElement::of_expression

    fn IDElement::of_expression(expression : IDExpression) -> IDElement

    An element that is a nested expression.

    IDElement::of_predictor

    fn IDElement::of_predictor(predictor : IDPredictor) -> IDElement

    An element that is a predictor.

    IDExpression

    pub struct IDExpression {
    product : Array[IDElement]
    sum : Array[String]
    }

    The estimand of the ID algorithm.

    The estimand holds the factors of the product and the variables the product has to be summed over.

    IDExpression::add_product

    fn IDExpression::add_product(self : IDExpression, element : IDElement) -> Unit

    Add a factor to the product.

    IDExpression::add_sum

    fn IDExpression::add_sum(self : IDExpression, variables : Array[String]) -> Unit

    Add the given variables to the sum.

    IDExpression::new

    A new expression without any factor.

    IDExpression::product

    fn IDExpression::product(self : IDExpression) -> Array[IDElement]

    The factors of the product.

    IDExpression::sum

    fn IDExpression::sum(self : IDExpression) -> Array[String]

    The variables the product has to be summed over.

    IDExpression::to_string

    fn IDExpression::to_string(self : IDExpression) -> String

    The string of the estimand, the way the upstream prints it.

    The string is the sum of the variables, if there are any, and then one line per factor of the product.

    IDPredictor

    pub struct IDPredictor {
    outcome_vars : Array[String]
    condition_vars : Array[String]
    }

    One factor of the estimand: the distribution of the outcome variables given the condition variables.

    IDPredictor::condition_vars

    fn IDPredictor::condition_vars(self : IDPredictor) -> Array[String]

    The variables the predictor is conditioned on.

    IDPredictor::new

    fn IDPredictor::new(outcome_vars : Array[String], condition_vars : Array[String]) -> IDPredictor

    A new predictor of the given variables.

    IDPredictor::outcome_vars

    fn IDPredictor::outcome_vars(self : IDPredictor) -> Array[String]

    The variables the predictor is the distribution of.

    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_mediation_first_stage_confounders

    fn IdentifiedEstimand::get_mediation_first_stage_confounders(self : IdentifiedEstimand) -> Map[String, Array[String]]

    The confounders of the first stage of a mediation.

    The registry holds every backdoor adjustment set of the treatment and the mediator, keyed by its name, and the default set of them under the plain backdoor name.

    IdentifiedEstimand::get_mediation_second_stage_confounders

    fn IdentifiedEstimand::get_mediation_second_stage_confounders(self : IdentifiedEstimand) -> Map[String, Array[String]]

    The confounders of the second stage of a mediation.

    The registry holds every backdoor adjustment set of the mediator and the outcome, keyed by its name, and the default set of them under the plain backdoor name.

    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_mediation_first_stage_confounders

    fn IdentifiedEstimand::set_mediation_first_stage_confounders(self : IdentifiedEstimand, confounders : Map[String, Array[String]]) -> Unit

    Set the confounders of the first stage of a mediation.

    IdentifiedEstimand::set_mediation_second_stage_confounders

    fn IdentifiedEstimand::set_mediation_second_stage_confounders(self : IdentifiedEstimand, confounders : Map[String, Array[String]]) -> Unit

    Set the confounders of the second stage of a mediation.

    IdentifiedEstimand::set_mediator_variables

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

    Set the mediator variables 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_instrumental_variables

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

    A copy of the estimand with different instrumental variables.

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

    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.

    IdentifiedEstimand::with_treatment

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

    A copy of the estimand with a different treatment.

    The placebo treatment refuter uses this to point the estimand at the placebo column it builds.

    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_MULTIVARIATE_OUTCOME

    let EFFICIENT_BACKDOOR_MULTIVARIATE_OUTCOME : String

    The message that the search is only valid for a one dimensional outcome.

    EFFICIENT_BACKDOOR_MULTIVARIATE_TREATMENT

    let EFFICIENT_BACKDOOR_MULTIVARIATE_TREATMENT : String

    The message that the search is only valid for a one dimensional treatment.

    EFFICIENT_BACKDOOR_NEGATIVE_COST

    let EFFICIENT_BACKDOOR_NEGATIVE_COST : String

    The message that the costs of the variables have to be positive.

    EFFICIENT_BACKDOOR_NO_ADJUSTMENT_SET

    let EFFICIENT_BACKDOOR_NO_ADJUSTMENT_SET : String

    The message that no adjustment set of the observable variables exists.

    EFFICIENT_BACKDOOR_NO_OPTIMAL_SET

    let EFFICIENT_BACKDOOR_NO_OPTIMAL_SET : String

    The message that the conditions for the existence of an optimal adjustment set are not satisfied.

    EFFICIENT_BACKDOOR_UNOBSERVED_CONDITIONAL

    let EFFICIENT_BACKDOOR_UNOBSERVED_CONDITIONAL : String

    The message that some of the conditional variables are not observed.

    ID_NOT_A_DAG

    let ID_NOT_A_DAG : String

    The message that the graph is not a directed acyclic graph.

    ID_NOT_IDENTIFIABLE

    let ID_NOT_IDENTIFIABLE : String

    The message that the effect is not identifiable.

    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.

    The upstream raises an error for a strategy it does not know, and the port reports the message instead of raising it.

    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.

    efficient_backdoor_adjustment

    fn efficient_backdoor_adjustment(graph :
    DirectedGraph
    , action_nodes : Array[String], outcome_nodes : Array[String], observed_nodes : Array[String], conditional_node_names : Array[String], costs : Array[(String, Double)]) -> (Array[String], String)

    The efficient adjustment set of the treatment and the outcome.

    The first component holds the adjustment set, the second one an error message that is empty when the search succeeded.

    The conditional_node_names are the variables that determine the treatment. When they are not given, the intervention sets the treatment to a constant. The costs are the costs of the variables; the variables that are not in the list have no cost and are therefore free. An empty list of costs means that every variable of the graph costs one, the way the upstream assumes it when it is given no costs at all.

    efficient_backdoor_mincost_adjustment

    fn efficient_backdoor_mincost_adjustment(graph :
    DirectedGraph
    , action_nodes : Array[String], outcome_nodes : Array[String], observed_nodes : Array[String], conditional_node_names : Array[String], costs : Array[(String, Double)]) -> (Array[String], String)

    The efficient minimum cost adjustment set of the treatment and the outcome.

    The first component holds the adjustment set, the second one an error message that is empty when the search succeeded.

    The adjustment set is found with the minimum cut of the flow network of the upstream: every variable is split into an in and an out node, the edge between them costs the cost of the variable, and the edges of the graph are free. The variables of the cut are the adjustment set.

    The arguments are the ones of efficient_backdoor_adjustment.

    efficient_backdoor_minimal_adjustment

    fn efficient_backdoor_minimal_adjustment(graph :
    DirectedGraph
    , action_nodes : Array[String], outcome_nodes : Array[String], observed_nodes : Array[String], conditional_node_names : Array[String], costs : Array[(String, Double)]) -> (Array[String], String)

    The efficient minimal adjustment set of the treatment and the outcome.

    The first component holds the adjustment set, the second one an error message that is empty when the search succeeded.

    The arguments are the ones of efficient_backdoor_adjustment.

    efficient_cases

    fn efficient_cases() -> Array[EfficientTestCase]

    Every 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, costs? : Array[(String, Double)], conditional_node_names? : Array[String], optimize_backdoor? : 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 the searches of Smucler, Sapienza and Rotnitzky; they return one adjustment set, or an error message when no adjustment set of the observable variables exists. The costs are the costs of the variables of the minimum cost strategy; an empty list means that every variable costs one, the way the upstream assumes it when no costs are given. The conditional_node_names are the variables that determine the treatment.

    The optimize_backdoor flag replaces the search with the optimized search of the upstream, which walks the backdoor paths and finds a small set of variables that blocks all of them.

    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, costs? : Array[(String, Double)], conditional_node_names? : Array[String], optimize_backdoor? : Bool) -> 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.

    The costs and the conditional_node_names are the arguments of the efficient backdoor strategies; they are ignored by the other strategies. The optimize_backdoor flag replaces the backdoor search with the optimized search of the upstream.

    identify_effect_id

    fn identify_effect_id(graph :
    DirectedGraph
    , action_nodes : Array[String], outcome_nodes : Array[String]) -> (IDExpression?, String)

    The estimand of the effect of the treatment on the outcome.

    The first component holds the estimand, the second one an error message that is empty when the search succeeded. The graph has to be a directed acyclic graph, and the effect has to be identifiable.

    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.

    identify_mediation

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

    The mediator variables of the graph.

    The mediator is the descendant of the treatment that blocks one of the directed paths from the treatment to the outcome; the first one in sorted order wins. The result is empty when the graph holds no such variable.

    This is the port of identify_mediation of the upstream.

    identify_mediation_first_stage_confounders

    fn identify_mediation_first_stage_confounders(graph :
    DirectedGraph
    , action_nodes : Array[String], outcome_nodes : Array[String], mediator_nodes : Array[String], observed_nodes : Array[String], backdoor_adjustment : String) -> Map[String, Array[String]]

    The confounders of the first stage of a mediation.

    The first stage regresses the mediator on the treatment, so its confounders are the backdoor adjustment set of the treatment and the mediator.

    This is the port of identify_mediation_first_stage_confounders of the upstream. The registry holds every set the search found, keyed by its name, and the default set of them under the plain backdoor name.

    identify_mediation_second_stage_confounders

    fn identify_mediation_second_stage_confounders(graph :
    DirectedGraph
    , action_nodes : Array[String], mediator_nodes : Array[String], outcome_nodes : Array[String], observed_nodes : Array[String], backdoor_adjustment : String) -> Map[String, Array[String]]

    The confounders of the second stage of a mediation.

    The second stage regresses the outcome on the mediator, so its confounders are the backdoor adjustment set of the mediator and the outcome.

    This is the port of identify_mediation_second_stage_confounders of the upstream. The registry holds every set the search found, keyed by its name, and the default set of them under the plain backdoor name.

    identify_nie_effect

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

    The estimand of the natural indirect effect.

    This is the port of identify_nie_effect of the upstream: the registry of the estimands holds the mediation estimand only, and the confounders of the two stages of the mediation are the ones the two stage regression estimator uses.

    The natural direct effect is not ported; the upstream computes it with a third model, which the port does not have.

    is_backdoor_strategy

    fn is_backdoor_strategy(backdoor_adjustment : String) -> Bool

    Whether the given name is one of the backdoor strategies of the upstream.

    The strategies are the default, the exhaustive, the minimal and the maximal backdoor search and the three efficient backdoor searches of Smucler, Sapienza and Rotnitzky.

    is_efficient_backdoor_strategy

    fn is_efficient_backdoor_strategy(backdoor_adjustment : String) -> Bool

    Whether the strategy is one of the three efficient backdoor searches.

    optimized_backdoor_adjustment

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

    The backdoor sets of the optimized search.

    The search returns one set per pair of a treatment and an outcome, and no set for a pair whose paths are all blocked already.

    Powered by MoonBit

    Site sourceReport issueModulesSkillsBuild queueStatistics

    © 2026 mooncakes.io