Log density

Hi, in the Functions Reference document you list for few selected discrete distributions the explicit form of the log-PMF but I haven’t found any formulas for others or the continous ones.
Is it because you wanted to save space or that you don’t bother with explicitely calculating the log-transformed form for the PDFs and instead calculating simply log(PDF). I suspect it is the former but wanted to be sure.
Best, M

We almost always calculate the log off internally, not sure if there’s an index of that at the math library level

Thanks Krzysztof, could you point me to the place where I could check the implementation? Best, Maciej

It’s the ‘stan-dev/math’ repo on GitHub, all the functions are under the math subdir

Neither. It’s just inconsistency. All else being equal, we’d list all the explicit forms of the functions (log scale for lpdf, etc.) and the derivatives.

Always for lpdf and lpmf. The exception is cdfs, where we calculate almost all of the lcdfs as log(cdf) and all of the lccdfs as log(1 - cdf).

1 Like