Skip to content

Commit e3181f7

Browse files
committed
fix random seed and add PS DAG write up
Signed-off-by: Nathaniel <NathanielF@users.noreply.github.com>
1 parent 0ffe348 commit e3181f7

File tree

3 files changed

+147
-6
lines changed

3 files changed

+147
-6
lines changed

causalpy/pymc_models.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,11 +453,17 @@ def fit(self, X, t, coords):
453453
distributions. We overwrite the base method because the base method assumes
454454
a variable y and we use t to indicate the treatment variable here.
455455
"""
456+
# Ensure random_seed is used in sample_prior_predictive() and
457+
# sample_posterior_predictive() if provided in sample_kwargs.
458+
random_seed = self.sample_kwargs.get("random_seed", None)
459+
456460
self.build_model(X, t, coords)
457461
with self:
458462
self.idata = pm.sample(**self.sample_kwargs)
459-
self.idata.extend(pm.sample_prior_predictive())
463+
self.idata.extend(pm.sample_prior_predictive(random_seed=random_seed))
460464
self.idata.extend(
461-
pm.sample_posterior_predictive(self.idata, progressbar=False)
465+
pm.sample_posterior_predictive(
466+
self.idata, progressbar=False, random_seed=random_seed
467+
)
462468
)
463469
return self.idata
Lines changed: 58 additions & 0 deletions
Loading

docs/source/quasi_dags.ipynb

Lines changed: 81 additions & 4 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)