You are on page 1of 2

R version 4.1.

2 (2021-11-01) -- "Bird Hippie"


Copyright (C) 2021 The R Foundation for Statistical Computing
Platform: aarch64-apple-darwin20 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.


You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

Natural language support but running in an English locale

R is a collaborative project with many contributors.


Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or


'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

[R.app GUI 1.77 (8007) aarch64-apple-darwin20]

[Workspace restored from /Users/rajeshsinha/.RData]


[History restored from /Users/rajeshsinha/.Rapp.history]

> MH <- read.csv("/Users/rajeshsinha/Library/Mobile Documents/com~apple~CloudDocs/Marriott Hamilton csv.csv",


header = TRUE)
>
> head(MH)
CODE WEEK DOW.INDICATOR1 DEMAND TUESDAY.BOOKINGS PICKUP.RATIO DOW.INDEX
1 1 1 1 1470 1512 0.9722222 0.8647725
2 1 1 2 870 864 1.0069444 0.9105852
3 1 1 3 986 827 1.1922612 0.9728832
4 1 1 4 1247 952 1.3098740 1.0125249
5 1 1 5 1109 740 1.4986486 1.0678813
6 1 1 6 1197 908 1.3182819 1.1227265
>
> MHD <- MH[,4]
> MHDts <- ts(MHD, frequency = 7, start = c(1,1), end = c(11,7))
>
> MHDtsDC <- decompose(MHDts)
> plot(MHDtsDC)
>
> DHW <- HoltWinters(MHDts)
>
> summary(DHW)
Length Class Mode
fitted 280 mts numeric
x 77 ts numeric
alpha 1 -none- numeric
beta 1 -none- numeric
gamma 1 -none- numeric
coefficients 9 -none- numeric
seasonal 1 -none- character
SSE 1 -none- numeric
call 2 -none- call
>
> dhw
Error: object 'dhw' not found
> DHW
Holt-Winters exponential smoothing with trend and additive seasonal component.

Call:
HoltWinters(x = MHDts)

Smoothing parameters:
alpha: 0.9315758
beta : 0.02895253
gamma: 1

Coefficients:
[,1]
a 999.600280
b -7.109836
s1 199.980877
s2 -123.760567
s3 113.263263
s4 98.312912
s5 -90.088345
s6 -271.717989
s7 -110.600280
>
> plot(DHW)
>
> DHW.pred <- predict(DHW, 10, prediction.interval = TRUE, level=0.95)
>
>
> plot(DHW, xlim = c(1,14))
> lines(DHW.pred[,1], col="blue")
> lines(DHW.pred[,2], lty=2, col="orange")
> lines(DHW.pred[,3], lty=2, col="orange")
> MHDtsf <- ts(MHD, frequency = 7, start = c(1,1), end = c(13,3))
> lines(MHDtsf)
> abline(v=11)
>

You might also like