# How to count person-time in survival analysis with clustered observations

Let's say I have a dataset containing sexual relationships that occurred over a 3 year period for many individuals. We know the start and ending dates for all the relationships that were ongoing during that time. Now let's say we want to conduct a survival analysis to see how the hazard of developing HPV is affected by using condoms consistently across all relationships (OverallCondom).

Now let's assume HPV can only happen once (this isn't the case in reality). So once you have it, you have it for life. Also our condom-use exposure is an individual-level exposure not a relationship-level exposure. This is what the data might look like:

In the HPV variable, 1 represents the relationship where HPV was contracted.

Because my event of interest can only occur once per person, this does not seem like an example of a repeated events analysis. However, different relationships can contribute exposure time.

So my question is, if I am performing survival analysis, should I leave the data at the relationship level, even though HPV can only occur once per person, and my explanatory variable of interest (OverallCondom) is an individual-level indicator?

So in R using the survival package, for example, the model would look something like:

model <- coxph(Surv(Persontime, HPV) ~ OverallCondom + cluster(ID))

Alternatively, would I want to aggregate the time at risk somehow, and then just use an invidual-level model? If so, what is the best way to count the exposure time?

• If HPVtime is 18 how do you know it was relID 3, not 4 which also spans 18? – mdewey Oct 27 '16 at 12:33
• Good question. In this case we know because it is a simulation. However, you raise a good point. In the real world, we might see data like this where relationships overlap, and we aren't sure which partner transmitted the HPV. In that case, we would probably just have to use a 0/1 indicator to say whether or not the person has HPV and not make it specific to the relationship. And of course the infection time would probably be the midpoint of the interval where they were last observed to be negative. – RNB Oct 27 '16 at 12:52