I have a model with two observed varialbes, Fz_obs
and RPM_obs
. After sampling the model, I try to run posterior predictive checks as follows
with Fz_model:
pymc.sample_posterior_predictive(idata,
var_names=['Fz_obs','RPM_obs'],
extend_inferencedata=True,
return_inferencedata=True)
az.plot_ppc(idata)
However, when I run this, I get the following error message
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
File ~/.cache/pypoetry/virtualenvs/tool-insight-HtaDeJzl-py3.10/lib/python3.10/site-packages/arviz/utils.py:71, in _var_names(var_names, data, filter_vars)
70 try:
---> 71 var_names = _subset_list(var_names, all_vars, filter_items=filter_vars, warn=False)
72 except KeyError as err:
File ~/.cache/pypoetry/virtualenvs/tool-insight-HtaDeJzl-py3.10/lib/python3.10/site-packages/arviz/utils.py:149, in _subset_list(subset, whole_list, filter_items, warn)
148 if not np.all(existing_items):
--> 149 raise KeyError(f"{np.array(subset)[~existing_items]} are not present")
151 return subset
KeyError: "['RPM_obs'] are not present"
Examining the posterior_predictive
section of idata
, it does indeed appear that the posterior predictive distribution has only been generated for Fz_obs
and not for RPM_obs
. Why has this happened and what can I do about it?