0

This can be considered as a follow-up question for this, as part of the exploration exercise on studying the difference between forecast and fable package.

I used the same dataset for forecasting future value as below:

library(fpp2)
library(forecast)
library(fable)

data(ausair)

set.seed(1)

holt(ausair,h=5)$model$par

#      alpha       beta          l          b 
# 0.84796776 0.09695709 6.51760869 0.68206040

set.seed(1)

tsibble::as_tsibble(ausair) %>%
  model(ETS(value ~ error('A') + trend('A') + season('N'))) %>%
  coef() %>%
  select(term,estimate) %>%
  data.frame

#    term   estimate
# 1 alpha 0.84811600
# 2  beta 0.09695788
# 3     l 6.51735643
# 4     b 0.68214725

I just want to make sure the small difference of estimates calculated using two different methods are due to the function itself, but not myself used different parameters without knowing it.

Thanks!

lokheart
  • 23,743
  • 39
  • 98
  • 169

2 Answers2

1

I found the difference by examining the holt function, the missing parameter is opt.crit='mse'.

library(fpp2)
library(forecast)
library(fable)
library(dplyr)

data(ausair)

holt(ausair,h=5)$model$par

#      alpha       beta          l          b 
# 0.84796776 0.09695709 6.51760869 0.68206040

tsibble::as_tsibble(ausair) %>%
  model(ETS(value ~ error('A') + trend('A') + season('N'),opt_crit='mse')) %>%
  coef() %>%
  select(term,estimate) %>%
  data.frame

#    term   estimate
# 1 alpha 0.84796776
# 2  beta 0.09695709
# 3     l 6.51760869
# 4     b 0.68206040
lokheart
  • 23,743
  • 39
  • 98
  • 169
0

Use set.seed(1) before the code.

Vector
  • 1
  • 1
  • I updated the script as suggested and the figures are not changes, looks like random seed is not the issue here – lokheart Nov 17 '20 at 03:02