# Determine number of excess events in survival analysis

I have run a survival analysis on two group of people that saw different ads during an ad campaign.

I would like to calculate the number of excess events that occurred due to the exposure to the ad.

Here's the output from my survival model - it's a very simple model!

Call:
coxph(formula = Surv(starttime, lagNextSale_days_censor, userHasFollowingSale) ~
displayTestGroup, data = survData)

n= 3795860, number of events= 72129
(2 observations deleted due to missingness)

coef exp(coef)  se(coef)      z Pr(>|z|)
displayTestGroup - Exposed      1.165628  3.207937  0.012867  90.59   <2e-16 ***
displayTestGroup - Non Exposed -0.193424  0.824133  0.007963 -24.29   <2e-16 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

exp(coef) exp(-coef) lower .95 upper .95
displayTestGroup - Exposed        3.2079     0.3117    3.1280    3.2899
displayTestGroup - Non Exposed    0.8241     1.2134    0.8114    0.8371

Concordance= 0.547  (se = 0.001 )
Rsquare= 0.002   (max possible= 0.427 )
Likelihood ratio test= 8212  on 2 df,   p=0
Wald test            = 10708  on 2 df,   p=0
Score (logrank) test = 11829  on 2 df,   p=0

So, if for example I was to go into the data set and change all of the 'Exposed' group to 'Non Exposed' could I then use the predict function to determine how many events we would expect to see for these users? This would give me an idea of the number of excess events due to the ad exposures.

In actual fact there is a further wrinkle, because we think that the ad server involved has been targeting only a very tiny number of potential users (well, we can see that they've avoided 95% of cookies on the target list).

Is that kind of thing something we could model using a frailty term?

There are actually 3 groups, there's people that were not even considered for targeting and they have the implied coefficient of 0. There there's the "displayTestGroupCriteo Group - Exposed" who were considered for targeting and they have the massive coefficient. Finally we have "displayTestGroupCriteo Group - Non Exposed" who have a lower coefficient than the people who weren't even considered for targeting. This is what makes us think that the ad company were selecting the users targeted very, very carefully and why it would be nice to estimate the hidden user heterogeneity,

I'm afraid I know nothing about using frailty so if there are any good guides online I would be really happy to hear about them!