Skip to content

Documentation improvement suggestions #282

@njmmerrill

Description

@njmmerrill

@djinnome

I went through the dsl and identify algorithm files and think that these changes to documentation will make things more clear.

Typo

ff should be if

Will raise a value error ff the value of a new intervention conflicts

Clarity

When I was reading through the documentation, whenever I had to take extra time to decipher the language I tried to rewrite a version that I thought would be more clear.

y0/src/y0/dsl.py

Lines 18 to 24 in 88d7e39

============================== =================================================
Expression Description
============================== =================================================
:math:`P(Y_X \mid X^*, Y^*)` Probability of sufficient causation
:math:`P(Y^*_{X^*} \mid X, Y)` Probability of necessary causation
:math:`P(Y_X, Y^*_{X^*})` Probability of necessary and sufficient causation
============================== =================================================

I like to use plain (non-statistics) language when possible to increase understanding. I would consider adding a plain language column for the table

==============================  =================================================  ===============================================================
Expression                      Description                                        Example
==============================  =================================================  ===============================================================
:math:`P(Y_X \mid X^*, Y^*)`    Probability of sufficient causation               Would the outcome have changed if treated?
:math:`P(Y^*_{X^*} \mid X, Y)`  Probability of necessary causation                Would the outcome have failed without treatment?
:math:`P(Y_X, Y^*_{X^*})`       Probability of necessary and sufficient causation Did treatment cause the outcome, and would it have failed otherwise?
==============================  =================================================  ===============================================================

Counterfactual variables are like normal variables, but can have a list of interventions.

minor changes

A counterfactual variable used in formal causal reasoning. Counterfactual variables are like normal variables, but can have a set of interventions. Each intervention will either match the observed reality (no star) or represent deviations (star).

def to_text(self) -> str:

Can we add and example of output here? I don't remember what it is.

"""Output this counterfactual variable in the internal string format (e.g., "Y_{X*}")."""

"""Return if the counterfactual variable violates the Axiom of Effectiveness.

I am in favor of adding plain language for potential non-stats people.
Check whether the counterfactual variable violates the Axiom of Effectiveness (i.e., forcing a variable to a value but observing a different value).

:param variables: The variable(s) used to extend this counterfactual variable's

The variable(s) to intervene on. These will be added to the counterfactual variable’s current interventions.

"""Invert the value of the counterfactual variable."""

Again, I am in favor of adding plain language for potential non-stats people.
Invert the value of the counterfactual variable (i.e. Y^{-} becomes Y^{+} and vice versa).

Identify properties

def outcomes(self) -> set[Variable]:
"""Return this identification object's query's outcomes."""
return self.query.outcomes
@property
def treatments(self) -> set[Variable]:
"""Return this identification object's query's treatments."""
return self.query.treatments
@property
def conditions(self) -> set[Variable]:
"""Return this identification object's query's conditions."""
return self.query.conditions

I think these property descriptions are confusing to read.
I would change to something like this:

  • Return the outcome variables from the query stored in this identification object.
  • Return the treatment variables from the query stored in this identification object.
  • Return the condition from the query stored in this identification object.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions