Simple imputation difficulties

The problem with the automatic imputed variables is that they are not transformed to the unconstrained domain as conventional unobserved variables are (in your case your variable is lower bounded at zero). This is something that we fixed in the codebase but will only show up in the next major release.

You wouldn’t have issues with variables that are unconstrained by default such as the Normal.

In the meantime you can split the observed and non observed in two separate distributions:

obs_x = pm.InverseGamma(‘obs_x’,alpha=alpha_m,beta=beta_m,mu=mu_m,observed=observed)
unobs_x = pm.InverseGamma(‘unobs_x’,alpha=alpha_m,beta=beta_m,mu=mu_m, shape=n_unobs)

Which should give you the right results.

Edit: You also seem to have serious sampling issues in your fully observed model, gauging from your plots, so you will need to fix those as well.

2 Likes