I have a somewhat strange assumption that I am trying to validate. I am probably not going to explain this very clearly because I don't have a really strong statistical background so please bear with me. Here is my best attempt to explaining what I am trying to do.

Let's assume we have a censored dataset, I won't use my real use case here, but for sake of describing it let's assume it is a drug test dataset. The censoring event is a patient still alive or dead. The patients are grouped by year of birth. This means that the patients belong to different groups and each group is the year he/she was born in. I can do a quick group by like this

1994    45
1995    42
1996    46
1997    49
1998    51

What is interesting for me is the average lifespan of groups of patients by year. Because some patients may have died, and some other may have not, I am using a survival analysis approach and calculate for each group (each year of birth) the survival function. At this point I can also understand if there is a statistical significant difference in the survival rates using a K-sample log-rank hypothesis test. So far so good.

My problem is in the next thing I want to calculate: I want to understand if there is a correlation between the number of patients born in a specific year in my sample (not the entire population) and the expected lifespan. In other words I want to understand if there is a correlation between the number of people born in a year their expected lifespan. If I have more people born in a specific year, do the people live longer? (or less?) How can I do a correlation between a number and the survival function in this case? Thank you.

EDIT: would trying to correlate the number of patients in a group and the median overall survival rate correct statistically and archive what I am trying to do?

  • $\begingroup$ Are you taking about the number of people in your sample born in a certain year, or the number of people in the population born in a certain year? It's not clear what proper inference you could draw from the former. Please edit the question to provide that information, as comments are easy to overlook and can be deleted. $\endgroup$
    – EdM
    Sep 22, 2022 at 15:17
  • $\begingroup$ Addressed. Thank you for the comment. This is just an example to explain what I am trying to achieve. My real use case is in real estate and there what I am trying to do makes more sense. I have simplified the problem and I am just trying to understand what tools I can use for my problem. $\endgroup$
    – DarioB
    Sep 23, 2022 at 17:26

1 Answer 1


Assuming that such predictors make sense in your use case, this would best be handled by a survival regression model, like a Cox proportional hazards model, rather than by a set of individual survival curves and log-rank tests. You could then include both calendar date of entry and other variables that might be associated with outcome (age, income, sex, etc.) as predictors in the regression model.

That provides an advantage for working with the calendar date of entry. As changes over calendar time are likely to be gradual, that would allow you to treat calendar time as a continuous predictor modeled flexibly, for example with regression splines. That provides more power than separate modeling of each calendar year, as you only have to estimate a few regression coefficients instead of one for each calendar year of entry. If you have data at a finer time scale, you could model by actual day or month of entry instead of grouping together by year, potentially building a superior model.

Predictors need to have values that precede an event, so you have to be careful in using the number who entered in the corresponding year as a predictor--however you approach this. If someone "dies" before the end of the calendar year, that individual won't have "known" the number who enrolled during the entire year so that wouldn't be an appropriate predictor. If you have detailed data over time, you might consider the number who enrolled in the prior 12 months as a predictor for each individual instead.

Once you have the model, you can interrogate it to get estimated survival curves, survival probabilities at particular times, or quantile times for survival (like median survival) for any reasonable combination of predictor values. Evaluate the magnitude of the coefficient representing the association between number per year and outcome, along with the error in its estimate, to see if your hypothesis holds true once the date of entry per se and other predictors are taken into account.

If your data are only available by year, you might need to use discrete-time survival analysis instead of the continuous time scale assumed by Cox models. This answer outlines the process (just a set of binomial regressions on data in a specific format) and provides some useful links.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.