# Stratified concordance index (survival::survConcordance)

What is the idea of having a stratified concordance (C-index) in survival::survConcordance, as opposed to computing the concordance over all samples ignoring the strata?

Can there be some inflation of the C-index if the strata themselves are predictive of time to outcome? (some sort of confounding)

[edit: to clarify, the non-stratified index computes the ranking of all pairs of individuals regardless of sex, the stratified index only compares males to males and females to females and then combines the estimates]

Here's some example code based on rms::rcorr.cens example where survival time is driven by age in males but not in females, which shows a big difference in the C-index between computing it on all samples versus computing it within strata (sex) and then combining into one estimate:

library(survival)

set.seed(123)
n <- 400
age <- rnorm(n, 50, 20)
sex <- sample(c("M", "F"), length(age), replace=TRUE, prob=c(0.7, 0.3))
d.time <- rexp(length(age), ifelse(sex == "M", age, 1)) * 1e2
cens   <- runif(length(age), 15, 30)
death  <- d.time <= cens
d.time <- pmin(d.time, cens)
d <- data.frame(age=age, time=d.time, sex=sex, death=death)

s1 <- with(d, survConcordance(Surv(time, death) ~ age))
s2 <- with(d, survConcordance(Surv(time, death) ~ age + strata(sex)))

> s1
Call:
survConcordance(formula = Surv(time, death) ~ age)

n= 400
Concordance= 0.5420224 se= 0.01769964
concordant discordant  tied.risk  tied.time   std(c-d)
40572.000  34281.000      0.000      0.000   2649.742
> s2
Call:
survConcordance(formula = Surv(time, death) ~ age + strata(sex))

n= 400
Concordance= 0.6121132 se= 0.02236015
concordant discordant tied.risk tied.time  std(c-d)
sex=F       1058       1297         0         0  290.0925
sex=M      24461      14874         0         0 1574.2970


I believe that the strata argument was designed for use with certain stratified models, that only try to compare data points within each stratum, rather than between the strata. An example would be stratified Cox proportional hazards models.
The problem is that the proportional hazards model doesn't actually find the baseline hazard: it gives you a model $h(t) = \lambda_0(t) e^{-X\beta}$, but it doesn't find what $\lambda_0$ is. This is OK with an un-stratified model, since you rank instances purely by the $e^{-X\beta}$ component. However, if you stratify, then you have a different $\lambda_0$ for each stratum, and hence the $e^{-X\beta}$ components are not directly comparable between strata. But you can still take them and feed them directly into survConcordance with the appropriate strata.
The interpretation of what you're seeing in this case doesn't have much to do with that, though. You're basically computing the rank correlation between age and survival (Harrell's c and Kendall's tau are closely related), and the stratification just controls for sex. So, as you mentioned in the post, it's basically confounding: you've discovered that age explains more of the variance in survival within each sex than when you pool the sexes. That said, most models should take this into account, so I would guess that if you created a good survival model that included both age and sex, you wouldn't see a big difference in the concordance index depending on whether or not you stratified.