2

I am trying to model the following data on promotional budget and customer awareness. The idea is, at some point, increase in budget doesn't have any further impact on awareness; it saturates.

> promo
  budget aware
1    0.7     8
2    0.8    11
3    0.9    16
4    1.0    21
5    1.1    22
6    1.4    31
7    1.5    36
8    2.0    45
9    3.0    50

Beyond promo$budget=3.0, there won't be any returns. A plot of the budget and aware shows a growth curve that looks a bit like Gompertz curve.

Budget vs. Awareness

So, I tried something like this:

f <- nls(aware ~ A*exp(-1*b*exp(-1*c*budget)), data=promo, start=list(A=4,b=1,c=-2))

It results in this error:

Error in nls(aware ~ A * exp(-1 * b * exp(-1 * c * budget)), data = promo,  : singular gradient

How do I fit the growth curve to this data?

1 Answers1

2

Use a self-starting model:

promo <- read.table(text = "  budget aware
1    0.7     8
2    0.8    11
3    0.9    16
4    1.0    21
5    1.1    22
6    1.4    31
7    1.5    36
8    2.0    45
9    3.0    50")

f <- nls(aware ~ SSgompertz(budget, Asym, b2, b3), data=promo)

plot(aware ~ budget, data = promo)
curve(predict(f, newdata = data.frame(budget = x)), add = TRUE)

resulting plot showing the data and the model fit

Note that SSgompertz uses a different parameterization, see help("SSgompertz"). However, your problem are the starting values. For instance, you start with an asymptote value of 4, which obviously is far from the actual value. If I set start = list(A = 50, b = 0.1, c = 1) I get a successful (and identical) fit with your parameterization.

Roland
  • 5,758
  • 1
  • 28
  • 60
  • Awesome! In the meantime, I was referring to the answer here: https://stats.stackexchange.com/a/160575/104075 where, an exponential curve fit, between y=Budget and x=Aware is used. I get a convergence tolerance of 6.202e-06 which is greater than the tolerance in this curve (4.533e-07). Plus, I *know* this is a phenomenon where the awareness variable will saturate. So, I guess, this model is better than the exponential model. – cogitoergosum Apr 27 '17 at 08:33