Suppose we observe a sample y1, ..., yn from a gamma(alpha, beta) density where the sampling density is proportional to y^{alpha-1} exp(-y/beta), and we assign a uniform prior on (alpha, beta).

As an example, suppose we wish to fit a gamma density to the durations (in minutes) of a group of cell phone calls.

12.2 0.9 0.8 5.3 2.0 1.2 1.2 1.0 0.3 1.8 3.1 2.8

Here is the R function that computes the log posterior of the density:

gamma.sampling.post1=function(theta,data)

{

a=theta[,1]

b=theta[,2]

n=length(data)

val=0*a

for (i in 1:n) val=val+dgamma(data[i],shape=a,scale=b,log=TRUE)

return(val)

}

The first figure is a contour graph of the posterior density of (alpha, beta). (In R, beta is called the scale parameter.)

Note the strong curvature in the posterior.

Instead, suppose we consider the joint posterior of alpha and the "rate" parameter theta = 1/beta. Here is a contour plot of the posterior of (alpha, theta).

This doesn't display the strong curvature.

Last, suppose you consider the joint posterior of alpha and the mean mu = alpha beta. The last figure displays the posterior of (alpha, mu).The moral here is that the choice of parameterization can be important when summarizing the posterior distribution. In the next chapter, we'll suggest a rule of thumb for transforming parameters that makes it easier to summarize many posteriors.

## Tuesday, September 25, 2007

Subscribe to:
Post Comments (Atom)

## No comments:

Post a Comment