If you mean the dataset, then it seems to be good. I’m using this one. There are no missing entries or anything suspicious I can see.
The regressions themselves gave no errors and seemed to be behaving as they should. Here are the results of pm.traceplot.
I have tried running WAIC with the model that operates only on the original .CSV file without my manipulations, but the result was the same. tt’s very possible that I’m just making some obvious mistake.
Perhaps I’m missing some python package?
The code I tried to run:
import pymc3 as pm
import pandas as pd
import matplotlib.pyplot as plt
plt.style.use('seaborn-darkgrid')
PLA = pd.read_csv('./productliability_award.csv')
with pm.Model() as TH_MODEL:
A = pm.Normal('alpha', mu=0, sd=10)
BL = pm.Normal('betaL', mu=0, sd=10)
BN = pm.Normal('betaN', mu=0, sd=10)
BO = pm.Normal('betaO', mu=0, sd=10)
P = pm.math.invlogit(A + BL * PLA['liability'] + BN * PLA['negligence']
+ BO * PLA['oralArg'])
AWARD = pm.Binomial('awards', n=1, p=P, observed=PLA['award'])
start = pm.find_MAP()
step = pm.Slice()
trace = pm.sample(5000, step=step, start=start)
TH_MODEL_waic = pm.waic(TH_MODEL, trace)
print(TH_MODEL_waic)
And the same exact error:
Traceback (most recent call last):
File "liability_compare_1.py", line 22, in <module>
TH_MODEL_waic = pm.waic(TH_MODEL, trace)
File "/home/eichhorn/.local/lib/python3.6/site-packages/pymc3/stats.py", line 209, in waic
log_py = _log_post_trace(trace, model, progressbar=progressbar)
File "/home/eichhorn/.local/lib/python3.6/site-packages/pymc3/stats.py", line 150, in _log_post_trace
cached = [(var, var.logp_elemwise) for var in model.observed_RVs]
File "/home/eichhorn/.local/lib/python3.6/site-packages/pymc3/backends/base.py", line 324, in __getattr__
type(self).__name__, name))
AttributeError: 'MultiTrace' object has no attribute 'observed_RVs'
