alpha beta and gamma table to create from time series

I have the following code ,it brings me the Holtwinters Alpha for the complete time series.
I would need a simple table showing Alpha,Beta and Gamma.(ABG)
The below code creates an Alpha ,Beta and gamma ,but not yet per line (variable).
Who can correct the code so it will give a table with every line showing a rolling + 2 ABG.
(so based on 2 previous values).Hope this makes sense to anyone.Otherwise i ll be happy to explain more in detail.
Who can help me?

code:

Holt-Winters exponential smoothing with trend and additive seasonal component.

HoltWinters(sales_alpha) -> sales_hw

plot(sales_hw)

plot(fitted(sales_hw))
sales_hw
sales_alpha

Call:
HoltWinters(x = sales_alpha)

result:

Smoothing parameters:
alpha: 0.2552655
beta : 0.004307726
gamma: 0.06110243

Coefficients:
[,1]
a 93.720628
b 2.492272
s1 -35.797018
s2 -16.251283

  • plot shown.

This is a part of the data it uses
#table

Sales1

[1] 6 5 18 8 43 61 95 139 45 88 93 98 11 336 9 313 47
[18] 583 66 61 4 90 15 13 19 18 11 19 61 17 144 40 38 309
[35] 41 77 96 33 8 39

=============================================================

But I am trying to get a simple table : alpha beta and gamma ,all rolling + 1:
it should look like this:

sales1

A tibble: 3 41 x 4

Date	 	           sales	lagsales alpha beta	gamma

1 03-01-2017 40 NA NA
2 04-01-2017 2 40 NA
3 05-01-2017 2 2 0 0.5 2
4 06-01-2017 2 2 0 1 1
5 07-01-2017 30 2 0 2 3
6 08-01-2017 2 30 -2 0.3 5
7 01-02-2017 9 2 -4.44 1 0
8 02-02-2017 5 9 -1.48 2 1
9 03-02-2017 65 5 -0.0604 5
10 04-02-2017 3 65 -2.69 9 3

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.