|
Boost Users : |
Subject: Re: [Boost-users] [distributions]: Inverse Gamma
From: Paul A. Bristow (pbristow_at_[hidden])
Date: 2010-08-04 04:37:30
> -----Original Message-----
> From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Thomas Mang
> Sent: Tuesday, August 03, 2010 3:07 PM
> To: boost-users_at_[hidden]
> Subject: Re: [Boost-users] [distributions]: Inverse Gamma
>
>>
> >> any plans of implementing the inverse gamma distribution as part of the distributions library ?
> >
> > This looks possible - but I'm curious about applications - you obviously have one, but Wikipedia doesn't mention any
> >
> > http://en.wikipedia.org/wiki/Inverse-gamma_distribution
> >
> > But you obviously have one ;-)
>
> Yes I truly have one ;) The inverse gamma distribution and its special
> case, the scaled inverse chi-square distribution, is the conjugate prior
> to the normal distribution variance parameter in Bayesian statistics.
> Pretty much as uncommon and unheard of as it is outside Bayes world [to
> the best of my knowledge], it's very much central to Bayesian stats and
> appears in every textbook right after the introduction chapter ;)
>
> http://en.wikipedia.org/wiki/Scaled_inverse_chi-square_distribution
> http://en.wikipedia.org/wiki/Conjugate_prior
>
> Hence I wonder it has not been requested so far - but being a Bayesian
> C++ / booster I definitely want / need it :).
>
> @John: Yes it is a transformation deviate of the gamma, and an easy so.
> And it should be fairly easy to implement IMHO.
The pdf and pdf etc looks fairly straightforward (only uses exp, pow and gamma?) so I might be persuaded to do these.
But the inverses (qhantiles) may prove more troublesome if have to be done by brute force numerically
R library does it numerically http://rss.acs.unt.edu/Rdoc/library/pscl/html/igamma.html
- or are there analytic expressions for these?
Or can it use the inverse of the gamma distribution?
> Is contribution on my side expected (can be done just notice I am a
> [heavy !] user of the stats library only, not familiar with code /
> numerical stability issues).
I'm not mathematician enough to deal with this - but I can deal with the obfuscated code (by templating and policies) if
you can provide the equations.
(And there is the question of testing - some parameters and value combinations (preferably exact) are needed for sanity
and accuracy checks).
Are there use cases for the inverses?
Paul
--- Paul A. Bristow Prizet Farmhouse Kendal, UK LA8 8AB +44 1539 561830, mobile +44 7714330204 pbristow_at_[hidden]
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net