Applies a fitted ARIMA model to a new dataset.
# S3 method for class 'ARIMA'
refit(object, new_data, specials = NULL, reestimate = FALSE, ...)
A model for which forecasts are required.
A tsibble containing the time points and exogenous regressors to produce forecasts for.
(passed by fabletools::forecast.mdl_df()
).
If TRUE
, the coefficients for the fitted model will be re-estimated to suit the new data.
Other arguments passed to methods
A refitted model.
lung_deaths_male <- as_tsibble(mdeaths)
lung_deaths_female <- as_tsibble(fdeaths)
fit <- lung_deaths_male %>%
model(ARIMA(value ~ 1 + pdq(2, 0, 0) + PDQ(2, 1, 0)))
report(fit)
#> Series: value
#> Model: ARIMA(2,0,0)(2,1,0)[12] w/ drift
#>
#> Coefficients:
#> ar1 ar2 sar1 sar2 constant
#> 0.2480 -0.3326 -0.9903 -0.4766 -146.0254
#> s.e. 0.1392 0.1393 0.1340 0.1356 25.6430
#>
#> sigma^2 estimated as 28448: log likelihood=-397.01
#> AIC=806.03 AICc=807.61 BIC=818.59
fit %>%
refit(lung_deaths_female) %>%
report()
#> Series: value
#> Model: ARIMA(2,0,0)(2,1,0)[12] w/ drift
#>
#> Coefficients:
#> ar1 ar2 sar1 sar2 constant
#> 0.2480 -0.3326 -0.9903 -0.4766 -146.0254
#> s.e. 0.1392 0.1393 0.1340 0.1356 25.6430
#>
#> sigma^2 estimated as 14165: log likelihood=-378.7
#> AIC=759.41 AICc=759.48 BIC=761.5