tidyverts / tidyverts/fable

fable::ARIMA() compared to forecast::auto.arima()

Open
#426 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
588
Forks
71
Avg merge
1h 58m
Merged PRs (30d)
1

Description

Different numbers of differences chosen, and excessive memory used.

library(fable)
#> Loading required package: fabletools
#> Registered S3 method overwritten by 'tsibble':
#>   method               from 
#>   as_tibble.grouped_df dplyr
library(forecast)
#> Registered S3 method overwritten by 'quantmod':
#>   method            from
#>   as.zoo.data.frame zoo
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

# Different order of differences
auto.arima(AirPassengers, lambda = 0, biasadj = TRUE)
#> Series: AirPassengers 
#> ARIMA(0,1,1)(0,1,1)[12] 
#> Box Cox transformation: lambda= 0 
#> 
#> Coefficients:
#>           ma1     sma1
#>       -0.4018  -0.5569
#> s.e.   0.0896   0.0731
#> 
#> sigma^2 = 0.001371:  log likelihood = 244.7
#> AIC=-483.4   AICc=-483.21   BIC=-474.77
as_tsibble(AirPassengers) |>
  model(ARIMA(log(value))) |>
  report()
#> Series: value 
#> Model: ARIMA(2,0,0)(0,1,1)[12] w/ drift 
#> Transformation: log(value) 
#> 
#> Coefficients:
#>          ar1     ar2     sma1  constant
#>       0.5754  0.2614  -0.5553    0.0193
#> s.e.  0.0843  0.0842   0.0771    0.0015
#> 
#> sigma^2 estimated as 0.001323:  log likelihood=249.65
#> AIC=-489.29   AICc=-488.82   BIC=-474.88

# Benchmarks
bench::mark(
  forecast = auto.arima(AirPassengers, lambda = 0, biasadj = TRUE) |>
    forecast(h = 12),
  fable = as_tsibble(AirPassengers) |>
    model(ARIMA(log(value))) |>
    forecast(h = 12),
  check = FALSE
) |>
  select(expression, min, median, `itr/sec`, mem_alloc)
#> Warning: Some expressions had a GC in every iteration; so filtering is
#> disabled.
#> # A tibble: 2 × 5
#>   expression      min   median `itr/sec` mem_alloc
#>   <bch:expr> <bch:tm> <bch:tm>     <dbl> <bch:byt>
#> 1 forecast      1.59s    1.59s     0.628  398.74MB
#> 2 fable          5.5s     5.5s     0.182    1.27GB

Created on 2025-05-30 with reprex v2.1.1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the AirPassengers comparison using fable::ARIMA(log(value)) and forecast::auto.arima(), then inspect the ARIMA implementation and benchmark results to determine why differencing and memory use diverge. Done means the discrepancy is explained and, if confirmed as a bug, the behavior and memory use are corrected or covered by regression tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.