Hi David, Thank you for your help.I kinda had a bit of a feeling i was having the wrong Alpha as it usually provides different output.
I will work with the Holtwinters .
if using the following code, would that work?
HoltWinters(x, alpha = NULL, beta = NULL, gamma = NULL,
seasonal = c("additive", "multiplicative"),
start.periods = 2, l.start = NULL, b.start = NULL,
s.start = NULL,
optim.start = c(alpha = 0.3, beta = 0.1, gamma = 0.1),
optim.control = list()
I would need to use the packageHoltwinters() i guess?
How do i get the ABG shown in my table per separate line?
current reprex:
read_file(sales1)
library(tidyverse)
library(psy)
#Number of rows before to take into account
rolling = 2
sales1 <- sales::sales(
~date, ~sales,)
#Lag
sales1 = sales1 %>% mutate(lagsales = lag(sales))
#Get the rolling alpha
sales1$alpha = c(
rep(NA, rolling),
map_dbl((rolling + 1):nrow(sales1), function(x){
cronbach(sales1 %>% select(sales, lagsales) %>% slice((x-rolling):x))$alpha
})
)
sales1
cheers