Aan de slagGa gratis aan de slag

Regression for holiday / promotional effects

Now that you have created the New Year's indicator variable, let's see if it is significantly different than the usual sales pattern using regression.

Your data.frame with log of sales and log of prices is saved in your workspace as MET_hi_train. Your New Year's variable is stored as newyear.

Deze oefening maakt deel uit van de cursus

Forecasting Product Demand in R

Cursus bekijken

Oefeninstructies

  • Create a new dataset, MET_hi_train_2 by combining MET_hi_train and your new year variable as a vector.
  • Build a regression model for the high end product in the metropolitan region. The model should predict the log of sales (log_sales) with the log of price (log_price) and the New Year's variable (newyear) and use the new MET_hi_train_2 dataset you just created.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# Create MET_hi_train_2 by adding newyear
MET_hi_train_2 <- data.frame(MET_hi_train, as.vector(___))
colnames(MET_hi_train_2)[3] <- "newyear"

# Build regressions for the product
model_MET_hi_full <- lm(___ ~ ___ + ___, data = ___)
Code bewerken en uitvoeren