Ten participants each attempt a task once with a new instruction card, and seven succeed. The sample proportion is , but ten trials leave real doubt about the success probability behind them. In the previous lesson the unknown rate could take only a few listed values. Here may be any number between and , so the prior and the posterior become distributions on that whole interval. This lesson uses the beta family to update such a distribution, summarizes the result, and shows how to read a credible interval. The data are constructed for teaching, and the model assumes that the ten attempts are independent given and share the same .
Key terms
Beta distribution
Definition Let and be two shape parameters. A quantity with values in the interval has the beta distribution if it has the density
for , where the constant is the area under over , so that the total area is . For whole numbers it equals . The mean and variance are
As for every density, probabilities are areas under the curve, and the height of the curve is not a probability.
In plain words The beta family is a flexible set of curves on the interval from to , which makes it a natural way to describe uncertainty about an unknown probability. The shape parameters are not the probability itself. They set where the curve puts its weight. With the curve is flat. Equal parameters give a curve symmetric about , more concentrated the larger they are, and a larger relative to moves the mean toward .
Example For the constant is , so the density is . Its mean is and its variance is . Its cumulative distribution function is , so the probability that lies between and is . The density reaches at . That height is larger than , yet every probability, being an area, stays between and .
Beta-binomial conjugacy
Definition Suppose that, given , the number of successes in trials is , as it is when the trials are independent given and each succeeds with probability . Write for the prior density and for the posterior density. If the prior is and successes are observed, with , then the posterior density is proportional to the likelihood times the prior density,
where
The binomial coefficient does not depend on and is absorbed into the normalizing constant. The only density with this shape is a beta density, so the posterior is , that is, . A family of priors is called conjugate to a likelihood when the posterior always stays in the same family, and the beta family is conjugate to the binomial likelihood.
In plain words Each success adds to the first shape parameter and each failure adds to the second. Conjugacy turns the update into addition. It does not show that the binomial model fits the data or that the prior is a good one, and those still have to be argued.
Example With the prior and successes in trials, the posterior density is proportional to . Shape parameters are one more than the exponents, so the posterior is , not . Updating in batches gives the same answer under the same model. If the first attempts contain successes, the prior becomes , and the remaining attempts with successes turn that into . Recording the order of the outcomes instead of only the count changes the likelihood by a constant factor and leaves the posterior unchanged.
Posterior mean
Definition The posterior mean is the mean of the posterior distribution. For the posterior it is
For it is a weighted average of the prior mean and the sample proportion ,
with weight on the data. So it lies between the prior mean and , and for a fixed prior the weight on approaches as grows. Among all single-number estimates of , the posterior mean gives the smallest posterior expected squared error.
In plain words The posterior mean is the prior’s center pulled toward the observed proportion, and more data pull harder. In this formula the sum plays the part of a number of trials, which is why the shape parameters are sometimes called prior successes and failures. That reading is a convention for this summary, not a record of past data. The parameters need not be whole numbers, and other summaries suggest other counts. Lying between the prior mean and is a fact about the estimate, and the true may lie outside that range.
Example For the posterior, . The weight on the data is , and
The posterior standard deviation is , a reminder that the single number leaves plenty of uncertainty.
Posterior median
Definition A posterior median of is a value with and . The cumulative distribution function of a beta posterior is continuous and strictly increasing on , so the posterior median is the unique with . Except in special cases it has no simple formula and is found numerically. Among all single-number estimates of , the posterior median gives the smallest posterior expected absolute error.
In plain words Half the posterior probability lies below the median and half above it. For a symmetric posterior the median and the mean coincide. For a skewed posterior they usually differ, and neither one shows how spread out the posterior is.
Example For a numerical quantile routine gives the median , slightly above the mean . The posterior is skewed, with a longer tail toward , and its peak is at , so the mean, the median and the peak appear in that order from left to right. For a symmetric posterior such as all three equal .
Credible interval
Definition Let . A credible interval for at level is an interval whose posterior probability is ,
The probability is computed from the posterior distribution, so it is conditional on the likelihood model, the prior and the observed data. Many intervals have the same posterior probability, so a report should name its construction. Two common ones are the equal-tailed interval of the next card and the highest posterior density interval, which keeps every value whose posterior density is above a cutoff. For a posterior density with a single peak, the highest posterior density interval is the shortest interval with probability . A credible interval is defined differently from a confidence interval. A 95 percent confidence procedure is built to cover each fixed value of in 95 percent of repeated samples, exactly or approximately, while a credible interval is a probability statement about given the data, and the procedure that produces it need not have 95 percent coverage at every .
In plain words Given the model, the prior and the data, the posterior assigns probability to the event that lies in the interval. The interval describes uncertainty about the parameter. Individual outcomes are or and do not spread across the interval. A different prior or a different model usually gives a different interval.
Example For the posterior the interval , constructed in the next card, has posterior probability . The same posterior answers other questions directly, for example , which is a posterior probability about and not a p-value. The 95 percent Wilson confidence interval for successes in trials is about , close in its numbers but a statement about a procedure. Coverage is a separate question. With , the 95 percent equal-tailed procedure under this prior covers in about percent of samples, but if the true were it would cover it only when , which has probability .
Equal-tailed credible interval
Definition Let be the cumulative distribution function of a continuous posterior, and for let the posterior quantile be a value with . The equal-tailed credible interval at level is . At level its endpoints solve
so posterior probability lies below the interval and above it. For a beta posterior the quantiles are unique, and they are usually found with a numerical quantile routine. When the posterior is skewed, the equal-tailed interval generally differs from the highest posterior density interval, and it can contain values of lower density than some values it leaves out.
In plain words Cut off half of the remaining posterior probability at each end and keep the middle, so a 95 percent interval leaves out percent at each end. The rule is easy to state and to compute, and the interval always contains the median. Equal tails do not mean equal distances from the center.
Example For the quantiles are and . Conditional on the binomial model, the prior and the seven successes, lies between these endpoints with posterior probability , up to rounding of the endpoints. The lower endpoint is below the median and the upper endpoint only above it, because of the skew. The highest posterior density interval is about , slightly shorter, with width against . The density is about at the lower equal-tailed endpoint and at the upper one, so the equal-tailed interval keeps some values near while leaving out values just above that have higher density.
Check yourself
- Keep the prior, but suppose the ten attempts give successes and failures. Find the posterior, its mean, its median and its 95 percent equal-tailed credible interval, using the results for above. What does the interval describe?
Show the answer
Three successes add to the first parameter and seven failures add to the second, so the posterior is with mean . If has the distribution, then has the distribution, so the new posterior is the old one reflected about . The median is about , and the interval endpoints are reflected and swapped, giving about . The interval describes uncertainty about the common success probability . It is not a range for individual outcomes, each of which is or .
- A report on the original data says that the 95 percent credible interval means two things. If the study were repeated many times, 95 percent of such intervals would contain , and about 95 percent of future participants will have outcomes in this range. Correct both claims and state what the interval does mean.
Show the answer
The interval means that, given the binomial model, the prior and the observed successes in trials, the posterior probability that lies between and is about . The first claim describes confidence coverage, a property of a procedure over repeated samples, and a credible procedure does not guarantee it. With this prior and , the equal-tailed procedure would cover a true of only about 60 percent of the time. The second claim confuses the parameter with the outcomes. Each future outcome is or , so none of them falls inside , and a statement about future outcomes needs a predictive distribution.
- With a flat prior, five attempts that are independent given all fail. Find the posterior, its mean and median, the 95 percent equal-tailed credible interval and the 95 percent highest posterior density interval. Use the fact that the posterior cumulative distribution function is . Why do the two intervals differ?
Show the answer
The posterior is , with density and mean . Solving gives the median . The equal-tailed endpoints solve and , so
which are about and . The density is largest at and decreases, so the highest posterior density interval starts at and ends where the probability reaches , at . That interval, , is shorter than the equal-tailed interval . The equal-tailed rule must leave percent of the probability below its lower endpoint, so it excludes the values near where the density is highest. Both intervals have posterior probability , which is why a report should say which construction it used. Five failures also do not show that . The posterior probability that exceeds is .