Get startedGet started for free

Model extensions part 2: Dynamic variables

1. Model extensions part 2: Lagged effects

Despite extensive efforts, into advertising and promotion, companies often don't get the desired response immediately from their customers. Commonly, companies realize the response after a certain time span, which can be just after seeing the communication or maybe month later.

2. About lags

The time span between marketing activities and their effect on the outcome from the target market is known as carry-over effect. The existence of carry-over effects means that the effect of marketing activities should be evaluated over a longer period. This can be done by adding lagged variables to the response function. Introducing lags means shifting the time base back by a given number of observation periods. Shifting can be done by using the function lag(). To better understand the lag-function, we take as an example the PRICE of sales-dot-data and compare PRICE to it’s lagged version by using the function cbind(). We display only the first few elements by using the function head(). We see, applying the lag-function on PRICE results in a vector that is one observation shorter than the original one and the first observation is now the second one.

3. Adding lagged price effects

In the following lesson, we consider only one lagged term for PRICE in our sales response function. We apply the lag-function on PRICE and assign the result to a variable named Price-dot-lag. The Price-dot-lag predictor enters the definition of the response function additively together with the original PRICE predictor. The result is assigned to an object named lag-dot-model. The coefficients can be obtained, as usual, by the coefficient-function. The estimated coefficients indicate that changes in price have a negative effect on sales in the first period but a positive effect in the second.

4. More lags

Next, we shift the effect of COUPON activity by using the function lag(). The result is assigned to a variable named COUPON-dot-lag. We update the previously estimated lag-dot-model object for the missing COUPON and COUPON-dot-lag predictors by using the function update(). Comparing the size of the estimated coefficients shows that COUPON activity has more an immediate than a lagged effect.

5. What's the value added?

Finally, we fit an extended model including lags for all marketing activities. Again, all lagged predictors enter the definition of the response function additively together with the corresponding original predictors. We store the result in an object named extended-dot-model. We create a scatterplot by using the function plot() on log-SALES versus the observation weeks. This time the predicted log-SALES are obtained by using the function fitted-dot-values() on the extended-dot-model object. The predictions are added to the graph by using the function lines(). The lines-function works similar to the plot-function but can only be used to add information to a graph. The graph shows no longer a straight line. Instead, our model is capturing all the peaks in the observed sales like in a time series model.

6. Let's practice!

Great! Now let’s lag our data.

Create Your Free Account

or

By continuing, you accept our Terms of Use, our Privacy Policy and that your data is stored in the USA.