It seems that you have "grouped data", where evaluations are no longer made continuously but rather take place at fixed time points. Consider the picture below. The time axis is divided into $3$ intervals, $I_1$, $I_2$, and $I_3$.
Under the assumptions that
\begin{align}
\Pr[T > 1] & = p^{\tfrac{1}{3}} \\
\Pr[T > 2] & = \Pr[T > 2 \,|\, T > 1] \, \Pr[T > 1] = p^{\tfrac{1}{3}} \, p^{\tfrac{1}{3}} = p^{\tfrac{2}{3}} \\
\Pr[T > 3] & = \Pr[T > 3 \,|\, T > 2] \, \Pr[T > 2] = p^{\tfrac{1}{3}} \, p^{\tfrac{2}{3}} = p
\end{align}
the hazard to have the event in $I_2$, say, is then given by
$$
h(I_2) = 1 - \Pr[T > 2 \,|\, T > 1] = 1 - p^{\tfrac{1}{3}}.
$$
The output shows $n=750$ simply because there are 750 observations. The dataframe is treating each of your three assessments of the same ID as an independent observation, so it doesn't matter that you labeled them with ID.
1. As @EdM mentioned in the comments, survcheck()
is what you should use to prove that you have the correct number of subjects.
2. You should likely modify your formula to include cluster(ID)
, the model will then also give you a robust standard error that takes the lack of independence within ID into account. Without this, it assumes that each row is independent.
Adding in these two recommendations, the last portion of your code should change to:
# Survival Model
m <- coxph(Surv(time1, time2, mortality) ~ age + sex +
cluster(ID), data = dat)
# Check for correct subject number, events, and censoring
survcheck(Surv(time1, time2, mortality) ~ age + sex +
cluster(ID),
data=dat,
id=ID)
# Summary of model
summary(m)
Best Answer
That's just a description of the underlying data.
A survival time is right-censored when the last observation is made on an individual at that time and the individual hasn't yet had the event. The plot of "censorings" is just how many individuals had such a right-censored observation at the indicated time, color coded in this case according to male/female. The times with
n.censor
values of 2 are just times when 2 individuals instead of 1 had right-censored observations.Those censoring times are also seen in the vertical hashes along the survival curves.