pymc-labs / CausalPy

A Python package for causal inference in quasi-experimental settings
https://causalpy.readthedocs.io
Apache License 2.0
881 stars 63 forks source link

Remove `InstrumentalVariableRegression.fit` method #329

Closed drbenvincent closed 4 months ago

drbenvincent commented 4 months ago

The InstrumentalVariableRegression.fit method overrides the ModelBuilder.fit method, but from what I can see this is unnecessary. And it actually is behind the curve because it doesn't grab the random_seed and provide it to pm.sample_prior_predictive or pm.sample_posterior_predictive.

Obviously check that local tests pass. As of right now we have some issues with doctests, see #323, and I'm actively working on that.

cc @NathanielF

anevolbap commented 4 months ago

The InstrumentalVariableRegression.fit method overrides ModelBuilder.fit to accommodate the Z dataframe, which is also necessary for the build_model method. Perhaps it would be simpler to just include the random_seed.

drbenvincent commented 4 months ago

Ah I checked to quickly and missed that. Yes, in that case we just need the random seed in there.

anevolbap commented 4 months ago

Ah I checked to quickly and missed that. Yes, in that case we just need the random seed in there.

Done here.