I want to calculate the hazard ratio for death by comparing individuals with a disease versus others without the disease, but I don't know if the calculation that I'm doing is correct.

Participants were asked for the presence of the disease one day between 2006-2010 (entry point), and then the deaths of those participants were tracked until a specific date in 2016 (exit point). The attained age was defined as the age of death (for death participants) or the age at the exit point (for participants alive).


  • disease = 0 (no disease) and disease = 1 (disease)
  • status = 0 (alive) and status = 1 (dead)
  • age_entry = age at entry point
  • age_attained = attained age
  • sex = 0 (male) and sex = 1 (female)

I'm using coxph(Surv(time = age_entry, time2 = age_attained, event = statis, origin = 0) ~ disease + sex)

Is this correct? Thanks


I think your code is not suitable because it calculates survival function from the birth date of subjects.

tdata$time <- tdata$age_attained - tdata$age_entry # age_attained should be not NULL and time > 0
model <- coxph(Surv(time, status) ~ disease + sex + age_entry, data= tdata)
  • $\begingroup$ Many thanks @JKim. Might I ask you one last thing? Why you adjusted for age_entry? Is it more precise if we do? $\endgroup$ – kakukeshi pani Sep 6 '18 at 22:57
  • $\begingroup$ In the Cox regression model, covariate is 1) disease, 2) sex, 3) age at entry. The 'time' value in Surv() represents the time period from index date (start date of follow-up). If you use time at entry in Surv(), the index date is set to the birth date of patient. $\endgroup$ – JKim Sep 7 '18 at 4:50
  • $\begingroup$ Yes @JKim I understand the model. I just wanted to ask you why we need to use age at entry as a covariate? $\endgroup$ – kakukeshi pani Sep 7 '18 at 9:58

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