Hi, i need to reshape my outcomes into a matrix.So I believe you would be the expert :-).
I am familiar with Holtwinters myself.And my code provides alpha,beta and gamma.
For example the my excel file shows:sales;1,2,3,4,5,6 = 21 total.My code calculates the ABG over 21.and says for example Alpha 0.5 ,Beta 0.97 and Gamma :0.93
so i
I would need to see those values on row bases .
Holtwinters calculation:
salesLogHW <- HoltWinters(salesLog)
HoltWinters(x= salesLog)
Forecast calculation:
HoltWinters(nextYearSales)
autoplot(forecast(fit))
nextYearSales
The challenge is to combine the output of the actual sales with the forementioned calculations on rowbases and create a matrix.
would you be able to help me with that?
i would love to do this together .
cheers.Ron
reprex:
# load needed packages
library(readr)
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(readxl)
library(forecast)
#> Registered S3 method overwritten by 'quantmod':
#> method from
#> as.zoo.data.frame zoo
library (ggplot2)
sales <- read_excel("C:/Users/jenny/Desktop/R Studio/MonthlySales1.xls")
#> New names:
#> * `` -> ...7
#> * `` -> ...8
salesLogHW <- HoltWinters(salesLog)
HoltWinters(x= salesLog)
saleslog(nextYearSales)
autoplot(forecast(fit))
nextYearSales
sales
#> # A tibble: 95 x 8
#> Month sales `ETS Forecast` `Hw -alpha` `Hw-beta` `Hw-gamma` ...7 ...8
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 january 43 NA NA NA NA NA NA
#> 2 february 48 NA NA NA NA NA NA
#> 3 march 47 NA NA NA NA NA NA
#> 4 april 48 NA NA NA NA NA NA
#> 5 may 48 NA NA NA NA NA NA
#> 6 june 49 NA NA NA NA NA NA
#> 7 july 38 NA NA NA NA NA NA
#> 8 august 25 NA NA NA NA NA NA
#> 9 september 48 NA NA NA NA NA NA
#> 10 october 48 NA NA NA NA NA NA
#> # ... with 85 more rows
Created on 2020-05-18 by the reprex package (v0.3.0)