R Tutorial: Nonlinear response models

Learn why linear price-sales models fail in marketing and how exponential models capture diminishing returns instead. A 1-unit price increase causes roughly 66% sales decrease. Transform the model with logarithms to estimate it with R's lm() function, then plot the fit against actual data.
Chapters
In this lesson we focus on the most common type of response models used in marketing practice and these are nonlinear models. The assumption of sales increase by a constant amount when prices decrease by a constant amount is far from being consistent with the ways markets appear to behave in reality. Because what happens to sales when price is zero? Very large? And what about threshold effects like a minimum price? Basic economic theory let us expect if beer is very cheap, customers will probably buy more, whereas if the price of beer is high, customers are less likely to buy. If in a price promotion campaign the price for beer is being decreased, at some point, returns in sales must be expected to diminish. This means we expect price decreases to have more effect on sales returns when price itself is higher than when it is lower. Most market response models are non linear to resemble diminishing returns, and there exist several functional forms that can be used to represent this phenomenon. One of the most frequently used response functions to describe sales price relations is the so called exponential function. This function is appropriate as if price equals zero, sales equals zero. If price decreases, sales increase, whereas if the price goes to infinity, sales tend to zero at the same time. The exponential model assumes a constant rate of increased sales, meaning a constant percentage change. The slope coefficient measures the relative change in sales for a given absolute change in price. If the relative change is multiplied by 100, we obtain the percentage change or growth rate. The exponential model is nonlinear in its definition, but after taking the logarithms of both sides, the model becomes linear and can be again estimated by using the linear model function. We take the log of the sales directly in the formula statement of the linear model function and store the estimation results in an object called logmodel. The model coefficients are again obtained from the logmodel object by using the coefficient function. The price slope coefficient is still negative in its sign but changed in size as the changes in sales are now expressed relative to changes in price. Therefore, the coefficient is interpreted if the price increases around one unit, our sales decrease around 66%. Again we check if the model provides an acceptable degree of predictive accuracy by comparing the model's predicted values in a scatterplot to the observed data values. This time we create the scatter plot on the log transformed sales responses versus the untransformed price predictor. By using the function plot, the predicted log sales are now added to the graph. By again plugging in the model coefficients of the log model object into the function abline like before, we can see that the log sales decrease when price increases, but the line does deviate less from the observations. Meaning the model fits the data much better than before. Go ahead and try it.
More from Richie

#359 My Best Friend is AI with Valerie Tiberius, Professor of Philosophy at University of Minnesota

How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon

#358 How AI Agents Will Work While You Sleep | Ruslan Salakhutdinov, Professor at Carnegie Mellon







