joshspeagle / dynesty

Dynamic Nested Sampling package for computing Bayesian posteriors and evidences
https://dynesty.readthedocs.io/
MIT License
346 stars 76 forks source link

Loglstar and logZ values #468

Closed ZcharlieZ closed 6 months ago

ZcharlieZ commented 7 months ago

Dynesty version 2.1.3, installed through pip.

Question Hi all! I am using dynesty to fit some early-type galaxy scaling relations and exploit the evaluation for the evidence. My likelihood consists of the product of two Gaussian distributions and a Skewed Gaussian prior on stellar mass. The sampling of the hyperparameters is reasonable, but I noticed that both the values of the log-likelihood and log-evidence are positive and high. I am surprised by those positive (and high) values. I noticed that, among Dynesty examples, some of them show positive values, such as Eggbox, Gaussian Shels, LogGamma. Maybe I am missing something, although as mentioned, the sampling of parameters is well done and consistent with what is expected. I would like to kindly ask you if you can clarify what loglstar and logz are (their values are 2676.183 < 2682.897 < 2677.056 and 2618.718 +/- 0.291, respectively).

Many thanks in advance for your help.

Carlo

segasai commented 7 months ago

Hi,

loglstar -- is basically the current log(L) values used for sampling (it means currently the log(L)>logl* pooints are generted)

And since log-likelihood is the log of probability density in high dimensional space, the values themselves can be either large or small depending on the distribution. (i.e. try log-likelihood of N-d Gaussian while varying the sigma, you can make the values arbitrary large or small by changing the sigma). The log(z) is by construction integral

$$ \log Z(L) = \log \int\limits_{L\lt L} \pi(x) L(x) dx $$

and again it can be either large or small.