Why the Representation of Binary Data Matters
A binary response can be recorded once per trial, as a success or failure, or summarized over several trials as a number of successes out of a known denominator. These are not automatically interchangeable data formats. Grouping is valid only when the trials being combined have the same relevant probability under the model and satisfy the required conditional-independence assumption. In an NLME model, it is especially important to say whether this equality and independence hold conditional on the subject's random effects.
The practical question is not simply whether the response is binary. It is: what set of trials does a count summarize, and what probability model applies to every trial in that set? An incorrect denominator, an omitted trial-level predictor, or unmodelled dependence can change the likelihood and lead to misleading estimates and uncertainty.
When Grouping Preserves the Likelihood
Suppose that within subject \(i\), each of \(m_i\) trials has the same success probability \(p_i(b_i)\) conditional on that subject's random effect \(b_i\). Assume the outcomes are conditionally independent given \(b_i\) and the covariates. Then the conditional likelihood of the individual Bernoulli records is
The right side depends on the records only through the count \(y_i\) and denominator \(m_i\). The probability of observing that count, rather than one particular ordering of successes and failures, includes the number of possible orderings:
The binomial coefficient is needed for the probability of a count. For likelihood-based parameter estimation with fixed observed \(m_i\) and \(y_i\), it is constant with respect to model parameters. Thus the Bernoulli-record product and binomial-count likelihood give the same parameter-dependent contribution under the stated assumptions.
In an NLME model, the random effect is not observed. The subject's marginal likelihood contribution is obtained by integrating the conditional likelihood over its random-effect distribution. If the common trial probability is \(p_i(b_i)\), this is
Here \(f(b_i;\Omega)\) is the random-effect density. It is essential that grouping occurs within the correct subject or independent group so that the appropriate shared random effect remains represented. Combining records from different subjects merely because their covariates look similar generally does not produce this likelihood.
Worked Example: Five Trials With a Common Probability
Consider a hypothetical group of five exchangeable trials. Suppose each trial is conditionally independent and has success probability \(p=0.30\), with no group-level random effect in this illustration. Two successes are observed. Compare the probability of one particular ordering, \(1,0,1,0,0\), with the probability of the count \(y=2\).
For the particular ordering, the Bernoulli probability is
There are \({5\choose 2}=10\) distinct orderings with two successes. Therefore the binomial probability of the count is
The count probability is ten times the probability of the one displayed sequence because it includes all ten arrangements. If the model concerns only the common probability and the trials are exchangeable, recording \(y=2\) out of \(m=5\) preserves the parameter-dependent likelihood. The denominator of five is part of the observation; recording “two successes” alone would be insufficient.
Shared Random Effects: Conditional Versus Marginal Dependence
When trials share a subject-level random effect, outcomes may be independent conditional on that effect while dependent after it is integrated out. This distinction determines whether a binomial representation is valid and at what level. If all trials within a subject have the same conditional probability \(p_i(b_i)\), their subject-level count is binomial conditional on \(b_i\). The marginal count distribution after integrating over \(b_i\), however, is generally a mixture of binomial distributions, not a binomial distribution with probability equal to the marginal mean.
The source of this dependence can be seen from the law of total variance. Write \(p_i=p_i(b_i)\) as a random quantity across subjects. Conditional on \(p_i\), a count from \(m_i\) trials has mean \(m_i p_i\) and variance \(m_i p_i(1-p_i)\). Therefore
where \(\mu_p=E(p_i)\). The final term is nonnegative and is positive when the conditional probability varies across subjects. It reflects the shared subject effect, not a failure of conditional binomial sampling. Thus a grouped binomial likelihood conditional on the random effect can be appropriate even though the marginal count is more variable than a binomial count with probability \(\mu_p\).
Worked Example: A Shared Effect Changes the Marginal Count Distribution
Suppose, hypothetically, that a subject's random effect makes the success probability either \(0.20\) or \(0.80\), each with probability \(0.50\). Two conditionally independent trials are observed per subject, and both trials share that subject's probability. Calculate the marginal probabilities for zero, one, and two successes.
For two successes, average the conditional probabilities in the two random-effect states:
For zero successes, the corresponding calculation is
For exactly one success, each state has conditional probability \(2p(1-p)=0.32\), so
The three probabilities sum to \(0.34+0.32+0.34=1.00\). Each individual trial has marginal success probability \(0.50(0.20)+0.50(0.80)=0.50\). If the two trials were incorrectly treated as marginally independent Bernoulli trials with probability \(0.50\), the count probabilities would instead be \(0.25,0.50,0.25\) for zero, one, and two successes. The correct marginal probabilities show more outcomes at the extremes because both trials share the same latent subject probability. The conditional binomial model is still valid given the random effect; replacing it with a binomial model at the marginal probability is not.
When the Trials Do Not Share a Probability
A common probability is not guaranteed merely because responses are binary or occur in the same subject. Dose, time, treatment, or another trial-level predictor may change \(p_{ij}(b_i)\) from one trial to another. In that case, conditional independence may still hold, but the sum of the Bernoulli outcomes is generally not binomial. Its distribution depends on the individual probabilities, and a total count can discard information about which predictor value corresponded to each outcome.
Worked Example: Two Trials With Different Predictor Values
Imagine a hypothetical subject with two conditionally independent trials. The model gives success probabilities \(p_{i1}=0.20\) and \(p_{i2}=0.80\), because the trials have different predictor values. Find the probability of exactly one success and compare it with the result from an invalid common-probability binomial model using the average probability \(0.50\).
Exactly one success can occur as \(1,0\) or \(0,1\). Their probabilities are
Thus the probability of a total count of one is \(0.04+0.64=0.68\). A binomial model with \(m=2\) and common probability \(0.50\) would give
which is not the correct probability. Averaging the two trial probabilities does not make them equal. Moreover, the observed sequences \(1,0\) and \(0,1\) have likelihoods \(0.04\) and \(0.64\), respectively; reducing both to a count of one loses their distinction. Retain the Bernoulli records and their trial-specific predictors, or use an explicitly derived likelihood for the heterogeneous probabilities rather than a simple binomial likelihood.
Choosing a Representation and Checking It
The Bernoulli and binomial representations are alternative ways to express the same conditional likelihood when the binomial assumptions hold. Bernoulli records are usually the safer representation when trial-level covariates vary, ordering matters to the model, or the denominator is uncertain. Grouped binomial data are compact and appropriate when trials within each group share the same conditional probability and the denominator is known. Neither format repairs a misspecified dependence structure.
Before grouping, verify all of the following:
- Denominator: \(m_i\) is the number of trials that could have produced the recorded count, not the number of subjects or visits unless those are exactly the trials being modeled.
- Shared predictors: all trials in a group have the same probability conditional on the included predictors and random effects. If predictors differ, a single binomial probability is generally inappropriate.
- Conditional independence: after conditioning on the modeled random effects and covariates, no additional within-group dependence remains that changes the joint likelihood.
- Random-effect grouping: the count remains attached to the subject or cluster whose random effect induces shared probability. Counts from distinct subjects cannot usually be collapsed into one group simply because their observed covariates match.
- Response accounting: the successes and failures exhaust the eligible trials. Unobserved or ineligible trials must not be silently included in the denominator.
Useful diagnostics include checking the construction of each denominator against the data collection process, tabulating predictor values within proposed groups, and comparing observed group proportions and count frequencies with model-based predictions. Repeated patterns of extreme counts or excess variation can signal an omitted random effect, residual dependence, or an incorrect grouping assumption. Such patterns do not by themselves identify which assumption failed; they prompt a review of the design and model. The earlier material on predictive checks for categorical NLME models provides the general predictive-checking framework.
The main alternatives are not simply “Bernoulli” and “binomial” as competing scientific models. Under common conditional probabilities and conditional independence, they are equivalent likelihood representations. If probabilities vary across trials, the individual Bernoulli likelihood retains their identity; a grouped likelihood must account for the different probabilities and cannot be replaced by an ordinary binomial likelihood. If dependence remains after conditioning, neither a product of independent Bernoulli terms nor the corresponding ordinary binomial likelihood captures that dependence. The dependence structure must be represented rather than hidden by aggregation.
Check Your Understanding
Answer each question, then compare your reasoning with the solution immediately below it.
- A subject has eight conditionally independent trials with the same success probability given their shared random effect. Is the subject's count conditionally binomial, and what must be retained for the NLME likelihood?
Solution: Yes. Conditional on the shared random effect, the count is binomial with denominator eight and the common conditional probability. The count must remain associated with that subject so the likelihood can be integrated over the subject's random-effect distribution. - Two trials have probabilities \(0.10\) and \(0.90\) and are conditionally independent. Is their total count ordinary binomial with \(m=2\) and probability \(0.50\)?
Solution: No. The trial probabilities differ. The probability of exactly one success is \(0.10(0.10)+0.90(0.90)=0.01+0.81=0.82\), whereas a binomial model with probability \(0.50\) gives \(2(0.50)(0.50)=0.50\). - Why can two trials sharing a random effect be dependent marginally even if they are conditionally independent?
Solution: Their conditional probabilities vary together with the shared effect. For two outcomes, the marginal covariance is \(\operatorname{Var}\{p_i(b_i)\}\) under conditional independence, which is positive when the shared effect produces nonzero variation in the conditional probability. - A report gives “three successes” but does not give the number of eligible trials. Can this be used as a grouped binomial observation?
Solution: No. The denominator is required to determine how many failures occurred and to specify the binomial likelihood. A count of three could mean three of three or three of thirty, which are different observations.