Feature Request: Automatic K optimization for Fourier Terms
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 588
- Forks
- 71
- Avg merge
- 1h 58m
- Merged PRs (30d)
- 1
Description
If I wish to fit a regression with Fourier terms then to find the optimal K I need to do something like this:
library(fable)
library(dplyr)
library(tidyr)
mbl = tsibbledata::ansett %>%
tsibble::fill_gaps() %>%
model(arima1 = ARIMA(Passengers ~ fourier(K = 1) + PDQ(0,0,0)),
arima2 = ARIMA(Passengers ~ fourier(K = 2) + PDQ(0,0,0)),
arima3 = ARIMA(Passengers ~ fourier(K = 3) + PDQ(0,0,0)))
metrics = mbl %>%
glance()
mbl_best = metrics %>%
select(Airports, Class, .model, AICc) %>%
group_by(Airports, Class) %>%
slice(which.min(AICc)) %>%
left_join(mbl %>%
gather('.model', 'model', -Airports, -Class),
by = c('.model', 'Airports', 'Class')) %>%
as_mable(key = c('Airports', 'Class'), models = 'model')
It would be more convenient for K to be automatically determined through something like this:
model(arima = ARIMA(Passengers ~ Fourier(K = 1:3) + PDQ(0,0,0)
On that note, when I look at the source code for ARIMA it appears that when fitting a regression + ARIMA the number of differences is determined after the regression. Because of this, it seems entirely possible that the arima1, arima2 and arima3 models I fit could potentially have a different number of differencing. If this is indeed the case perhaps determining K through cross validation is better?
Thanks!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The payload names no files or tests; begin at the ARIMA entry point and existing fourier(K = ...) handling. Resolve whether automatic K selection should use information criteria or cross-validation and how differencing interacts with it, then verify the agreed behavior using the ansett example.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- data
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100