Why Stratify a Gray Test?
The cumulative incidence of a target cause can differ across baseline strata even when the groups being compared have no within-stratum difference. For example, two strata might have very different background rates of a competing event. A Gray test applied without stratification can then combine quite different event patterns into one comparison. A stratified Gray test instead forms a score contribution within each stratum and combines those contributions, with their uncertainty, across strata.
The question being tested must be stated precisely. A stratified test assesses whether groups have equal cumulative incidence functions for the target cause within the strata, under the chosen Gray-test weighting scheme. It does not automatically test equality of marginal cumulative incidence functions in a population with a particular mix of strata, and it does not establish a causal effect.
For two groups, the score is a scalar \(U_k\), the covariance is a variance \(V_k\), and the formula reduces to \(Q_{\mathrm{str}}=(\sum_k U_k)^2/\sum_k V_k\). The sign of a score depends on the chosen group ordering; the squared statistic does not. A positive score can be read as evidence in the direction of the first group having more target-cause incidence than expected under the null, according to the score convention used.
What Is Combined Within Each Stratum?
Within each stratum, the Gray construction uses the observed target-cause events and their expected contributions under equality of the groups’ target-cause cumulative incidence functions. It uses a subdistribution risk-set construction so that individuals who experience a competing event remain relevant to the target-cause cumulative incidence comparison. The score is a weighted sum over event times; its covariance estimates the uncertainty in that score. Thus, \(\mathbf U_k\) and \(\mathbf V_k\) are not simply a difference in event counts and its binomial variance.
Use the same target cause and a prespecified weight function across strata if the goal is a common, interpretable test emphasis over follow-up. The stratum-specific score calculations can still reflect different event and censoring patterns. A weight that emphasizes early or late event times changes the test’s sensitivity to departures at those times; it does not turn the test into a general measure of the size of a difference.
The standard large-sample reference requires independent observational units, a suitable Gray score construction within each stratum, and enough information for its covariance estimate to be stable and nonsingular. Censoring must satisfy the conditions that justify the Gray procedure within the relevant group and stratum; in particular, censoring should not selectively remove individuals in a way that invalidates the risk-set calculations. The detailed censoring conditions are a separate issue. Strata should be defined using baseline information, not a variable determined by post-baseline event history.
Name the target cause, groups, strata, weighting scheme, and within-stratum null hypothesis.
Obtain the Gray score \(\mathbf U_k\) and its covariance \(\mathbf V_k\) using that stratum’s event and censoring data.
Add the score vectors and add their covariance matrices when contributions are independent.
Calculate the quadratic score statistic, use \(G-1\) degrees of freedom when the covariance has full rank, and report the result in the context of the target cause and follow-up.
Combining Contributions: Justification
The addition rule follows from the behavior of independent score contributions. Under the null, each stratum-specific score has expectation approximately zero. If scores from different strata are independent, then the expectation of their sum is zero, and its covariance is the sum of the covariances:
The multivariate score statistic standardizes the combined departure from zero by this combined covariance. Under the null and regularity conditions, the standardized score is approximately multivariate normal with mean zero and identity covariance. Its squared length is therefore approximately chi-square with a number of degrees of freedom equal to the score dimension, \(G-1\). This also explains why one must add covariance matrices before taking the inverse: the uncertainty of a sum is not obtained by adding separately standardized test statistics.
Worked Example: Two Strata With Different Event Patterns
Consider a hypothetical study comparing Treatment A with Treatment B for cause 1. Follow-up is 12 months, and the same cause and weight function are used in both prespecified strata. The strata have visibly different background patterns: at 12 months, the estimated cumulative incidence of cause 2 is 0.08 in Stratum 1 and 0.32 in Stratum 2. Suppose the within-stratum Gray calculations, using the individual event-time data, give the following score summaries. Scores are oriented so that a positive value points toward greater cause-1 incidence in Treatment A.
| Stratum | Cause-2 incidence at 12 months | Gray score \(U_k\) | Estimated variance \(V_k\) |
|---|---|---|---|
| 1 | 0.08 | 3.20 | 4.00 |
| 2 | 0.32 | -1.10 | 2.25 |
The score contributions are added, as are their variances:
The one-degree-of-freedom statistic is
Against a chi-square distribution with 1 degree of freedom, this gives an approximate \(p\)-value of 0.401. At a 0.05 significance level, the result does not provide evidence against the null of equal cause-1 cumulative incidence functions within strata. It is not evidence that the null is true. The different cause-2 incidence patterns are a reason to retain the stratification, not a reason to interpret this as a test of cause-2 incidence.
The opposite signs also matter. The net score is smaller than either contribution’s absolute value because the stratum-specific directions differ. The combined result tests the prespecified stratified null; it does not claim that the groups’ score directions agree in every stratum.
Worked Example: Three Groups and Matrix Covariance
Now suppose a hypothetical study compares three groups within two strata. Use the first two group contrasts as the score vector coordinates. Assume the within-stratum Gray calculations give \(\mathbf U_1=(2.00,-1.00)^{\mathsf T}\), \(\mathbf V_1=\begin{pmatrix}4.00&1.00\\1.00&3.00\end{pmatrix}\), \(\mathbf U_2=(-0.50,1.50)^{\mathsf T}\), and \(\mathbf V_2=\begin{pmatrix}2.00&0.50\\0.50&2.00\end{pmatrix}\). The entries are illustrative score summaries, not raw event counts.
Add the vectors and matrices:
The determinant of the combined covariance is \(6(5)-(1.5)^2=27.75\), so it is invertible. Its inverse is \(\frac{1}{27.75}\begin{pmatrix}5.00&-1.50\\-1.50&6.00\end{pmatrix}\). Therefore,
The reference distribution has \(G-1=2\) degrees of freedom, giving an approximate \(p\)-value of 0.828. This test provides little evidence against equality of the three groups’ target-cause cumulative incidence functions within strata. Because the statistic is a joint test, it does not identify which group contrast might differ; that requires additional, appropriately planned comparisons.
Diagnostics, Alternatives, and Limitations
Before interpreting a stratified result, check that each stratum contains the groups required for the comparison and has usable follow-up and event information. Inspect stratum-specific score contributions and their variances, not only the final statistic. A very large contribution from one stratum, scores with opposing signs, or a nearly singular covariance matrix can reveal that the pooled summary is masking an important feature or is numerically unstable. Sparse events can make the large-sample chi-square approximation unreliable.
A stratum with no information about the target cause may contribute a zero score and zero covariance. It adds nothing to the test; it does not justify inventing a contribution or treating its absence of events as evidence of equal incidence. If a group is absent from a stratum, or the covariance is rank deficient, the nominal \(G-1\) degree-of-freedom test may not be defined. Do not use a matrix inverse that is numerically unstable or silently reduce the degrees of freedom without a prespecified, justified analysis.
An unstratified Gray test is a simpler alternative when a common pooled comparison is appropriate, but it may mix strata with substantially different baseline event patterns. A stratified test allows those patterns to differ while combining evidence about within-stratum group differences. Conversely, it can be less informative when the data are sparse across many strata, and it does not estimate a marginal effect for a chosen target population. A model-based analysis can address different estimands or adjust for covariates, but it requires its own modeling assumptions. The stratified score test is not a substitute for selecting and explaining the estimand.
- Common mistake: Add the stratum-specific chi-square statistics and call the result the stratified statistic. This ignores how the scores point in relation to one another and does not produce the score test defined above. Add the score contributions and covariance matrices first, then form the quadratic statistic.
- Another mistake: Treat failure to reject as proof that groups are equivalent. A nonsignificant result may reflect limited information, and a test of equality is not an equivalence analysis.
- Interpretation pitfall: Say the test concerns equality of target-cause cumulative incidence within strata under its weighting scheme. Do not describe it as a test of cause-specific hazards or as a causal effect merely because groups were compared.
Check Your Understanding
Answer each question, then compare your reasoning with the solutions.
- For two groups, two independent strata have scores \(U_1=1.5\) and \(U_2=2.5\), with variances \(V_1=4\) and \(V_2=5\). Calculate the stratified statistic.
- Why is it generally incorrect to add stratum-specific Gray chi-square statistics?
- A stratum has no target-cause events and contributes \(U_k=0\), \(V_k=0\). What does it contribute to the combined test?
- In a three-group test, what is the usual degrees of freedom if the combined covariance has full rank?
Solutions. (1) \(U_{\mathrm{str}}=1.5+2.5=4.0\), \(V_{\mathrm{str}}=4+5=9\), so \(Q_{\mathrm{str}}=4^2/9=1.78\), compared with a chi-square distribution on 1 degree of freedom. (2) The separate statistics have already squared and standardized their scores, discarding the direction and combining uncertainty incorrectly; add scores and covariances before forming the quadratic statistic. (3) Nothing: it adds zero to both the combined score and covariance and supplies no target-cause information. (4) \(G-1=2\) degrees of freedom.