pymc-devs / pymc2

THIS IS THE **OLD** PYMC PROJECT (VERSION 2). PLEASE USE PYMC INSTEAD:
http://pymc-devs.github.com/pymc/
Other
879 stars 229 forks source link

Misleading documentation for pymc.normal_like #175

Closed strumke closed 6 years ago

strumke commented 6 years ago

Hi! The documentation [1] for pymc.normal_like fails to mention that it actually returns the logarithm of the function, as the source code [2] reveals in the following lines

like = 0.0 like = like - 0.5 tau_tmp (x(i)-mu_tmp)*2 like = like + 0.5dlog(0.5*tau_tmp/PI)

[1] https://pymc-devs.github.io/pymc/distributions.html#pymc.distributions.normal_like [2] https://github.com/pymc-devs/pymc/blob/8733c6686787e0e98bd2445ea5408fe988adf0c9/pymc/flib.f

Thanks!

fonnesbeck commented 6 years ago

The documentation does say log-likelihood:

However, if you have ways of improving the docs, we always welcome pull requests!

strumke commented 6 years ago

Hi and thanks for the reply

My suggestion is to actually write the logarithm in the function, or state explicitly that the function stated is the normal likelihood (and not the normal log-likelihood)

Inga

On 31 January 2018 at 01:52, Chris Fonnesbeck notifications@github.com wrote:

Closed #175 https://github.com/pymc-devs/pymc/issues/175.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pymc-devs/pymc/issues/175#event-1449801023, or mute the thread https://github.com/notifications/unsubscribe-auth/ANoQKEtpqhjl1jPjBherOKXbcTb9xqxJks5tP7legaJpZM4RyAvH .

--

Inga Strümke Skoglien 35 5056 Bergen Norway

+47 95730153 +34 619371726

fonnesbeck commented 6 years ago

I see what you mean. The log-likelihood is just a computational convenience for doing more stable statistical computation, whereas users generally think of distributions in terms of its PDF/PMF, and not the log-transformed scale, so we present those in the documentation. Most users will not have to worry about the fact that the distributions are log-transformed, except when more advanced computations are required. That’s a good point, though, and we should probably state that the formula of PDF/PMF is displayed in the docs.

strumke commented 6 years ago

Hi

Thank you for the reply, and for considering my concern.

Inga

On 31 January 2018 at 17:28, Chris Fonnesbeck notifications@github.com wrote:

I see what you mean. The log-likelihood is just a computational convenience for doing more stable statistical computation, whereas users generally think of distributions in terms of its PDF/PMF, and not the log-transformed scale, so we present those in the documentation. Most users will not have to worry about the fact that the distributions are log-transformed, except when more advanced computations are required. That’s a good point, though, and we should probably state that the formula of PDF/PMF is displayed in the docs.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pymc-devs/pymc/issues/175#issuecomment-361987766, or mute the thread https://github.com/notifications/unsubscribe-auth/ANoQKC6TSzJKaVBTvbTKtA3SF_13IOU-ks5tQJSdgaJpZM4RyAvH .

--

Inga Strümke Skoglien 35 5056 Bergen Norway

+47 95730153 +34 619371726