I am preparing for a 'hackathon' my company is hosting, and could use some advice regarding if my idea is correct


Some background – my company requires customers to purchase ‘credits’ that are used on products (e.g. spend $5 to buy 30 credits to spend on our product). I want to model this ‘decay rate’ and be able to say things like 15 days after buying the $5 bucket of credits, 80% of customers will have spent 20/30 credits

Is this the same as survival analysis? What has me hesitating is that the target variable (number of coins left) is continuous and not discrete. Will this still be handled by the model, or should I look for another type of model?

Additionally I am familiar with the survival package in r, but wanted to do this project using Stan/brms because I’ve been trying to improve my skills with these tools. Would I just be fitting a Poisson GLM to the decay rate, or is there a more favorable method?


I wouldn’t say that classic survival models are not directly applicable to this kind of analysis but some of their key features can be incorporated into an appropriate model.

Firstly you have to confront the observational model of consumption. Let’s say that each observation is comprised of the current time, the previous time, and the observed (continuous) amount of credits at each. In order to specify an observational model we have to reason about how people are consuming their credits: do they consume a similar amount regardless of how much they left or are their “rationing effects” where people tend to use a fixed percentage of what remains.

If consumption rate is fixed then one might consider a truncated observational model like

c_{n} \sim \pi(\max(0, c_{n - 1} - \rho), \phi)

where \pi is a density function over the positive real line in a location parameterization and \rho quantifies a consistent consumption rate across all times. Or if one assumed a constant rate of consumption then they'd have to take the time between observations \tau_{n, n -1}$ into account,

c_{n} \sim \pi(\max(0, c_{n - 1} - \rho \cdot \tau_{n, n -1}), \phi).

On the other hand if consumption is conditional then one might consider

\frac{c_{n}}{c_{n - 1}} \sim \pi(\omega, \phi)

where \pi might for example be a beta density function in a location parameterization (such as the beta_proportional in Stan) and \omega quantifies a proportional consumption of what it left.

One could build upon these simple models by allowing the behavior to change with time, for example by allowing \rho and \omega to vary with n or by building a hidden Markov model where consumers can shift between different behaviors at different times.

Anyway there are a lot of modeling opportunities in an application like this but which is most productive will depend on the particular details of the application. For a workshop it often helps to work with simulated data so that you can fix those details to be relatively simple, but even then I find it productive to give the audience a hint of the complexity that might arise in more realistic settings.