Adding lagged price effects
Next, you will check if the effects of temporary price changes on sales extend into the next period.
Like before, you shift the PRICE predictor back by using the function lag(). The result is assigned to a new variable Price.lag. The Price.lag variable is added to the log(SALES) ~ PRICE relationship. This simple lag-model can also be estimated by using the function lm().
Este exercício faz parte do curso
Building Response Models in R
Instruções do exercício
- Create a lagged variable for
PRICEnamedPrice.lag. - Estimate a lagged response model explaining
log(SALES)byPRICEandPrice.lag. Use the functionlm()and assign the result again to an object calledlag.model. - Obtain the coefficients of the
lag.modelby using the functioncoef().
Exercício interativo prático
Experimente este exercício completando este código de exemplo.
# Take the lag of PRICE
Price.lag <- lag(___)
# Explain log(SALES) by PRICE and Price.lag
lag.model <- ___(___ ~ ___ + ___, data = sales.data)
# Obtain the coefficients