Tutorials › Generalized Linear Models › Predicting Success Counts and Proportions

Grouped Binomial Regression · Tutorial 404 of 981

Predicting Success Counts and Proportions

Translate a fitted group probability into expected outcomes and a binomial predictive distribution for a future group.

Intermediate 9 min read

What You'll Learn

  • Calculate expected future success counts and proportions from a fitted group probability and trial total
  • Write and use the plug-in binomial predictive distribution for a future group
  • Derive the predictive mean and variance of counts and proportions
  • Calculate probabilities of exact counts and threshold events
  • Distinguish binomial response variation from uncertainty in the fitted model
  • Recognize when the binomial prediction relies on within-group homogeneity and independence

From a Fitted Probability to a Prediction

A fitted probability is not a forecast that every future group will have exactly that observed proportion. It describes the success chance assigned by the model to a group with specified covariates. Given that probability and a future trial total, the binomial model describes the variation in the group’s success count. This lets us report both a typical outcome and probabilities of less or more typical outcomes.

Suppose a grouped logistic regression has been fitted and a future group’s covariates are specified. Write \(\hat p_{\mathrm{new}}\) for the model’s fitted success probability at those covariates, and let \(m_{\mathrm{new}}\) be the number of trials in that group. The prediction below treats the covariates and trial total as fixed. It is a plug-in prediction: it uses the fitted probability in place of the unknown model probability.

Definition: Under the plug-in grouped-binomial model, the future success count \(Y_{\mathrm{new}}\), conditional on the specified group and its trial total, has distribution \(Y_{\mathrm{new}}\sim\operatorname{Binomial}(m_{\mathrm{new}},\hat p_{\mathrm{new}})\). The future observed proportion is \(\hat P_{\mathrm{new}}=Y_{\mathrm{new}}/m_{\mathrm{new}}\), for \(m_{\mathrm{new}}>0\). The fitted probability \(\hat p_{\mathrm{new}}\) is the mean of that proportion under this plug-in distribution; it is not a guarantee about the observed proportion.

For a grouped logistic regression with coefficient estimate \(\hat\beta\) and covariate vector \(x_{\mathrm{new}}\), the fitted probability is \(\hat p_{\mathrm{new}}=\exp(x_{\mathrm{new}}^{T}\hat\beta)/(1+\exp(x_{\mathrm{new}}^{T}\hat\beta))\). Once that probability is obtained, the predictive calculations use the binomial distribution. The number of trials matters: the same fitted probability can imply the same expected proportion but different expected counts and different amounts of sampling variation.

Expected Count and Expected Proportion

The expected number of successes is the number of trials multiplied by the fitted probability. Dividing the count by the trial total gives the expected observed proportion. These statements follow directly by representing the count as a sum of trial-level success indicators.

Result: If \(Y_{\mathrm{new}}\sim\operatorname{Binomial}(m_{\mathrm{new}},\hat p_{\mathrm{new}})\), then \(E[Y_{\mathrm{new}}]=m_{\mathrm{new}}\hat p_{\mathrm{new}}\) and \(E[\hat P_{\mathrm{new}}]=\hat p_{\mathrm{new}}\).

To derive the result, let \(I_j\) equal 1 if trial \(j\) is a success and 0 otherwise, for \(j=1,\ldots,m_{\mathrm{new}}\). Under the binomial model these indicators are independent, each with success probability \(\hat p_{\mathrm{new}}\). Thus \(Y_{\mathrm{new}}=\sum_{j=1}^{m_{\mathrm{new}}} I_j\). By linearity of expectation and \(E[I_j]=\hat p_{\mathrm{new}}\),

$$ E[Y_{\mathrm{new}}] =\sum_{j=1}^{m_{\mathrm{new}}}E[I_j] =m_{\mathrm{new}}\hat p_{\mathrm{new}}. $$

Since \(\hat P_{\mathrm{new}}=Y_{\mathrm{new}}/m_{\mathrm{new}}\), linearity also gives \(E[\hat P_{\mathrm{new}}]=E[Y_{\mathrm{new}}]/m_{\mathrm{new}}=\hat p_{\mathrm{new}}\). This is an expectation over possible future outcomes, not a statement that the observed proportion must equal its expectation.

Worked Example: Expected Outcomes for a New Group

A fitted model assigns a future group a success probability of \(0.30\). The group will have 20 trials. Calculate the expected success count and expected success proportion.

The plug-in distribution is \(Y_{\mathrm{new}}\sim\operatorname{Binomial}(20,0.30)\). Therefore, \(E[Y_{\mathrm{new}}]=20(0.30)=6\) successes. The observed proportion is \(Y_{\mathrm{new}}/20\), so its expectation is \(6/20=0.30\). Equivalently, \(E[\hat P_{\mathrm{new}}]=0.30\).

Six is an average over possible future groups, not a prediction that the group must have exactly six successes. The actual count can be any integer from 0 through 20 under this model.

The Predictive Distribution

An expectation summarizes the center of a distribution but not the probabilities of particular outcomes. The full plug-in predictive distribution gives the probability of each possible count \(y=0,1,\ldots,m_{\mathrm{new}}\).

Result: For \(Y_{\mathrm{new}}\sim\operatorname{Binomial}(m_{\mathrm{new}},\hat p_{\mathrm{new}})\), $$ P(Y_{\mathrm{new}}=y) ={m_{\mathrm{new}}\choose y} \hat p_{\mathrm{new}}^{\,y} (1-\hat p_{\mathrm{new}})^{m_{\mathrm{new}}-y}, \qquad y=0,\ldots,m_{\mathrm{new}}. $$

This probability formula follows by considering the individual trial outcomes. Any one specified pattern with \(y\) successes and \(m_{\mathrm{new}}-y\) failures has probability \(\hat p_{\mathrm{new}}^{\,y}(1-\hat p_{\mathrm{new}})^{m_{\mathrm{new}}-y}\), by independence. There are \({m_{\mathrm{new}}\choose y}\) different patterns with exactly \(y\) successes. Those patterns are disjoint and have equal probability, so adding their probabilities gives the formula. The coefficients across all possible counts sum to one by the binomial theorem.

The variance also quantifies the spread. Since each indicator has variance \(\hat p_{\mathrm{new}}(1-\hat p_{\mathrm{new}})\), independence makes the variance of their sum the sum of their variances. Dividing the count by \(m_{\mathrm{new}}\) scales variance by \(1/m_{\mathrm{new}}^2\). Consequently,

$$ \operatorname{Var}(Y_{\mathrm{new}}) =m_{\mathrm{new}}\hat p_{\mathrm{new}}(1-\hat p_{\mathrm{new}}), \qquad \operatorname{Var}(\hat P_{\mathrm{new}}) =\frac{\hat p_{\mathrm{new}}(1-\hat p_{\mathrm{new}})}{m_{\mathrm{new}}}. $$

The second formula explains why a larger trial total typically yields a less variable observed proportion, even though its expectation remains the same. It describes variation in the future outcomes under the plug-in model.

Worked Example: Probability of a High Success Count

For a future group, suppose \(\hat p_{\mathrm{new}}=0.25\) and \(m_{\mathrm{new}}=8\). Find the probability of at least three successes.

Here \(Y_{\mathrm{new}}\sim\operatorname{Binomial}(8,0.25)\). It is simpler to subtract the probabilities of zero, one, and two successes from one:

\(P(Y_{\mathrm{new}}\geq 3)=1-\{P(Y_{\mathrm{new}}=0)+P(Y_{\mathrm{new}}=1)+P(Y_{\mathrm{new}}=2)\}\).

Using the binomial formula, \(P(Y_{\mathrm{new}}=0)=0.75^8=6561/65536\), \(P(Y_{\mathrm{new}}=1)=8(0.25)(0.75^7)=17496/65536\), and \(P(Y_{\mathrm{new}}=2)={8\choose2}(0.25^2)(0.75^6)=20412/65536\). Thus the probability of fewer than three successes is \((6561+17496+20412)/65536=44469/65536\), and

$$ P(Y_{\mathrm{new}}\geq3) =1-\frac{44469}{65536} =\frac{21067}{65536} \approx 0.3215. $$

Under the fitted model, a future group of this size has about a 32.15% chance of at least three successes. This probability uses the entire predictive distribution, rather than just its expected count \(8(0.25)=2\).

Worked Example: Same Probability, Different Trial Totals

Two future groups have the same fitted success probability, \(0.20\), but different trial totals: four trials for Group A and 16 for Group B. Find their expected counts, expected proportions, and variances of the observed proportions.

For Group A, \(Y_A\sim\operatorname{Binomial}(4,0.20)\). Its expected count is \(4(0.20)=0.8\), its expected proportion is \(0.20\), and its proportion variance is \(0.20(0.80)/4=0.04\).

For Group B, \(Y_B\sim\operatorname{Binomial}(16,0.20)\). Its expected count is \(16(0.20)=3.2\), its expected proportion is \(0.20\), and its proportion variance is \(0.20(0.80)/16=0.01\).

The expected counts differ because the trial totals differ. Both expected proportions equal the fitted probability, but Group B’s observed proportion has one quarter the variance: \(0.01/0.04=0.25\). This is a comparison of binomial response variation, not a claim that the observed proportion in either group will equal \(0.20\).

What This Prediction Does—and Does Not—Include

The plug-in distribution conditions on the fitted probability and trial total. It accounts for the random successes and failures in the future group under the binomial model. It does not, by itself, account for uncertainty in the estimated regression coefficients and hence in \(\hat p_{\mathrm{new}}\). A prediction interval based only on this distribution can therefore be narrower than a predictive assessment that also incorporates uncertainty from fitting the model.

The model’s assumptions matter as well. The binomial calculation applies when the future trials are conditionally independent and share the specified success probability. If trials within a group have different probabilities or dependence beyond the model, the binomial predictive distribution may not describe the group’s variation adequately. The fitted probability alone cannot establish those assumptions.

At the boundary, the formula remains well-defined: if \(\hat p_{\mathrm{new}}=0\), the plug-in distribution puts all probability on zero successes; if \(\hat p_{\mathrm{new}}=1\), it puts all probability on \(m_{\mathrm{new}}\) successes. These are degenerate predictions under the fitted model. They should not be mistaken for certainty about the true probability when that probability was estimated from data.

Common Mistake

Wrong reasoning: “The fitted probability is \(0.30\), so the next group’s observed proportion will be \(0.30\), and its success count will be \(0.30\) times the trial total.”

Correction: \(0.30\) is the expected proportion under the plug-in model. If the future group has 20 trials, its expected count is six, but its realized count is an integer with a binomial distribution. For instance, counts below or above six remain possible. Report the expectation when a typical value is requested, and use the binomial distribution when a probability or range of plausible outcomes is requested.

Key takeaway: For a future group with trial total \(m_{\mathrm{new}}\) and fitted probability \(\hat p_{\mathrm{new}}\), use the plug-in distribution \(\operatorname{Binomial}(m_{\mathrm{new}},\hat p_{\mathrm{new}})\). Its expected count is \(m_{\mathrm{new}}\hat p_{\mathrm{new}}\), its expected proportion is \(\hat p_{\mathrm{new}}\), and its predictive probabilities describe binomial response variation conditional on the fitted probability.

Check Your Understanding

Use the fitted probability and trial total as fixed when answering.

  1. A future group has fitted probability \(0.40\) and 15 trials. What are its expected success count and expected proportion?
  2. Write the plug-in predictive distribution for a group with fitted probability \(0.10\) and 12 trials. What is the probability of exactly two successes?
  3. For fitted probability \(0.60\) and 10 trials, give the formula for the variance of the observed success proportion.
  4. Explain why an expected count need not be an integer and why that does not make it an invalid prediction summary.
  5. Name one source of uncertainty that is not included when using a binomial distribution with the fitted probability treated as fixed.
Clinical Biostats