Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zeus fails to estimate parameters on simple example where emcee has no trouble #23

Open
roboticarm2000 opened this issue Nov 27, 2021 · 2 comments

Comments

@roboticarm2000
Copy link

I'm trying a basic example, estimating mean and variance of a bivariate normal distribution given independent samples.
For this example, the prior on the mean and variance is that they are positive.

Emcee has no trouble finding the parameters.
Zeus, however, fails with the following error:

RuntimeError: Number of expansions exceeded maximum limit!
Make sure that the pdf is well-defined.
Otherwise increase the maximum limit (maxiter=10^4 by default).

I tried specifying light_mode true or other moves without success.

Thanks,
Alexis

test7.zip

@minaskar
Copy link
Owner

minaskar commented Nov 29, 2021

Hi Alexis,

I think the problem in this case is the use of improper priors (the prior integral diverges) for the means and variances. In general, I recommend not to use improper priors as they can render the posterior improper as well. When that happens, Metropolis-Hastings-like samplers such as emcee could give either reasonable or erroneous results with no guarantee though.

In general, a proper prior, even a very broad and uninformative one can save one from such problems. For instance, in the example that you describe, using a flat (or uniform) prior on either mean or variance (or both) can fix the issue, even if the upper bound is very high (e.g. 200-1000).

That said, there's another way to force zeus to give consistent results with emcee in this case. By setting maxstep equal to 1 or 2 you can force zeus to take smaller steps in parameter space (like emcee does) and thus don't try to explore regions of parameter space for large values of mu and sigma. In the default configuration of zeus this is exactly what's triggering the error message, zeus is expanding the "slice" trying to capture states with very high variance due to the improper prior.

Let me know if you have any more questions.

Cheers,
Minas

@roboticarm2000
Copy link
Author

thanks. I'll give it a shot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants