How to Use CausalLens
A step-by-step guide for non-technical users. No statistics PhD required.
5-minute quick start
- 1. Open the app → choose Clinical Treatment Effects
- 2. Click Use sample dataset
- 3. Set treatment =
metformin, outcome =hba1c - 4. Select confounders: age, bmi, baseline_severity
- 5. Pick 2 methods → Run causal analysis
What is causal inference?
Correlation means two things move together. Causation means one thing makes another change. CausalLens helps you estimate causal effects — but results always depend on assumptions about your data.
| Type | Example | CausalLens? |
|---|---|---|
| Correlation | Ice cream sales and drowning both rise in summer | No |
| Causation | Does this drug cause lower blood sugar? | Yes |
| Causation | Did minimum wage policy cause employment changes? | Yes |
The 5 wizard steps
Step 1 — Choose your field
Pick the domain closest to your question. This tunes AI suggestions and recommended methods.
- Medicine — treatments, drugs, health outcomes
- Science — experiments, lab and field data
- Socioeconomic — income, employment, demographics
- Marketing — campaigns, who responds to outreach
- Policy — laws, subsidies, public programs
Step 2 — Load your data
You have three options:
- Use sample dataset — fastest way to learn (recommended first time)
- Upload file — CSV or Excel with column headers in row 1
- Select existing — previously uploaded datasets
Your data needs at minimum:
- A treatment column (the intervention: 0/1 or yes/no works best)
- An outcome column (what you measure)
- Optional confounders (factors affecting both treatment and outcome)
Step 3 — Define your question
Write your question in plain English, then map it to columns:
Example question:
“Does metformin reduce HbA1c, adjusting for age and BMI?”
Column mapping:
Treatment → metformin · Outcome → hba1c · Confounders → age, bmi, baseline_severity
Click AI suggest variables & methods for automatic suggestions. Works without an API key; richer with OpenAI configured in backend/.env.
Confounders tip: Ask “Could this factor affect who gets the treatment AND the outcome?” If yes, include it.
Step 4 — Pick methods
Select one or more analysis methods. We recommend running at least two and comparing results.
| Method | Level | In plain English |
|---|---|---|
| Propensity Score Matching | Beginner | Match similar treated and control patients |
| Inverse Probability Weighting | Beginner | Reweight data to balance groups |
| DoWhy Backdoor | Intermediate | Formal causal model with explicit assumptions |
| Double / Debiased ML | Intermediate | Flexible machine learning approach |
| Causal Forest | Advanced | Different effects for different subgroups |
| T-Learner (Uplift) | Intermediate | Who benefits most from a campaign? |
| Difference-in-Differences | Intermediate | Before/after policy comparison |
| PC / LiNGAM Discovery | Advanced | Discover cause-effect structure from data |
Step 5 — Read your results
Each method produces a result card with:
- Effect estimate — the estimated causal effect (e.g. −0.93 on HbA1c)
- 95% confidence interval — plausible range for the true effect
- Interpretation — what the number means in your context
- Key assumptions — what must be true for a causal claim
You also get an AI summary in plain English and a causal graphshowing relationships between variables.
Worked example: Diabetes study
Follow along with the built-in medicine sample:
- Choose Clinical Treatment Effects
- Click Use sample dataset
- Question: “Does metformin reduce HbA1c?”
- Treatment:
metformin· Outcome:hba1c - Confounders:
age,bmi,baseline_severity - Methods: Propensity Score Matching + DoWhy Backdoor
- Run analysis → expect a negative effect (metformin lowers blood sugar)
Using your own CSV
Checklist
- Column headers in the first row (descriptive names like
age, notColumn1) - Treatment column is 0/1 or yes/no
- Outcome is numeric for most methods
- At least 50–100 rows recommended
- Confounders measured before treatment when possible
Example CSV
treatment,outcome,age,income 1,45000,35,52000 0,38000,42,48000 1,51000,28,55000
Common mistakes
- Outcome before treatment — reverses causality
- Missing confounders — biased estimates
- Too few treated units — unreliable results
- Confusing correlation with causation — wrong conclusions
Glossary
- Treatment
- The intervention you study (drug, policy, campaign)
- Outcome
- What you measure as a result
- Confounder
- A factor affecting both treatment and outcome
- ATE
- Average treatment effect for the whole population
- Propensity score
- Probability of receiving treatment given confounders
- Difference-in-Differences
- Compares change over time between treated and control groups
FAQ
How many methods should I run?
At least two. If they agree, you have more confidence. If they disagree, review assumptions and data quality.
Can the app prove causation?
No. CausalLens estimates effects under stated assumptions. Your study design and domain expertise matter.
Do I need OpenAI?
No. The app works fully without it. An API key enables richer AI explanations and hybrid causal discovery.
Where is the full written tutorial?
See TUTORIAL.md in the project folder for the complete guide with all domain examples.