Tutorials › Generalized Linear Mixed Models (GLMM) › Complementing The Binary Outcome Without Changing Its Information

Responses: Binary, Count, Ordinal, Overdispersed · Tutorial 72 of 698

Complementing The Binary Outcome Without Changing Its Information

See why reversing the event label reverses the signs of logistic fixed effects but leaves the underlying binary data and model fit unchanged.

Intermediate 10 min read

What You'll Learn

  • Define the complemented binary response and its event probability.
  • Derive the corresponding transformation of a logistic mixed model.
  • Check how random effects and grouped binomial counts transform.
  • Translate coefficients, odds ratios, confidence intervals, and predictions.
  • Identify coding choices that can break apparent equivalence.
  • Diagnose mistakes caused by inconsistent event labels or denominators.

Reversing the Event Label

A binary response records which of two outcomes occurred. Calling one outcome “success” is a coding decision: the observations themselves do not change if the other outcome is designated as success. In a logistic mixed model, however, the numerical values of the response and the signs of the coefficients do change. Keeping those changes straight is essential when interpreting results or comparing analyses that use different event labels.

Suppose \(Y_{ij}=1\) indicates the event of interest for observation \(i\) in cluster \(j\), and \(Y_{ij}=0\) indicates its complement. Define \(Y^*_{ij}=1-Y_{ij}\). Then \(Y^*_{ij}=1\) marks the formerly non-event, not a new or independent observation. The map is one-to-one: knowing either response determines the other exactly.

Definition: The complemented binary response is \(Y^*_{ij}=1-Y_{ij}\). If \(p_{ij}=P(Y_{ij}=1\mid b_j)\), its conditional event probability is \(p^*_{ij}=P(Y^*_{ij}=1\mid b_j)=1-p_{ij}\). Thus, complementing the response swaps the event and non-event labels while retaining all information in each binary record.

Transformation in a Logistic Mixed Model

Consider a logistic mixed model with a common set of covariates and a cluster-specific random effect:

$$ Y_{ij}\mid b_j \sim \operatorname{Bernoulli}(p_{ij}), \qquad \operatorname{logit}(p_{ij})=x_{ij}^{\mathsf T}\beta+z_{ij}^{\mathsf T}b_j, \qquad b_j\sim N_q(0,D). $$

Here \(x_{ij}\) and \(z_{ij}\) are the fixed- and random-effect design vectors, \(\beta\) is the fixed-effect coefficient vector, and \(D\) is the random-effect covariance matrix. The usual assumptions include a correctly specified conditional mean and link, and conditional independence of observations given the random effects and covariates. The random effects are assumed to follow the stated centered multivariate normal distribution.

Because the odds of the complement are the reciprocal of the original odds, the complemented conditional probability has a logit with the opposite sign:

$$ \frac{p^*_{ij}}{1-p^*_{ij}} =\frac{1-p_{ij}}{p_{ij}}, \qquad \operatorname{logit}(p^*_{ij}) =-\operatorname{logit}(p_{ij}) =-x_{ij}^{\mathsf T}\beta-z_{ij}^{\mathsf T}b_j. $$

Consequently, a parameterization for the complemented response is \(\beta^*=-\beta\) and \(b^*_j=-b_j\). Since a centered multivariate normal distribution is unchanged by negating the whole random-effect vector, \(b^*_j\sim N_q(0,D)\). The covariance matrix is unchanged: \(\operatorname{Cov}(-b_j)=D\). The model therefore has the same random-effect distribution and covariance parameters, even though the realized random effects and fixed coefficients have opposite signs.

Worked Example: Complementing a Conditional Prediction

Suppose a hypothetical logistic random-intercept model describes the probability of a particular event, with linear predictor \(\eta_{ij}=-0.4+0.7x_{ij}+b_j\). For a cluster with \(b_j=0.3\), consider an observation with \(x_{ij}=1\). Find the conditional probabilities under both response codings.

For the original event, the linear predictor is \(-0.4+0.7(1)+0.3=0.6\). Therefore,

$$ p_{ij}=\frac{e^{0.6}}{1+e^{0.6}} =\frac{1.822}{2.822} \approx 0.6457. $$

The complemented event has probability \(1-0.6457=0.3543\). Its linear predictor is the negative of the original one, \(-0.6\), and the logistic calculation gives \(e^{-0.6}/(1+e^{-0.6})\approx0.3543\), as required. This is a conditional prediction for the specified cluster effect, not a population-averaged probability.

Why the Likelihood Preserves the Information

For an individual Bernoulli observation, the conditional likelihood contribution under the original coding is \(p_{ij}^{Y_{ij}}(1-p_{ij})^{1-Y_{ij}}\). Under the complemented coding it is \((p^*_{ij})^{Y^*_{ij}}(1-p^*_{ij})^{1-Y^*_{ij}}\). Substituting \(p^*_{ij}=1-p_{ij}\) and \(Y^*_{ij}=1-Y_{ij}\) shows these are identical:

$$ (1-p_{ij})^{1-Y_{ij}}p_{ij}^{Y_{ij}} = p_{ij}^{Y_{ij}}(1-p_{ij})^{1-Y_{ij}}. $$

This equality holds for every observation and every value of the random effects when the coefficients and random effects are transformed together. Multiplying the contributions therefore gives the same conditional likelihood. Integrating over random effects also preserves equality: under the transformation \(b_j\mapsto -b_j\), the centered normal density is unchanged. Thus the corresponding marginal likelihoods match as well. The equivalence is a re-expression of the same data, not evidence that the two event probabilities are equal.

For grouped binomial data, if \(Y_j\) is the number of successes out of \(m_j\) eligible trials, the complemented count is \(Y^*_j=m_j-Y_j\), with probability \(1-p_j\) for each complemented event. The denominator remains \(m_j\). The combinatorial factors agree because \(\binom{m_j}{Y_j}=\binom{m_j}{m_j-Y_j}\); the probability terms are exchanged in exactly the way needed to preserve the likelihood.

Worked Example: Complementing a Grouped Binomial Count

Imagine a hypothetical group with 30 eligible trials and 18 occurrences of the event designated as success. Suppose the model assigns each trial the same conditional event probability \(p=0.60\). The observed complemented count is \(30-18=12\), and its event probability is \(p^*=1-0.60=0.40\).

The original binomial likelihood contribution is

$$ \binom{30}{18}(0.60)^{18}(0.40)^{12}. $$

After complementing, it is

$$ \binom{30}{12}(0.40)^{12}(0.60)^{18}. $$

Since \(\binom{30}{12}=\binom{30}{18}\), the two expressions are exactly equal. The observed proportion changes from \(18/30=0.60\) to \(12/30=0.40\), but the trials, denominator, and information are unchanged. Retaining 30 as the denominator is essential; recording 12 successes out of 18 would describe a different data set.

Interpreting Coefficients and Uncertainty

In a logistic model, a coefficient is a change in log odds for the event coded as 1, conditional on the random effects and other covariates. Complementing the event reverses every fixed-effect coefficient. For a one-unit increase in a covariate, an odds ratio \(e^{\beta_k}\) for the original event becomes \(e^{-\beta_k}=1/e^{\beta_k}\) for the complement. The direction changes because the event being described changes; it does not indicate a changed association in the observations.

Worked Example: Translating an Odds Ratio and Confidence Interval

Suppose a hypothetical fitted model estimates a fixed-effect coefficient of \(0.500\) with standard error \(0.200\) for a covariate measured in years. For the original event, a one-year increase has estimated odds ratio \(e^{0.500}=1.649\). A Wald 95% confidence interval for the coefficient is

$$ 0.500\pm1.96(0.200) =0.500\pm0.392 =[0.108,\,0.892]. $$

Exponentiating the endpoints gives an odds-ratio interval of approximately \([1.114,\,2.440]\). In context, the estimated odds of the original event are multiplied by 1.649 per additional year, conditional on the random effects and other modeled covariates; the interval is a 95% confidence interval for that odds ratio.

For the complemented event the coefficient is \(-0.500\), so the odds ratio is \(e^{-0.500}=0.6065\). Its coefficient interval is \([-0.892,\,-0.108]\), giving an odds-ratio interval of \([e^{-0.892},e^{-0.108}]\approx[0.410,\,0.898]\). These endpoints are the reciprocals of the original interval’s upper and lower endpoints, respectively. Both codings express the same fitted relationship using opposite event definitions.

The same sign reversal applies to the intercept and every fixed-effect term, including interaction terms. Standard errors for the sign-reversed coefficients are unchanged, and tests of corresponding zero coefficients have the same test statistics in absolute value and the same two-sided p-values. Fitted probabilities for the complemented event are one minus the original fitted probabilities. In a standard likelihood-based fit with the same covariates and model structure, the maximized likelihood and likelihood-based comparisons of the corresponding models are unchanged.

Checks, Alternatives, and Common Pitfalls

Reversing the outcome coding is not a model-selection method. It does not address whether the logistic link, covariates, random-effects structure, or conditional independence assumption is appropriate. Model diagnostics should still examine the fit and assumptions relevant to the analysis. Coding checks should establish which category the software treats as the event, confirm that reported predictions refer to that event, and verify that grouped counts sum to their stated denominators.

Complementing the response is a different operation from changing the link, changing the covariates, or replacing individual binary records with a different response family. Nor does it create additional information by fitting both codings as if they were independent analyses. The alternative coding is useful when the scientific question naturally defines the other outcome as the event, or when software uses a different default event category. Results can be compared after translating coefficients and predictions back to the same event definition.

The exact equivalence relies on transforming the response and the model consistently. In a standard GLMM with a centered Gaussian random-effect distribution, negating all random effects leaves that distribution unchanged. If a model imposes sign constraints on coefficients, uses a non-symmetric random-effect distribution that is not transformed accordingly, or adds asymmetric penalties or prior assumptions, the parameterized analyses need not be equivalent. These are changes to the model or estimation setup, not consequences of binary complementation alone.

  • Wrong reasoning: “The software reports a negative coefficient after I reverse the labels, so the association has reversed.” Correction: Check which event is coded as 1. With consistent complementation, the coefficient changes sign because the event’s odds are reciprocated.
  • Wrong reasoning: “The complemented count is 12, so its denominator is 18.” Correction: The denominator remains the number of eligible trials, 30; the complementary count is \(30-18=12\).
  • Wrong reasoning: “The two codings give two independent confirmations.” Correction: They are deterministic recodings of the same observations and carry the same information.
Key takeaway: Under a consistently specified logistic mixed model, replacing \(Y_{ij}\) by \(1-Y_{ij}\) replaces \(p_{ij}\) by \(1-p_{ij}\) and negates the fixed and realized random effects. It preserves the underlying binary information and likelihood; it changes which outcome the coefficients describe.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions.

  1. If the original conditional probability is \(0.72\), what is the complemented probability?
  2. A logistic coefficient for a predictor is \(0.30\) for the original event. What is the corresponding coefficient and odds ratio for the complemented event?
  3. In 40 eligible trials, 9 are coded as successes. What are the complemented count and its denominator?
  4. Why does a centered multivariate normal random-effect distribution remain unchanged when every random-effect coefficient is negated?
  5. Does fitting both response codings provide independent evidence about the association? Explain.

Solutions. (1) \(1-0.72=0.28\). (2) The coefficient becomes \(-0.30\), and the complemented-event odds ratio is \(e^{-0.30}\approx0.7408\), the reciprocal of \(e^{0.30}\approx1.350\). (3) The complemented count is \(40-9=31\), and the denominator remains 40. (4) If \(b\sim N_q(0,D)\), then \(-b\sim N_q(0,(-I)D(-I))=N_q(0,D)\), where \(I\) is the identity matrix. (5) No. The complemented records are determined exactly by the original records, so both analyses contain the same information and are not independent confirmations.

Clinical Biostats