# negative binomial GLM with time elapsed as a predictor

Suppose you have a response variable, number of transactions a customer makes in the 24 hour period following acquisition, which follows a negative binomial distribution. Let's call the response trans.

Now it's easy to model the number of transactions the customer makes in this immediate 24 hour period, or trans, using Library(MASS) in r and running a negative binomial GLM. I can get a nice fit by thoughtful selection of predictors.

Now I want to model the number of transactions a customer makes in any 24 hour period as a function of the number of days elapsed since the customer was acquired (call this predictor t). Empirically, as time elapsed increases, the 24 hour transaction rate decreases, although the rate of decrease is a decreasing function of time. Plugging number of days elapsed, or t, into the aforementioned negative binomial GLM runs in to all sorts of problems. I can get a good fit by adding a quadratic term t^2 but I cannot project beyond the number of days in the data set without getting illogical results; clearly adding a quadratic term is just curve fitting without capturing the underlying relationship of 24 hour transaction rates vs time elapsed since acquisition.

Is there any better way to approach this problem? I will add more details if this is unclear.

-
You might find the approaches described in the following Q&A helpful... stats.stackexchange.com/questions/24047/… –  jbowman Jun 7 '12 at 19:46
Thank you, this gave me the idea of looking at some simultaneous equations estimation techniques popular for use with macroeconomic research. –  benrolls Jun 7 '12 at 21:19
Another option would be to look at other transformations of t. Adding a quadratic term is often problematic for extrapolation, but a logarithm transform or some other method might give you a decreasing rate of decrease without the same problems. –  Peter Ellis Jun 9 '12 at 23:00
This paper by Bruce Hardie on projecting customer retention clearly explains the trouble with traditional parametric methods: –  benrolls Jun 11 '12 at 14:16
link to aforementioned paper: brucehardie.com/papers/021/sbg_2006-05-30.pdf The change in my 24 hour transaction rate is largely a function of customer retention over time. Perhaps I could incorporate the survival function mentioned in this paper into my original model. –  benrolls Jun 11 '12 at 14:26