Skip to content

Commit 29b8a0a

Browse files
committed
update with Ben's requests
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
1 parent e366ba5 commit 29b8a0a

File tree

5 files changed

+12
-2
lines changed

5 files changed

+12
-2
lines changed

causalpy/pymc_experiments.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1802,6 +1802,7 @@ def weighted_percentile(self, data, weights, perc):
18021802
"""
18031803
perc : percentile in [0-1]!
18041804
"""
1805+
assert 0 <= perc <= 1
18051806
ix = np.argsort(data)
18061807
data = data[ix] # sort data
18071808
weights = weights[ix] # sort weights
@@ -1811,6 +1812,13 @@ def weighted_percentile(self, data, weights, perc):
18111812
return np.interp(perc, cdf, data)
18121813

18131814
def plot_balance_ecdf(self, covariate, idata=None, weighting_scheme=None):
1815+
"""
1816+
Plotting function takes a single covariate and shows the
1817+
differences in the ECDF between the treatment and control
1818+
groups before and after weighting. It provides a visual
1819+
check on the balance achieved by using the different weighting
1820+
schemes
1821+
"""
18141822
if idata is None:
18151823
idata = self.idata
18161824
if weighting_scheme is None:

causalpy/pymc_models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,8 @@ def build_model(self, X, t, coords):
414414

415415
def fit(self, X, t, coords):
416416
"""Draw samples from posterior, prior predictive, and posterior predictive
417-
distributions.
417+
distributions. We overwrite the base method because the base method assumes
418+
a variable y and we use t to indicate the treatment variable here.
418419
"""
419420
self.build_model(X, t, coords)
420421
with self:

docs/source/_static/classes.png

46.6 KB
Loading

docs/source/_static/packages.png

-546 Bytes
Loading

docs/source/references.bib

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ @incollection{forde2024nonparam
8282
editor = {PyMC Team},
8383
booktitle = {PyMC examples},
8484
doi = {10.5281/zenodo.5654871},
85-
year = {2024}
85+
year = {2024}
86+
}
8687

8788
@book{shadish_cook_cambell_2002,
8889
title={Experimental and quasi-experimental designs for generalized causal inference},

0 commit comments

Comments
 (0)