Statistics & probability

Dirichlet posterior predictive calculator for categorical counts

Update positive Dirichlet prior parameters with counts and calculate next-category probabilities plus Dirichlet–multinomial future-count mass.

Your numbers

Enter 1–20 positive prior parameters, each at most 1,000,000.
Matching nonnegative whole-number counts; total at most 1,000,000.
Use the same category order; nonnegative whole counts, total at most 1,000,000.

Calculated on your device. Your inputs aren’t sent to us.

Your result

Ready when you are

Enter your inputs and select Calculate.

Report an issue

Behind the numbers

How this calculation works

A Dirichlet prior represents uncertainty about a shared categorical probability vector. Observed category counts update its parameters by addition. Dividing the updated parameters by their total gives posterior mean probabilities and next-draw predictive probabilities. For several future draws, integrating over the same unknown probability vector produces a Dirichlet–multinomial distribution. This page reports both the updated category summaries and the probability of the entered future count vector.

THE FORMULAalpha′_i = alpha_i+c_i; P(next=i)=alpha′_i/Σalpha′; future counts follow a Dirichlet–multinomial distribution.

A worked example

Prior alpha 1,1,1 with observed counts 4,2,0 gives posterior alpha 5,3,1 and total concentration nine. The next-category probabilities are 5/9,3/9,1/9. For future counts 2,1,0, the integrated count-vector probability is 3×(5×6×3)/(9×10×11) = 3/11≈0.27272727. A multinomial evaluated at posterior mean probabilities instead gives 25/81≈0.30864198; it is a different joint predictive model.

Good to know

Supports 1–20 aligned categories with strictly positive prior parameters. Observed and future counts are nonnegative integers, each vector totaling at most 1,000,000. The model assumes exchangeable categorical observations sharing one unknown probability vector. It does not estimate prior hyperparameters, handle time-varying category probabilities or return credible intervals for individual parameters. Log predictive mass is provided for numerical underflow.

Prior concentration controls how much observations move the mean

Prior vectors 1,1,1 and 100,100,100 have the same prior mean but very different concentration. The latter places more weight on probabilities near equal shares, so the same small count sample changes its posterior mean less. Read alpha as model parameters controlling both center and uncertainty, rather than describing every choice as if it were literally a collection of previously observed trials.

A category with no observed occurrences retains a positive updated parameter when its prior alpha is positive. Its next-draw probability is therefore not forced to zero. This is useful when absence in a finite sample should not make future occurrence impossible, but it is still a modeling decision. If a category is structurally impossible, define a different category space rather than hiding that constraint inside an arbitrarily tiny prior parameter.

Observed counts update equal prior parameters to five three and onePrior alpha + counts = posterior1 + 4 = 51 + 2 = 31 + 0 = 15/93/91/9
Prior alpha (1,1,1) plus counts (4,2,0) gives posterior (5,3,1). The next-draw predictive shares are 5/9,3/9,1/9. Future multi-draw predictions integrate the remaining parameter uncertainty.

The Multinomial probability calculator from counts uses a fixed probability vector. Its plug-in joint mass generally differs from this uncertainty-integrated prediction.

Future draws share uncertainty about the same probability vector

Conditional on a particular probability vector, the future draws are independent. After that unknown vector is integrated out, their outcomes are related through the shared uncertainty. This is why plugging posterior means into an ordinary multinomial does not give the correct multi-draw predictive mass. The difference can be substantial with low posterior concentration and becomes smaller as uncertainty about the vector decreases.

The future counts describe one complete vector of totals, so the multinomial arrangement coefficient is included. All-zero future counts give probability one for the empty sequence. Keep category order unchanged across prior, observed and future lists: the arithmetic cannot infer that a reordered label represents the same category. The output table exposes the aligned prior and posterior values so that a worksheet transcription can be checked before interpretation.

A few questions, answered

Is alpha=0 allowed for an unseen category?

No. This page uses proper Dirichlet priors with every parameter positive. Zero observed counts are allowed; a zero prior parameter is a different, unsupported construction.

Can I obtain only next-draw probabilities?

Yes. Enter an all-zero future vector to focus on the posterior table. Its next-draw probabilities remain available, while the empty future vector has mass one.

Find your calculator

Start typing to explore the library.