1
$\begingroup$

Goal: build a survival analysis to understand user behavior in an online site.

I have a data set of an online site where user appear from the first time and the last time. I am trying to build a survival analysis. Using this information.

userId, firstEntry, lastEntry
001,11/6/2012,11/6/2012
002,9/9/2005,9/9/2005
003,11/13/2013,8/1/2014
004,2/2/2006,2/2/2006
005,9/17/2005,9/17/2005
006,9/1/2005,1/26/2010
007,9/21/2005,9/26/2011
008,3/30/2011,3/30/2011
009,9/5/2005,9/5/2005
010,1/14/2010,1/14/2010

How do I create the event column (censor) to really do a survival analysis. Should I apply the logic of "how many days it took to come back" and use that to create event column along with a column representing the gap.

If the firstEntry and the lastEntry are the same, that means thats the only time user enter the site.

My goal was to fallow something similar to this. https://docs.google.com/file/d/0BwogTI8d6EEibDVxakozYVdZc0k/edit

I haven't decided yet to do this in R or Python. I am open for language agnostic answer or language specific answer.

$\endgroup$
3
  • 1
    $\begingroup$ Could you please clarify the meaning of your "lastEntry" column? If the date there is the same as the date of the "firstEntry" column, does that mean that the person came back on the same day, or that the firstEntry was the only (and thus also the last) Entry? That makes a big difference for trying to use survival analysis as in your linked example. Also, how many "Entry" times might there be overall for an individual user? $\endgroup$
    – EdM
    Nov 7, 2016 at 22:05
  • $\begingroup$ Just edited: Yes thats the only time user entered the site. And there can be as many entry times in a given month but mostly based on the data i see user only entering once a month but recurrence is the once that I think i am trying to measure via survival $\endgroup$ Nov 7, 2016 at 22:09
  • $\begingroup$ You are coming at this the wrong way: you should be coming up with a hypothesis and then using survival analysis to make testable. Try to express in English how your users behave (in the question) . In loan application the death event is never paying back the loan, but since you can never know for certain you create a technical 'death' not paying for 3 consecutive months. Maybe you could do something similar_ define death if haven't seen the customer for n months. (but your dataset would need to be redone) $\endgroup$
    – seanv507
    Nov 7, 2016 at 23:49

2 Answers 2

4
$\begingroup$

You need an event for survival analysis to predict survival probabilities over a given period of time for that event (i.e time to death in the original survival analysis). In your case, perhaps, you are looking for a churn analysis. So chern of your customers is equal to their death. To do a simple analysis that serves your purpose, all you need is a table of customers with a binary value indicating whether they have churned and a time associated with that. This time measure the time passed from their FirstEntry. So, you need the following data:

Customer ID    time     churn
       1        100       0
       2        72        1
       3        590       0
       ...

I made up this data, just as an example. You have to define a dummy variable as the churn column, depending on the problem. Perhaps, you want to label them as either churned or not based on frequency or recency of visit or transactional behaviour.

$\endgroup$
2
  • $\begingroup$ Could you please explain the churn column and how i should read the record as. For example user 1 left the system after 100 days, user 2 has been in the system for 72 days and hasn't left the system yet? $\endgroup$ Nov 8, 2016 at 21:18
  • $\begingroup$ No time is the $current time - Entrytime$. The definition of churn event depends on your problem but you have to defined an event. For instance you can say if a customer has not visited the site for the last 10 days he is dead in my survival analysis. $\endgroup$
    – MFR
    Nov 8, 2016 at 22:31
2
$\begingroup$

"Censored" individuals in survival analysis are those for whom the "event" hasn't yet happened. So if an individual has the same firstEntry and lastEntry times and that can only happen if the person only visited the site one time, then those are the individuals that should be considered "censored." Anyone who came back would have an "event" at the time of the lastEntry.

This might not, however, be a good application for survival analysis, at least in its simplest form. What if an individual can enter the site more than twice?

If an individual can come back multiple times then it seems that you would want to know about all the intervening visits to the site. The meaning of, say, 6 years between firstEntry and lastEntry would be different for someone who only visited those 2 times and someone who visited daily for 6 years; it's not clear how your data distinguish those possibilities. The first case is a highly infrequent visitor, while the second is very frequent. If you have information about multiple visits from the same individuals, then you should consider some analysis of recurrent events.

Even if individuals only can enter twice, how sure are you that there wasn't a second entry on the same day as the first? Again, someone who returned that quickly ought to be distinguished from someone who never returned at all.

$\endgroup$
2
  • $\begingroup$ Yes Some users have entered multiple times such as once a month for 3 years. I was hoping that Survival analysis gives me an understanding of how long user survive in the system. Like the user who came monthly for three years. Am i thinking wrong here? $\endgroup$ Nov 7, 2016 at 22:24
  • 2
    $\begingroup$ @Null-Hypothesis it's not clear that survival analysis will address your central question of how long a user survives in the system. For survival analysis to work the "event" would have to be the time that the user leaves the system, never to come back. The lastEntry values do not necessarily represent those times, as a user might come back tomorrow. Also, someone who just visited once and never came back would be "censored" (no event) and assumed to still be in the system. That doesn't seem to be what you intend. Survival analysis could work for determining how quickly users return. $\endgroup$
    – EdM
    Nov 8, 2016 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.