Skip to content

Commit dbdcd83

Browse files
committed
update README + index.rst quickstart
1 parent 493a7b3 commit dbdcd83

File tree

3 files changed

+35
-83
lines changed

3 files changed

+35
-83
lines changed

README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,27 +37,23 @@ pip install git+https://github.com/pymc-labs/CausalPy.git
3737
## Quickstart
3838

3939
```python
40-
from causalpy.pymc_experiments import RegressionDiscontinuity
41-
from causalpy.pymc_models import LinearRegression
42-
import pandas as pd
43-
import pathlib
40+
import causalpy as cp
4441

4542

4643
# Import and process data
47-
rd_data_path = pathlib.Path.cwd().parents[1] / "causalpy" / "data" / "drinking.csv"
4844
df = (
49-
pd.read_csv(rd_data_path)[["agecell", "all", "mva", "suicide"]]
45+
cp.load_data("drinking")
5046
.rename(columns={"agecell": "age"})
5147
.assign(treated=lambda df_: df_.age > 21)
5248
.dropna(axis=0)
5349
)
5450

5551
# Run the analysis
56-
result = RegressionDiscontinuity(
52+
result = cp.pymc_experiments.RegressionDiscontinuity(
5753
df,
5854
formula="all ~ 1 + age + treated",
5955
running_variable_name="age",
60-
prediction_model=LinearRegression(),
56+
prediction_model=cp.pymc_models.LinearRegression(),
6157
treatment_threshold=21,
6258
)
6359

docs/index.rst

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,27 +29,23 @@ Quickstart
2929

3030
.. code-block:: python
3131
32-
from causalpy.pymc_experiments import RegressionDiscontinuity
33-
from causalpy.pymc_models import LinearRegression
34-
import pandas as pd
35-
import pathlib
32+
import causalpy as cp
3633
3734
3835
# Import and process data
39-
rd_data_path = pathlib.Path.cwd().parents[1] / "causalpy" / "data" / "drinking.csv"
4036
df = (
41-
pd.read_csv(rd_data_path)[["agecell", "all", "mva", "suicide"]]
37+
cp.load_data("drinking")
4238
.rename(columns={"agecell": "age"})
4339
.assign(treated=lambda df_: df_.age > 21)
4440
.dropna(axis=0)
4541
)
4642
4743
# Run the analysis
48-
result = RegressionDiscontinuity(
44+
result = cp.pymc_experiments.RegressionDiscontinuity(
4945
df,
5046
formula="all ~ 1 + age + treated",
5147
running_variable_name="age",
52-
prediction_model=LinearRegression(),
48+
prediction_model=cp.pymc_models.LinearRegression(),
5349
treatment_threshold=21,
5450
)
5551

docs/notebooks/sc_skl.ipynb

Lines changed: 27 additions & 67 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)