Page 1 of 1

GetDist: Getting bestfit parameter values and minimum -loglikelihood from samples

Posted: February 11 2023
by Subhajit Ghosh
Dear All,

Is there a function in GetDist MCSamples which returns bestfit parameter values and minimum -loglikelihood calculated from the chain files (samples) provided?

The naive use of getParamBestFitDict() is resulting in an error "Best fit can only be included if loaded from file and file_root.minimum exists (cannot be calculated from samples)".

Thanks in advance.

Best,
Subhajit

Re: GetDist: Getting bestfit parameter values and minimum -loglikelihood from samples

Posted: February 12 2023
by Subhajit Ghosh
Let me clarify a bit.

I am asking this question in the context of analyzing Montepython output chains. In principle, we have access to the information about the priors of the parameters through the 'log.param' file. But I think GetDist does not read the 'log.param' file. However, is the prior information at all necessary since the output chains already provide -log(likelihood)?

For example, what will go wrong if one sorts the -log(likelihood) of the chains to find the minimum and corresponding data point as the best fit?

Thanks.

Best,
Subhajit

Re: GetDist: Getting bestfit parameter values and minimum -loglikelihood from samples

Posted: February 12 2023
by Antony Lewis
You can get the best fit sample (not the same as the global best fit) using
https://getdist.readthedocs.io/en/latest/mcsamples.html#getdist.mcsamples.MCSamples.getLikeStats

Use Cobaya's minimize function if you actually want the best fit.