Transport

Implement of surrogate outcomes and transportability from https://arxiv.org/abs/1806.07172.

identify_target_outcomes(graph: NxMixedGraph, *, target_outcomes: Set[Variable], target_interventions: Set[Variable], surrogate_outcomes: Dict[Variable, Set[Variable]], surrogate_interventions: Dict[Variable, Set[Variable]]) Expression | None[source]

Get the estimand for the target outcome givne the surrogate outcomes.

See also

Originally described in https://arxiv.org/abs/1806.07172.

Parameters:
  • target_outcomes – A set of target variables for causal effects.

  • target_interventions – A set of interventions for the target domain.

  • graph – The graph of the target domain.

  • surrogate_outcomes – A dictionary of outcomes in other populations

  • surrogate_interventions – A dictionary of interventions in other populations

Returns:

An Expression evaluating the given query, or None

Raises:

ValueError – If the target outcomes and target interventions intersect

The example from figure 8 of the original paper can be executed with the following code:

from y0.algorithm.transport import identify_target_outcome
from y0.dsl import X1, X2, Y1, Y2, Pi1, Pi2
from y0.examples import tikka_trso_figure_8_graph

estimand = identify_target_outcome(
    graph=tikka_trso_figure_8_graph,
    target_outcomes={Y1, Y2},
    target_interventions={X1, X2},
    surrogate_outcomes={Pi1: {Y1}, Pi2: {Y2}},
    surrogate_interventions={Pi1: {X1}, Pi2: {X2}},
)

This returns the following estimand: \(\sum_{W, Z} P(W, Z) \frac{P_{X_1}^{π_1}(W, Y_1, Z)}{P_{X_1}(W, Z)} \frac{P_{X_2}^{π_2}(W, X_1, Y_2, Z)}{P_{X_2}(W, X_1, Z)}\)

trso(query: TRSOQuery) Expression | None[source]

Run the TRSO algorithm to evaluate a transport problem.

Parameters:

query – A TRSO query, which contains 8 instance variables needed for TRSO

Returns:

An Expression evaluating the given query, or None

Raises:

RuntimeError – when an impossible condition is met

class TransportQuery(target_interventions: Set[Variable], target_outcomes: Set[Variable], graphs: Dict[Variable, NxMixedGraph], domains: Set[Variable], surrogate_interventions: Dict[Variable, Set[Variable]], target_experiments: Set[Variable])[source]

A query used as output for surrogate_to_transport.