Hello to all
MOVING FORECAST
I am trying to get a matrix with a moving forecast bases on previous 20 observations. (sales of water packs.)
HOLT WINTERS VALUE OR ETS
In my code i also have a calculation which shows me what the Holt winters numbers are for the whole time serie.(2 observation)But i would need to see those showing on a line bases (moving value per rolling 20 observations).
Is there anyone who can tell me what code ineed?
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) # necessary to use forecasting methods
#> Registered S3 method overwritten by 'quantmod':
#> method from
#> as.zoo.data.frame zoo
library(tsintermittent) # TSB (Teunter-Syntetos-Babai) method
#> Loading required package: MAPA
#> Loading required package: parallel
#> Loading required package: RColorBrewer
#> Loading required package: smooth
#> Loading required package: greybox
#> Error: package or namespace load failed for 'greybox' in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
#> there is no package called 'RcppParallel'
#> Error: package 'greybox' could not be loaded
library (ggplot2)
# import data
sales <-
read_excel("C:/Users/jenny/Desktop/R Studio/MonthlySales1.xls")
# explore data
str(sales)
#> Classes 'tbl_df', 'tbl' and 'data.frame': 95 obs. of 8 variables:
#> $ Month : chr "january" "february" "march" "april" ...
#> $ sales : num 43 48 47 48 48 49 38 25 48 48 ...
#> $ Forecast: num NA NA NA NA NA NA NA NA NA NA ...
#> $ fc alpha: num NA NA NA NA NA NA NA NA NA NA ...
#> $ fc beta : num NA NA NA NA NA NA NA NA NA NA ...
#> $ fc gamma: num NA NA NA NA NA NA NA NA NA NA ...
#> $ Low : num NA NA NA NA NA NA NA NA NA NA ...
#> $ High : num NA NA NA NA NA NA NA NA NA NA ...