Ok, if i understand it correct;
code should look like this ?
How do i get the values like forecast and alpha,beta ,gamma in the sales-table ?
As you can see my code generates the values for the whole time series ,but i would need them row wise moving for 20 observations.(so the first 19 lines are blank and the values would start at observation 20)
btw; what do you mean with sales <- r ?
Can you amend my reprex so i can understand ?
cheers
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")
#> New names:
#> * `` -> ...7
#> * `` -> ...8
salesLogHW <- HoltWinters(salesLog)
#> Error in as.ts(x): object 'salesLog' not found
sales <- r
#> Error in eval(expr, envir, enclos): object 'r' not found
HoltWinters(x= salesLog)
#> Error in as.ts(x): object 'salesLog' not found
findfrequency(nextYearSales)
#> Error in findfrequency(nextYearSales): object 'nextYearSales' not found
cbind('sales', rowMeans(forecast.ets)[3:1])
#> Error in rowMeans(forecast.ets): 'x' must be an array of at least two dimensions
sales <- sqrt(salesLogHW$dispersion)
#> Error in eval(expr, envir, enclos): object 'salesLogHW' not found
dnorm(7, mean = coef(m1), sd = sdest)
#> Error in coef(m1): object 'm1' not found
autoplot(forecast(fit))
#> Error in forecast(fit): object 'fit' not found
fit <- Arima(sales$sales)
salesLogHW
#> Error in eval(expr, envir, enclos): object 'salesLogHW' not found
nextYearSales
#> Error in eval(expr, envir, enclos): object 'nextYearSales' not found
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-16 by the reprex package (v0.3.0)