1
$\begingroup$

Suppose I have the following dataframe:

id    time    sale_yn number  journey_nr  "nVariables with observation specific variables"
abc   10      0      1        1
abc   11      0      2        1
abc   12      1      3        1
abc   13      0      1        2
def   10      0      1        3
def   15      1      2        3
def   16      0      1        4
def   17      0      2        4
def   18      1      3        4

Every row is an observation from a particular person (distinguished by ID). Every person visits a shop a number of times (see number). After some while it is possible that a customer makes a purchase (in that case sale_yn == 1). The regression model needs to take into account the different journeys a customer has made in order to predict whether a sale happens or not. With logistic regression, each observation should be independent of eachother, but the visits that occurred earlier, also contribute to the purchase.

What form of regression can take this into account?

$\endgroup$
1
$\begingroup$

I am not sure exactly what you mean by "journey" but it sounds like survival analysis would be a good starting point; at the least, this would let you plot survival functions (time to sale) and deal with any censoring (people who never bought). (In the data shown, there was no censoring, but survival analysis still works well).

After some exploratory analysis and plotting, you could try adding "journey" as an IV in (e.g.) a Cox proportional hazards model. However, in the data shown, "journey" is highly collinear with ID. How to deal with this would depend on whether "journey" takes a limited number of categories or is different for each person.

$\endgroup$
  • $\begingroup$ A journey is a sequence of visits by an person (ID). In the example, the first journey has got 3 visits after a purchase is done. The second journey, a journey with no purchase, consists of 1 visit, etcetera $\endgroup$ – Max van der Heijden Nov 5 '12 at 12:04
  • $\begingroup$ In that case, there should be a small number of different journeys and you should be able to add it as a categorical independent variable to a survival analysis. $\endgroup$ – Peter Flom - Reinstate Monica Nov 5 '12 at 12:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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