I am working on a problem involving understanding/predicting customer frequency. The data I am working with is structured as a series of interval days between orders:

'customer_id: 'A',
'order_n' : [1,2,3,4,5,6],
'interval_days': [Null, 7, 10, 2, 30, 3],

I would like to perform some analysis that covers the following aspects:

  • Captures uncertainty/volatility for customers with thin order history. (when n=2, stdv is meaningless)
  • Given order interval history ${I1, I2, I3, .. In}$, what is the Probability Distribution of $I_{n+1}$?
  • Can the PDF above be used to predict churn? e.g, $Pr(I_{n+1}=NULL)$ )
  • Is there a method that takes into account periodicity, without requiring time series/date analysis?

I think this problem is a good candidate for the Bayesian framework, however I don't have much experience with application here. Looking forward to the community's feedback. Thanks!


Since your are measuring time between transactions as an integer, you can construct a hierarchical Poisson model. Let $N$ be the number of customers, each with $n_i$ observations, $i = 1 \dots N$. Then construct a model like

$$ I_{n_i} \sim \operatorname{Poisson}(\lambda_i) $$

$$ \lambda_i \sim P(\Lambda) \quad i = 1 \dots N $$

You will have to decide on an appropriate prior for the $\lambda_i$. If you choose a gamma distribution, then the model is like a negative binomial regression.

Anyway, so this model says that the times between transactions are Poisson distributed with parameter $\lambda_i$. The parameter $\lambda_i$ will be different for each customer, but will be conceived as coming from a population distribution $P(\Lambda)$. If customers have thin history, then their $\lambda$ will be regularized to the posterior mean of the population distribution.

Since this is a generative model, you can sample from the posterior to determine the probability of $I_{n_i+1}$.

Churn also follows naturally from this model. It is up to you to define what a "churn" means in non-contractual retail settings, but one definition I have used before is as follows:

  • Determine the 90th percentile of each customer's between time transaction. For argument's sake, 'let's say it is 10 days. This means that 90% of the time, they will buy again within 10 days of their last purchase.
  • If the customer has not purchased within this time, then they are considered churned.

If you want to account for periodicity, you'll need some more advanced modelling.

Does that answer your question?

  • $\begingroup$ You can switch out the likelihood to whatever fits your assumptions best, $\endgroup$ Apr 4 '19 at 20:36
  • $\begingroup$ Thank you for the input! Refreshing my memory on Poission distributions, am concerned that the assumptions don't fit my use case: "k is the number of times an event occurs in an interval and k can take values 0, 1," Does this apply, since k will always be 1? I think i want to predict the interval itself. "The rate at which events occur is constant. The rate cannot be higher in some intervals and lower in other intervals" ^ this is almost definitely not the case for me. The rate will vary as a function of the customer's age. $\endgroup$
    – Jonathan
    Apr 4 '19 at 20:48
  • $\begingroup$ The Poisson is supported on the natural numbers, not 0 or 1. I don't know where you are getting that from. The model I've listed posits that the days between transactions (a natural number) is Poisson distributed. That is a pretty innocuous and standard assumption for integer data. I would suggest you review the properties of density functions before continuing. $\endgroup$ Apr 4 '19 at 23:15
  • $\begingroup$ I did review the properties, those quotes are straight from the wiki page. I may be misinterpreting, but it seems that the poisson distribution is focused on counting the number of occurrences in a fixed interval. Again, I want to know the expected interval until next single occurrence. Are you able to qualify your suggestion any further? PS- definitely 1 (and by some definitions 0) are both natural numbers, and are acceptable values of k $\endgroup$
    – Jonathan
    Apr 5 '19 at 16:53
  • $\begingroup$ The poisson has non-zero mass on all the naturals, not JUST 0 or 1. The poisson may be used to model counts in a specific interval, but it can also be used to model counts in general. You can consider the time between transactions as a single interval, and thus you are counting days in that interval. If you are counting the number of days between transactions, that seems like a reasonable use of the poisson distribution to me, but again you are free to change the likelihood to another discrete distribution. The meat of this answer is the hierarchical structure, not the likelihood. $\endgroup$ Apr 5 '19 at 17:04

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.