Why Binary and Categorical Covariates Need Their Own Balance Calculation
A balance table must represent covariates of different types on a comparable scale. For a binary covariate, the group mean of its zero-one indicator is simply the group proportion with that characteristic. Its standardized difference therefore compares two proportions relative to the variability of the indicator. For a categorical covariate with several levels, the same calculation is made separately for each level. This level-by-level view matters: a single overall number can conceal which categories differ between groups.
The calculations below are descriptive diagnostics for the groups being compared, such as treated and comparison groups in a propensity-score analysis. Covariates should be measured before treatment if the goal is to assess baseline balance. The proportions are calculated in the analysis sample under consideration; the formulas here are for unweighted group proportions.
The sign records direction: a positive value means the characteristic is more prevalent in group 1, and a negative value means it is more prevalent in group 0. The magnitude is expressed in standard-deviation units. It is not a difference in percentage points; report the raw proportions alongside the standardized value when practical.
Why This Formula Applies to a Binary Covariate
The calculation follows directly from treating the binary covariate as a zero-one variable. In group \(g\), its sample mean is the proportion with the characteristic, \(\bar{X}_g=\hat{p}_g\), and its Bernoulli variance is \(\hat{p}_g(1-\hat{p}_g)\). Standardizing the difference in group means by the square root of the average of those two variances gives the formula above:
This is a descriptive standardization, not a test of whether the proportions differ. The calculation does not require normally distributed covariates. However, the number can be unstable when a category is very rare or when a group proportion is close to zero or one, so the underlying proportions and counts should remain visible in the balance assessment.
Worked Example: A Binary Covariate in Two Groups
Suppose a hypothetical analysis compares 70 people in group 1 with 70 people in group 0. A pre-treatment binary covariate indicates whether a person has a particular history. The history is present for 42 people in group 1 and 39 in group 0. Calculate the standardized difference.
The observed proportions are \(\hat{p}_1=42/70=0.6000\) and \(\hat{p}_0=39/70\approx0.5571\). The difference in proportions is \(0.6000-0.5571\approx0.04286\).
Using the exact proportions in the denominator,
The hypothetical groups differ by about 4.29 percentage points in the prevalence of this history, corresponding to a standardized difference of approximately 0.08687. The positive sign indicates higher prevalence in group 1. This calculation describes the observed groups; by itself, it does not establish that the groups are equivalent or that any treatment effect is unbiased.
From Binary Covariates to Multiple Category Levels
A categorical covariate with \(K\) levels can be represented by \(K\) binary indicators. For level \(k\), define an indicator that equals 1 when an observation belongs to that level and 0 otherwise. Calculate the proportion in that level separately in each group, then apply the binary standardized-difference formula to those two proportions. Repeat for every level.
The raw differences in proportions across all levels sum to zero because the proportions in each group sum to one. The standardized differences generally do not sum to zero: each level has its own denominator. Consequently, report the level-specific values rather than treating them as components that should cancel or add to a single signed total.
Worked Example: Standardized Differences for a Three-Level Covariate
Consider a hypothetical three-level pre-treatment covariate in groups of 100 and 80 people. In group 1, the level counts are 50, 30, and 20. In group 0, they are 32, 32, and 16. The proportions are therefore \((0.50,0.30,0.20)\) and \((0.40,0.40,0.20)\).
For level 1, the difference is \(0.50-0.40=0.10\), and the denominator is \(\sqrt{\{0.50(0.50)+0.40(0.60)\}/2}=\sqrt{0.245}\approx0.494975\). Thus \(d_1=0.10/0.494975\approx0.2020\).
For level 2, the difference is \(0.30-0.40=-0.10\). Its denominator is \(\sqrt{\{0.30(0.70)+0.40(0.60)\}/2}=\sqrt{0.225}\approx0.474342\), so \(d_2=-0.10/0.474342\approx-0.2108\).
For level 3, the proportions are both \(0.20\). The denominator is \(\sqrt{\{0.20(0.80)+0.20(0.80)\}/2}=0.4000\), and \(d_3=(0.20-0.20)/0.4000=0\).
A transparent summary is the full set \((0.2020,-0.2108,0)\), with the largest absolute level-specific difference equal to \(\max(|0.2020|,|-0.2108|,|0|)=0.2108\). The raw proportions show exactly where the imbalance lies: group 1 has a higher proportion in level 1, while group 0 has a higher proportion in level 2.
How to Summarize and Inspect the Results
For a multi-level covariate, a useful compact summary is the largest absolute level-specific standardized difference, \(\max_k |d_k|\). It identifies the level with the largest standardized discrepancy without allowing positive and negative directions to cancel. It should accompany, not replace, the table of level-specific values and proportions. Two covariates can have the same maximum while having very different patterns across their remaining levels.
For example, in the three-level calculation, reporting only a signed average could make the positive and negative discrepancies appear to offset. Reporting each \(d_k\), the corresponding proportions, and the maximum absolute value avoids that loss of information. Keep the category labels attached to the results; “level 2” is not informative if the reader cannot tell what level 2 represents.
The values also depend on how a binary characteristic is coded. Reversing the coding from “characteristic present” to “characteristic absent” changes the sign but not the magnitude: the group proportions become \(1-\hat{p}_1\) and \(1-\hat{p}_0\), their difference changes sign, and each variance remains unchanged. For a multi-level variable, choosing a different reference category does not remove the need to assess every level. A reference-category model coefficient is not a substitute for the level-specific balance calculations.
Diagnostics, Alternatives, and Failure Modes
Check the arithmetic and the data structure before interpreting a standardized difference. For each group, verify that the level counts sum to the group total and the level proportions sum to one. Confirm the direction of subtraction and make sure the numerator and denominator use the same two groups and analysis sample. A sign reversal alone may reflect a reversed group order; an unexpected magnitude may point to a count, coding, or denominator error.
- Rare or empty levels. Show counts as well as proportions. A level absent in both groups has no observed contrast; its formula gives zero divided by zero and is undefined, not a meaningful standardized difference of zero. If the denominator is zero but the proportions differ, the standardized difference is also undefined. Flag such cases rather than reporting a finite value.
- Accidental category merging. Combining levels can hide a difference that is present in individual levels. Keep substantively distinct levels visible unless there is a defensible reason to combine them, and document any combination.
- Confusing percentage points with standardized units. A raw difference of 0.10 is a ten-percentage-point difference. A standardized difference of 0.10 is one tenth of the specified standard-deviation scale; those statements are not interchangeable.
- Reading the measure as a significance test. A standardized difference is not a p-value and does not quantify the probability that the groups are balanced. It describes the observed discrepancy on a standardized scale.
Raw proportion differences are often easier to communicate, but their scale does not account for the variability of the binary indicator. A hypothesis test answers a different question and its p-value can depend strongly on sample size; a small p-value is not, by itself, a measure of practical imbalance. Standardized differences are useful balance diagnostics, but no single level-specific value proves that all relevant covariates are balanced or that a causal analysis is free from bias.
The formula here uses the average of the two group-specific Bernoulli variances. That denominator is part of the definition used in these calculations; changing the denominator changes the standardized values. Interpret and report the denominator convention consistently, particularly when comparing results across analyses. As with any balance diagnostic, the measure cannot reveal imbalance in covariates that were not measured or included.
Check Your Understanding
Answer each question, then compare your work with the solutions below.
- In a hypothetical comparison, 24 of 60 people in group 1 and 15 of 50 in group 0 have a binary characteristic. What are the two proportions and the raw difference in group 1 minus group 0?
- A binary covariate is recoded from “present” to “absent.” What happens to the sign and magnitude of its standardized difference?
- For a three-level covariate, the level-specific standardized differences are 0.08, \(-0.19\), and 0.04. What is their largest absolute value, and why should all three values still be reported?
- A category is absent in both groups. Should its standardized difference be reported as zero? Explain.
Solutions. 1. The proportions are \(24/60=0.4000\) and \(15/50=0.3000\); the raw difference is \(0.4000-0.3000=0.1000\), or 10 percentage points. 2. The sign reverses because the difference becomes \((1-\hat{p}_1)-(1-\hat{p}_0)=-(\hat{p}_1-\hat{p}_0)\); the magnitude is unchanged because \(p(1-p)=(1-p)p\). 3. The largest absolute value is \(\max(0.08,0.19,0.04)=0.19\). Report all three because they show which levels differ and in which direction. 4. No. Both proportions are zero, so the numerator and denominator are zero; the value is undefined, and the absence in both groups should be reported explicitly.