# How to calculate HR using attained age? [closed]

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).

if:

• 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

## closed as off-topic by Tim♦Sep 6 '18 at 11:33

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – Tim
If this question can be reworded to fit the rules in the help center, please edit the question.

tdata$time <- tdata$age_attained - tdata\$age_entry # age_attained should be not NULL and time > 0