zeonsky / python-code-mcmc-to-fit-the-shifted-beta-geometric-customer-lifetime-value-model Goto Github PK
View Code? Open in Web Editor NEWTwo professors of marketing, Peter Fader and Bruce Hardie, have developed probability models for estimating customer lifetime value (LTV). In their papers and example spreadsheets, they estimate the models using maximum-likelihood estimation (MLE). In this post, I'm going to show how to use MCMC (via pymc) to estimate one of the models they've developed. Using MCMC makes it easy to quantify the uncertainty of the model parameters, and because LTV is a function of the model parameters, to pass that uncertainty through into the estimates of LTV itself. This post is primarily about implementing the model, and I'm only going to touch briefly on the strengths of the Fader/Hardie model over simpler, back-of-the-envelope formulas you'll find if you google 'calculate customer lifetime value.' But in the interest of motivating the implementation, the model is worth understanding because: by modeling the processes underlying aggregate metrics like 'churn rate' or 'repeated buying rate,' and by allowing for heterogeneity in a customer base, it provides more insight into customer behavior and in many cases, will provide less biased predictions about future behavior of customers.