Formative

quantitative reasoning made simple (but not easy)

$pip install formative-ds
example.py
from formative.causal import DAG, IV2SLS
from formative.game import maximin
 
 
# ---- Causal estimation ----
 
dag = DAG()
dag.assume("proximity").causes("education")
dag.assume("ability").causes("education", "income")
dag.assume("education").causes("income")
 
result = IV2SLS(
dag,
treatment="education",
outcome="income",
instrument="proximity"
).fit(df)
print(result.summary())
 
 
# ---- Game theory ----
 
outcomes = {
"stocks": {"recession": -20, "stagnation": 5, "growth": 30},
"bonds": {"recession": 5, "stagnation": 5, "growth": 7},
"cash": {"recession": 2, "stagnation": 2, "growth": 2},
}
result = maximin(outcomes).solve()
print(result)

Find the right method

Answer a few questions to find the right approach for measuring cause and effect in your situation.

Methods

1

Can you decide who receives the intervention?

Do you have the ability to choose or control who gets the treatment?