Content
- Linear regression plays a key role to help dummier have an easy approach to interpret statistics and modeling. Before moving on the main indeed solving aspects, we should understand the datasets
There are 10 steps in forecasting process
1. Determine the purpose
2. Set level of aggregation and units of measure
3. Select horizon & planning bucket
4. Gather and visualize the data
5. Choose the forecastung technique
6. Prepare the data for the technique
7. Test the forecasting using horizontal data
8. Forecast is based on modeling technique
9. Achieve consensus on the forecasting
10. Continuous Improve forecast
| date | day | week | discount | pizza | weekday | day1 |
|---|---|---|---|---|---|---|
| 2014-05-01 | 1 | 0 | 0 | 329 | 5 | 1 |
| 2014-05-02 | 2 | 1 | 0 | 357 | 6 | 2 |
| 2014-05-03 | 3 | 1 | 0 | 351 | 7 | 3 |
| 2014-05-04 | 4 | 0 | 0 | 346 | 1 | 4 |
| 2014-05-05 | 5 | 0 | 0 | 342 | 2 | 5 |
| 2014-05-06 | 6 | 0 | 0 | 344 | 3 | 6 |
| 2014-05-07 | 7 | 0 | 0 | 356 | 4 | 7 |
| 2014-05-08 | 8 | 0 | 0 | 357 | 5 | 8 |
| 2014-05-09 | 9 | 1 | 0 | 368 | 6 | 9 |
| 2014-05-10 | 10 | 1 | 0 | 367 | 7 | 10 |
Visualize the data
Histogram
Dentisy in 2 dimensions
Multiple points
Modeling
image
image
Based on UnAdjusted Dataset
##
## Call:
## lm(formula = pizza ~ day + week + discount, data = dt_pr)
##
## Residuals:
## Min 1Q Median 3Q Max
## -12.4498 -6.2685 0.1675 5.2634 12.9122
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 339.7599 1.5872 214.067 < 2e-16 ***
## day 0.6728 0.0295 22.804 < 2e-16 ***
## week 14.3794 1.7216 8.352 8.81e-13 ***
## discount -2.8016 2.1560 -1.299 0.197
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 7.112 on 88 degrees of freedom
## Multiple R-squared: 0.8764, Adjusted R-squared: 0.8722
## F-statistic: 208.1 on 3 and 88 DF, p-value: < 2.2e-16
##
## Breusch-Godfrey test for serial correlation of order up to 10
##
## data: Residuals
## LM test = 8.1188, df = 10, p-value = 0.6172
Based on Adjusted Dataset
##
## Call:
## lm(formula = pizza ~ day + weekday + discount, data = dt_pr)
##
## Residuals:
## Min 1Q Median 3Q Max
## -18.3363 -6.6410 0.7636 6.3014 16.0324
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 333.7017 2.5171 132.575 < 2e-16 ***
## day 0.6669 0.0339 19.671 < 2e-16 ***
## weekday 2.5935 0.4569 5.677 1.73e-07 ***
## discount -2.8460 2.5327 -1.124 0.264
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 8.146 on 88 degrees of freedom
## Multiple R-squared: 0.8379, Adjusted R-squared: 0.8323
## F-statistic: 151.6 on 3 and 88 DF, p-value: < 2.2e-16
##
## Breusch-Godfrey test for serial correlation of order up to 10
##
## data: Residuals
## LM test = 8.7966, df = 10, p-value = 0.5515