ConjugatePriors.jl
ConjugatePriors.jl copied to clipboard
nu > 0
Is there a reason nu is required to be strictly greater than 0 in the inner constructor? I don't see any reason that it needs to be, and when I was using my own code I often set nu=0 for testing and it didn't have any problems.
(I should clarify this is referring to the NormalGamma distribution)
Hm, with nu = 0
, this is not a proper distribution and one cannot sample anymore from it, compare https://github.com/JuliaStats/ConjugatePriors.jl/blob/8e3a6a79c7f1c9d9efd5720506219929c089933a/src/normalgamma.jl#L48 The originating package Distribution.jl
in general only supports proper distributions. As priors, improper distributions still make sense. What to do?
If you choose nu=0
the marginal prior distribution for location parameter for the Normal Gamma model would be Cauchy distribution. This is a proper distribution for which mean and variance do not exist. However, because prior is a proper distribution, the posterior distribution turns out to be just fine. That is why even if you use nu=0
the simulation works fine. It is not an accident. You can look into Andrew Gelman's book. He gave a beautiful explanation about this (Chapter 2).
Ref: Bayesian Data Analysis (By Andrew Gelman and etal.) Second Ed.
https://www.amazon.in/Bayesian-Analysis-Chapman-Statistical-Science/dp/1439840954/ref=sr_1_1?crid=20GZF006GVZ5E&keywords=bayesian+data+analysis+gelman&qid=1642527457&sprefix=bayesian+data+analysis+ge%2Caps%2C345&sr=8-1