nit$set(width=75)
library(tidyverse)
library(readxl)
##
## Call:
## lm(formula = sales2$Sales ~ t, data = sales2)
##
## Coefficients:
## (Intercept) t
## 349.883 3.475
##
## Call:
## lm(formula = sales2$Sales ~ t, data = sales2)
##
## Residuals:
## Min 1Q Median 3Q Max
## -55.655 -12.238 4.631 17.037 54.619
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 349.8831 9.1067 38.420 < 2e-16 ***
## t 3.4749 0.4816 7.215 4.97e-08 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 25.16 on 30 degrees of freedom
## Multiple R-squared: 0.6344, Adjusted R-squared: 0.6222
## F-statistic: 52.05 on 1 and 30 DF, p-value: 4.973e-08
## t
## 1 33
## 2 34
## 3 35
## fit lwr upr
## 1 464.5544 445.9560 483.1529
## 2 468.0293 448.5665 487.4921
## 3 471.5042 451.1663 491.8422
## fit lwr upr
## 1 464.5544 409.9156 519.1933
## 2 468.0293 413.0902 522.9684
## 3 471.5042 416.2490 526.7594
## Qtr1 Qtr2 Qtr3 Qtr4
## 1 339 319 352 330
## 2 378 392 390 395
## 3 386 383 396 396
## 4 412 387 382 423
## 5 386 420 417 474
## 6 450 444 456 449
## 7 428 444 389 447
## 8 395 417 473 482
## $x
## Qtr1 Qtr2 Qtr3 Qtr4
## 1 339 319 352 330
## 2 378 392 390 395
## 3 386 383 396 396
## 4 412 387 382 423
## 5 386 420 417 474
## 6 450 444 456 449
## 7 428 444 389 447
## 8 395 417 473 482
##
## $seasonal
## Qtr1 Qtr2 Qtr3 Qtr4
## 1 0.9905490 0.9963613 0.9884641 1.0246256
## 2 0.9905490 0.9963613 0.9884641 1.0246256
## 3 0.9905490 0.9963613 0.9884641 1.0246256
## 4 0.9905490 0.9963613 0.9884641 1.0246256
## 5 0.9905490 0.9963613 0.9884641 1.0246256
## 6 0.9905490 0.9963613 0.9884641 1.0246256
## 7 0.9905490 0.9963613 0.9884641 1.0246256
## 8 0.9905490 0.9963613 0.9884641 1.0246256
##
## $trend
## Qtr1 Qtr2 Qtr3 Qtr4
## 1 NA NA 339.875 353.875
## 2 367.750 380.625 389.750 389.625
## 3 389.250 390.125 393.500 397.250
## 4 396.000 397.625 397.750 398.625
## 5 407.125 417.875 432.250 443.250
## 6 451.125 452.875 447.000 444.250
## 7 435.875 427.250 422.875 415.375
## 8 422.500 437.375 NA NA
##
## $random
## Qtr1 Qtr2 Qtr3 Qtr4
## 1 NA NA 1.0477617 0.9101204
## 2 1.0376793 1.0336462 1.0123194 0.9894300
## 3 1.0011121 0.9853219 1.0180979 0.9728953
## 4 1.0503307 0.9768332 0.9716106 1.0356444
## 5 0.9571579 1.0087558 0.9759783 1.0436729
## 6 1.0070236 0.9839834 1.0320397 0.9864015
## 7 0.9913017 1.0429993 0.9306292 1.0502725
## 8 0.9438314 0.9568971 NA NA
##
## $figure
## [1] 0.9905490 0.9963613 0.9884641 1.0246256
##
## $type
## [1] "multiplicative"
##
## attr(,"class")
## [1] "decomposed.ts"
## Registered S3 method overwritten by 'quantmod':
## method from
## as.zoo.data.frame zoo
## Time Series:
## Start = 2
## End = 32
## Frequency = 1
## xhat level
## 2 339.0000 339.0000
## 3 327.7700 327.7700
## 4 341.3751 341.3751
## 5 334.9880 334.9880
## 6 359.1392 359.1392
## 7 377.5905 377.5905
## 8 384.5584 384.5584
## 9 390.4213 390.4213
## 10 387.9388 387.9388
## 11 385.1657 385.1657
## 12 391.2491 391.2491
## 13 393.9167 393.9167
## 14 404.0705 404.0705
## 15 394.4854 394.4854
## 16 387.4749 387.4749
## 17 407.4222 407.4222
## 18 395.3937 395.3937
## 19 409.2101 409.2101
## 20 413.5841 413.5841
## 21 447.5075 447.5075
## 22 448.9070 448.9070
## 23 446.1517 446.1517
## 24 451.6815 451.6815
## 25 450.1759 450.1759
## 26 437.7242 437.7242
## 27 441.2480 441.2480
## 28 411.9109 411.9109
## 29 431.6133 431.6133
## 30 411.0550 411.0550
## 31 414.3931 414.3931
## 32 447.3008 447.3008
## Time Series:
## Start = 3
## End = 32
## Frequency = 1
## xhat level trend
## 3 299.0000 319.0000 -20.0000000
## 4 328.3655 325.8632 2.5023559
## 5 332.3903 329.1940 3.1963173
## 6 378.0686 355.5076 22.5609659
## 7 413.6056 385.1298 28.4758527
## 8 420.0946 401.6411 18.4535512
## 9 415.1744 407.3754 7.7990610
## 10 395.7997 400.3873 -4.5876042
## 11 379.2901 389.3122 -10.0220111
## 12 384.8321 387.7596 -2.9274599
## 13 392.3067 390.4926 1.8141243
## 14 412.4636 402.2883 10.1753638
## 15 398.9215 399.5574 -0.6358079
## 16 382.5246 390.3448 -7.8202337
## 17 412.4042 403.0396 9.3645214
## 18 397.1752 399.0212 -1.8459618
## 19 416.5888 408.7440 7.8448284
## 20 424.8166 416.7972 8.0194045
## 21 478.6466 449.7453 28.9013227
## 22 480.8658 464.1270 16.7387407
## 23 463.2668 462.1803 1.0865367
## 24 457.5849 459.5836 -1.9987587
## 25 447.5900 453.2336 -5.6436571
## 26 423.6997 437.6607 -13.9610166
## 27 428.6469 433.9890 -5.3420753
## 28 386.3767 408.5518 -22.1750626
## 29 420.6677 417.1037 3.5639288
## 30 400.3241 407.6580 -7.3338668
## 31 408.5226 408.7763 -0.2537333
## 32 468.3247 441.2031 27.1216235
## Holt-Winters exponential smoothing with trend and without seasonal component.
##
## Call:
## HoltWinters(x = sales2$Sales, gamma = FALSE)
##
## Smoothing parameters:
## alpha: 0.5068519
## beta : 0.8376663
## gamma: FALSE
##
## Coefficients:
## [,1]
## a 475.25605
## b 32.92778
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
## 33 508.1838 468.7897 547.5780 447.9357 568.4320
## 34 541.1116 487.2762 594.9470 458.7775 623.4458
## 35 574.0394 498.1990 649.8798 458.0515 690.0273
## 36 606.9672 503.6620 710.2723 448.9756 764.9588
## 37 639.8950 504.9198 774.8702 433.4682 846.3217
## 38 672.8227 502.6748 842.9706 412.6040 933.0415
## 39 705.7505 497.3579 914.1431 387.0416 1024.4595
## 40 738.6783 489.2604 988.0962 357.2266 1120.1300
## Holt-Winters exponential smoothing with trend and multiplicative seasonal component.
##
## Call:
## HoltWinters(x = sales5, seasonal = "mult")
##
## Smoothing parameters:
## alpha: 0.5173288
## beta : 0.09782908
## gamma: 0.676918
##
## Coefficients:
## [,1]
## a 481.4121819
## b 5.2583010
## s1 0.9232647
## s2 0.9611800
## s3 0.9702222
## s4 1.0010002
## Point Forecast Lo 80 Hi 80 Lo 95 Hi 95
## 9 Q1 449.3257 414.2624 484.3890 395.7010 502.9503
## 9 Q2 472.8321 430.0219 515.6423 407.3595 538.3047
## 9 Q3 482.3820 432.1256 532.6383 405.5215 559.2424
## 9 Q4 502.9480 455.3932 550.5027 430.2192 575.6767
## 10 Q1 468.7449 402.0566 535.4332 366.7540 570.7358
## 10 Q2 493.0488 418.1285 567.9691 378.4681 607.6295
## 10 Q3 502.7888 420.5095 585.0682 376.9534 628.6242
## 10 Q4 524.0022 445.1184 602.8860 403.3599 644.6445