Applies a fitted ETS model to a new dataset.

# S3 method for class 'ETS'
refit(
  object,
  new_data,
  specials = NULL,
  reestimate = FALSE,
  reinitialise = TRUE,
  ...
)

Arguments

object

A model for which forecasts are required.

new_data

A tsibble containing the time points and exogenous regressors to produce forecasts for.

specials

(passed by fabletools::forecast.mdl_df()).

reestimate

If TRUE, the coefficients for the fitted model will be re-estimated to suit the new data.

reinitialise

If TRUE, the initial parameters will be re-estimated to suit the new data.

...

Other arguments passed to methods

Examples

lung_deaths_male <- as_tsibble(mdeaths)
lung_deaths_female <- as_tsibble(fdeaths)

fit <- lung_deaths_male %>%
  model(ETS(value))

report(fit)
#> Series: value 
#> Model: ETS(M,A,A) 
#>   Smoothing parameters:
#>     alpha = 0.0002065548 
#>     beta  = 0.0001865257 
#>     gamma = 0.000118306 
#> 
#>   Initial states:
#>      l[0]      b[0]     s[0]     s[-1]     s[-2]     s[-3]     s[-4]     s[-5]
#>  1671.676 -4.334248 373.1746 -121.3157 -246.1697 -484.8581 -476.2192 -370.1939
#>      s[-6]    s[-7]    s[-8]    s[-9]   s[-10]   s[-11]
#>  -303.5806 -207.384 122.0022 483.3319 620.3601 610.8525
#> 
#>   sigma^2:  0.009
#> 
#>      AIC     AICc      BIC 
#> 1033.474 1044.807 1072.177 

fit %>%
  refit(lung_deaths_female, reinitialise = TRUE) %>%
  report()
#> Series: value 
#> Model: ETS(M,A,A) 
#>   Smoothing parameters:
#>     alpha = 0.0002065548 
#>     beta  = 0.0001865257 
#>     gamma = 0.000118306 
#> 
#>   Initial states:
#>      l[0]       b[0]     s[0]   s[-1]     s[-2]    s[-3]     s[-4]     s[-5]
#>  586.8764 -0.7008449 129.4235 -60.401 -108.8126 -185.465 -189.2346 -149.2135
#>      s[-6]     s[-7]    s[-8]    s[-9]   s[-10]   s[-11]
#>  -134.8698 -70.64105 45.28081 204.0216 279.4489 240.4628
#> 
#>   sigma^2:  0.0118
#> 
#>      AIC     AICc      BIC 
#> 903.5169 910.8854 935.3903