Survival Regression with Cox, right censoring

I am going through the documentation of cox-regression (lifelines package in python/survival in R) and they state the following:

coxph(formula, data, method) # in R
# formula is linear with Surv(time, event)
cph = CoxPHFitter() # in python
cph.fit(data, duration_col, event_col)


I understand the duration/time component. That is simply the observation at time t. What is the event aspect of the formula? From doing some reading, it says it is the right-censored observations. For example, a study looking at strokes. The study ends after 5 years. Those patients who have had no strokes by the end of year 5 are censored. What does that mean?

Furthermore, the lifelines package allows you to pass a formula to handle the right-hand-side of the linear model. Is this the same as the formula in R? It seems like the formula is a necessary requirement to begin with.

In your example the event is a dummy variable

0 = no event 1 = event

You can found there an explanation about how to use the surv function https://stat.ethz.ch/R-manual/R-devel/library/survival/html/Surv.html

Right censoring is about the time: you consider the time of observation for each patients the same (in your example is 5 years), so if a patient didn't have the stroke at the end of your time of observation you have to consider him as he didn't have the event in case you know that he had a stroke after the end of your observation period (after 5 years).

• Can you explain "in case you know that he had a stroke after the end of your observation period (after 5 years)" a little more. How does it consider him as he didn't have the event? Commented Jan 19, 2022 at 17:02
• +1 for emphasizing that censoring is of times rather than patients; please continue contributing to this site. For explaining this, I find it easiest to say that a patient whose time is censored provides information about survival up to the last observation time but not beyond. Technically, that patient is in the "risk set" at event times while she is observed: she survived through those times, while others had events. Her covariate values at those event times indicate longer survival and contribute to regression coefficient estimates. After the censoring time she provides no information.
– EdM
Commented Jan 19, 2022 at 19:45
• Thank you EdM, i think your definition is better. I was thinking about a clinical trial with a baseline visit, an end of study and after that a follow-up period, if you would like to estimate the survival time at end of study, if a patient have a single event in your follow up period (after end of study) you will censoring his time at the end of study considering him as he didn't have the event (because from baseline to end of study he didn't have the event). I hope I have explained myself better.
– Surv
Commented Jan 20, 2022 at 9:16