# How does Cox regression estimate time to an event?

In R and Python, Cox regression is specified with duration and event as the dependent variables. However, Cox regression is said to be estimating the hazard ratio. How are the variables duration and event helping/assisting to estimate the hazard ratio, conceptually, in Cox regression? And if Cox regression is predicting the hazard ratio, how is it being used to also predict time to the event for each individual (especially in the case where you want to use concordance as a sort of performance measure)?

Also, if duration is a one of the dependent variables, can I use covariates such as the age of the person at the start and end of the study (or when they've dropped out or succumbed to the event)? I'm a little concerned here, in my case, since duration is the difference between the age at the end minus age at the beginning and I'm using both as covariates. I'd like to keep both since we would like to see if people entering at a younger age will have better survivals (start age), and if older people will have better survival (end age).

An help is appreciated.

The hazard function, $H(t\;|\;x)$ is the "engine" we wish to know more about, as it controls the risk (and hence deaths) of individuals through the formula:

$$S(t\;|\; x) = \exp\left(-H(t\;|\; x) \right)$$

Unfortunately, all we observe is the outcomes and ages of individuals - never the hazard directly.

With the Cox model, we assume a functional form for the hazard function, and then can write down a likelihood for observing specific deaths and ages (these are the event and duration vectors, respectively).

Once the model is fitted to the observed data, we actually have an "engine" now to replay individual's possible outcomes. This is how we can predict an individual's survival.

Also, if duration is a one of the dependent variables, can I use covariates such as the age of the person at the start and end of the study (or when they've dropped out or succumbed to the event)

Age at the end of the study would be a source of data-leakage, so I don't recommend that (the concerns you mention in your post are correct). However, age when they enter the study is valid.