# Survival analysis with unequal repeated measures, time variable

I'm modelling propensity to purchase a particular product or service following exposure to online advertising.

I'm attempting to get something like the analysis from John Chandler-Peplnjak's thesis "Modeling conversions in online advertising"

A similar method has also been used by Andrie de Vries in this presentation.

I have included a sample of the data at the bottom of this question, it is quite cumbersome, sorry about that!

The essential point is that both De Vries and Chandler-Peplnjak apply a cox proportional hazards model to data with unequal numbers of repeated measurements. There is no attempt to identify consumer exposure to advertising by user, so it appears that each row of the data becomes a separate survival record.

I have created a couple of custom time variables (times are UNIX times in seconds) to measure time since the first advertising exposure (time_from_start), and time since the last advertising exposure (interval_time) and can use these to produce the model, but surely I will be:-

1. modelling far too many paths
2. artificially shortening paths if I use the time between events as the survival time
3. modelling overlapping events if I use the time since the first exposure

De Vries provides sample code in his presentation and it doesn't appear that he takes any account of this in his analysis (such as downweighting events according to the length of the conversion path, I don't think Pepelnjak does either). It has been suggested that the interval time variable should produce reasonable results because the time slices are assumed to be independent of each other in the Cox-PH framework? Does this also get around the problem of there being too many paths?

EDIT 1: So it looks like this is ok. I've bought myself a copy of "Applied Longitudinal Data Analysis" by Singer & Willet, and these kinds of data sets are called "person- period" data sets.

So far I've only found info on the discrete time case, but I would assume it must be possible to extend to the continuous time case, even if only as a limiting case.

Do shout if you've any experience with person-period data sets on continuous time variables, let me know what kind of time variable you used for your analysis.

     Event_Time Start_time  Time_from_start Interval_time   Buy_ID  User_ID Ad_Id   Ad_Type Cre_Id  Creative_size_lookup    Page_ID Site_ID Imp_ord Click_ord   Type    Interaction_ord Activity_ord    State_Ord   Path_Ord    Fixed_path_ord  Path_max_ord    prev_clicks prev_impressions    Is_Conv Weight
1384011915 1384011915  0   0   1234    86549917    2739    Standard    54876   300x250 1003    9922    1       Imp 1           1   1   15  0   0   0   0.0001
1384023420 1384011915  11505   11505   1234    86549917    2739    Standard    54876   300x250 1003    9922    2       Imp 2           2   2   15  0   1   0   0.0001
1384123446 1384011915  111531  100026  1234    86549917    2739    Standard    54876   300x250 1003    9922    3       Imp 3           3   3   15  0   2   0   0.0001
1384123493 1384011915  111578  47  1234    86549917    2739    Standard    54876   300x250 1003    9922    4       Imp 4           4   4   15  0   3   0   0.0001
1384251680 1384011915  239765  128187  9876    86549917    2491    Search  0   0x0 7459    9027        1   Click   5           5   5   15  1   3   0   0.0001
1384255778 1384011915  243863  4098    1234    86549917    2739    Standard    54876   300x250 1003    9922    5       Imp 6           6   6   15  1   4   0   0.0001
1384256704 1384011915  244789  926 1234    86549917    2739    Standard    54876   300x250 1003    9922    6       Imp 7           7   7   15  1   5   0   0.0001
1384287309 1384011915  275394  30605   9876    86549917    2747    Standard    55758   160x600 1010    9922    7       Imp 8           8   8   15  1   6   0   0.0001
1384288823 1384011915  276908  1514    1234    86549917    2764    Standard    55855   300x250 1036    9922    8       Imp 9           9   9   15  1   7   0   0.0001
1384342474 1384011915  330559  53651   1234    86549917    2739    Standard    54876   300x250 1003    9922    9       Imp 10          11  10  15  1   8   0   0.0001
1384381908 1384011915  369993  39434   9876    86549917    2764    Standard    56137   300x250 1036    9922    10      Imp 11          12  11  15  1   9   0   0.0001
1384462442 1384011915  450527  80534   1234    86549917    2739    Standard    54876   300x250 1003    9922    11      Imp 12          13  12  15  1   10  0   0.0001
1384543045 1384011915  531130  80603   1234    86549917    2739    Standard    54876   728x90  1003    9922    12      Imp 13          14  13  15  1   11  0   0.0001
1384543067 1384011915  531152  22  1234    86549917    2739    Standard    54876   728x90  1003    9922    13      Imp 14          15  14  15  1   12  0   0.0001
1384545213    1384011915  533298  2146    9876    86549917    2773    Standard    56271   728x90  1028    9922    14      Imp 15          16  15  15  1   13  1   0.0001
1383856924    1383856924  0   0   9876    86949417    2491    Search  0   0x0 7459    9027        1   Click   1           1   1   1   0   0   1   0.0001
1383408344    1383408344  0   0   9876    87159517    2760    Standard    55705   728x90  1042    9585    1       Imp 1           1   1   7   0   0   0   0.0001
1383408509    1383408344  165 165 9876    87159517    2760    Standard    55705   728x90  1042    9585    2       Imp 2           2   2   7   0   1   0   0.0001
1383486599    1383408344  78255   78090   9876    87159517    2756    Default 55567   1x1 1041    8897    3       Imp 3           7   3   7   0   2   0   0.0001

• Haven't done much survival, so not going to answer, but I believe de Vries' code example is incorrect for time-dependent data. Surv(time, event) would be for a more standard analysis where you just have one summary line per person. – Affine Jan 10 '14 at 1:06
• Surv(start, stop, event) would be the setup you would want here, with each observation in sequence having the start and end time of the influence of the current ad (probably indexed to zero for the first), variables related to the current ad. Only the last observation would have the chance to have event=1, with the rest event=0. Again, might be more I'm unaware of (as said, not much survival). – Affine Jan 10 '14 at 1:06