Bounded variable NotImplementedError

Hi all,

I am using version 5.10.0 and am trying to sample from a truncated lognormal distribution:

xLogNormalDist = pm.LogNormal.dist(mu=df.xMu, sigma=df.xSigma, shape=len(df))
xTrue = pm.Bound(name="xTrue", dist=xLogNormalDist, lower=1, upper=df.xMax, shape=len(df))

and then use xTrue as an input variable in a logistic regression. I get the following error when trying to perform a prior predictive check:

NotImplementedError: Cannot sample from a bounded variable

I guess the error message is quite self-explanatory but I’m still wondering if there’s anything I’m doing wrong here.

Thanks for any help!

This comment from @ricardoV94 appears to be relevant.

2 Likes

Great, thank you! I’m not sure if I need to worry about the normalization term in my case but I’d guess not since xTrue is unobserved. But maybe someone can confirm/refute this?

Bound is deprecated in favor of Truncated, you can use that instead

1 Like