# Predict on a log growth model, adjust starting value from r generated model

For a project that I'm working on we consider a cohort a set of people who installed our app on any given day. The cumulative revenue from a cohort is logarithmic in shape and I'd like to use this fact to build a predictive model.

I'm aware that time series might be appropriate here, but for this project I really want to try this using a logarithmic model along the lines of what follows.

I'm struggling in how I should predict on a new cohort of data. Here's an example:

exampledf <- data.frame(
tenure = 1:11,
cumulative_revenue = c(142, 149, 154, 155, 159, 161, 163, 164, 164, 166, 167)
)

exampledf %>% ggplot(aes(x = tenure, y = cumulative_revenue)) + geom_point()
exampledf %>% ggplot(aes(x = log(tenure),y = cumulative_revenue)) + geom_point()


These charts look like this: Logarithmic curve:

When log transforming the predictor, it's linear:

Pretend the data above is based on historic data. Suppose I used data for the 30 cohorts/days in the month of April 2020 and monitored the cumulative revenue for each then grouped by days of tenure 1:11 per the above sample and then took the cumulative revenue on each additional day.

Based on this I fit a log model in R:

model <- lm(cumulative_revenue ~ log(tenure), data = exampledf)
summary(model)
mod_coeffs <- model %>% coefficients
predict(model, newdata = data.frame(tenure = 16)) # 170.8961 # a prediction for cumulative revenue after 16 days of tenure


Here's the summary of the model:

Call:
lm(formula = cumulative_revenue ~ log(tenure), data = exampledf)

Residuals:
Min       1Q   Median       3Q      Max
-1.40429 -0.07062  0.08757  0.35345  0.74568

Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 141.9124     0.4943  287.08  < 2e-16 ***
log(tenure)  10.4537     0.2837   36.85 3.96e-11 ***
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 0.6684 on 9 degrees of freedom
Multiple R-squared:  0.9934,    Adjusted R-squared:  0.9927
F-statistic:  1358 on 1 and 9 DF,  p-value: 3.956e-11


Now here's my question. Using this model based on historic data, I can predict what cumulative revenue will be after n days using predict(model, newdata = data.frame(tenure = 16)). But if I have genuine new data, my starting point will always be different. E.g. say that the growth curve looks the same as the examples above for a new cohort, but that they have a smaller initial starting value. Maybe there's variation from cohort to cohort. In the example data, the cumulative revenue on day 1 is 142. But what if for another cohort it's 200, then for another it's only 50.

Is there something I can do here? I almost want to change the intercept when predicting, or just use the models growth rates as opposed to actual to predict on new data.

How can I wield my model to fit new data that takes into account not only tenure in days, but also the initial revenue after day 1 to make a prediction?

If $$T$$ is the tenure and $$R(T)$$ is the cumulative revenue at that tenure

then your model is $$R(T) \approx m \log(T) +c$$

which suggests $$R(T_n)-R(T_k) \approx m \log(T_n/T_k)$$ for any two tenures $$T_k$$ and $$T_n$$

If you believe your estimate of $$m\approx 10.4537$$ will be applicable to your other cases too then you can use this second form to project forward the additional revenue from any particular point. This means that your model would predict the same additional revenue after $$R(1)$$, no matter what the initial amount.

Alternatively, if you believe that the initial revenue indicates the scale of likely future revenue, then you may want to adjust $$m$$ proportionately in the other cases. This would not just be adjusting the intercept $$c=R(1)$$, but also the slope of the curve.

It is your model, so your choice; whatever you do is likely to be wrong, but getting more information for the other cases beyond their initial points might enable you to refine your model to make it less wrong.

• Hi thanks for your answer, I've read it over and absorbed it. Follow up.. "It is your model, so your choice; whatever you do is likely to be wrong" Are you referring to my model specifically and that I should go another route e.g. time series or do you mean in the more general sense 'all models are wrong, some are useful' sense? May 6 at 17:15
• @DougFir All models are wrong, but you are particularly suffering from having one time-series and another starting point; you cannot know which patterns in the first will be repeated in the second and which not, so will almost certainly be wrong in whatever you assume. Perhaps when you see what actually happens with the second, you can do slightly better with the third. And so on. May 6 at 17:34