Applies a fitted AR model to a new dataset.

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

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.

...

Other arguments passed to methods

Value

A refitted model.

Examples

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

fit <- lung_deaths_male %>%
  model(AR(value ~ 1 + order(10)))

report(fit)
#> Series: value 
#> Model: AR(10) w/ mean 
#> 
#> Coefficients:
#>   constant     ar1      ar2     ar3      ar4      ar5    ar6      ar7      ar8
#>   572.0428  0.6739  -0.1584  0.1291  -0.1581  -0.0342  0.012  -0.1172  -0.0832
#>       ar9    ar10
#>   -0.0712  0.4145
#> 
#> sigma^2 estimated as 37672
#> AIC = -93.6	AICc = -89.2	BIC = -68.55

fit %>%
  refit(lung_deaths_female) %>%
  report()
#> Series: value 
#> Model: AR(10) w/ mean 
#> 
#> Coefficients:
#>   constant     ar1      ar2     ar3      ar4      ar5    ar6      ar7      ar8
#>   102807.6  0.6739  -0.1584  0.1291  -0.1581  -0.0342  0.012  -0.1172  -0.0832
#>       ar9    ar10
#>   -0.0712  0.4145
#> 
#> sigma^2 estimated as 1.053e+10
#> AIC = 913.99	AICc = 913.99	BIC = 913.99