Re: [S] 95 % Hightest posterior density region

Dave Krantz (
Wed, 19 Aug 1998 19:04:10 -0400 (EDT)

I have a fairly crude function (but it works!) that finds highest
density intervals for beta distributions. It is based on the
principle that the density must be the same at the upper and lower
endpoints of a highest density interval. My procedure uses
the Newton-Raphson method to approximate the zero for the absolute
value of the logarithm of the ratio of the densities at the two
endpoints of the interval. I used the lower-tail probability
of the beta distribution as the parameter, and used a secant slope
to estimate the derivative of the absolute log density ratio.
The function was written to take a 2xN matrix of beta parameters,
representing N betas, and it returns a 2xN matrix of interval
endpoints. I don't think it would be hard to adapt this to other
parametric families of densities for which Splus has d- and q-
functions. [I use dbeta() to get densities from quantiles, and
I use qbeta() to get quantiles from the current estimate of lower
tail probability.]

Dave Krantz
This message was distributed by To unsubscribe
send e-mail to with the BODY of the
message: unsubscribe s-news