find_opt function

Find optimal number of fourier variables

Find optimal number of fourier variables

Searches through the model space to identify the best number of trigonometric variables, with the lowest AIC, AICc or BIC value.

find_opt( x, dates, H = NULL, AO = NULL, method = "additive", l.max = 12, k.max = 42, by = 6 )

Arguments

  • x: Numeric vector. Time series to seasonally adjust
  • dates: a vector of class "Date", containing the data dates
  • H: (optional) Matrix with holiday and trading day variables
  • AO: (optional) Matrix with additive outlier variables
  • method: Decomposition method: "additive" or "multiplicative". By default uses the additive method
  • l.max: Maximal number of the monthly cycle variables to search for. By default is 12
  • k.max: Maximal number of the yearly cycle variables to search for. By default is 42
  • by: Step size in the search. By default is 6.

Returns

list with the optimal number of (yearly and monthly) fourier variables according to AIC, AICc and BIC

Examples

data(gasoline.data) res=find_opt(x=gasoline.data$y,dates=gasoline.data$date) print(res)
  • Maintainer: Tim Ginker
  • License: MIT + file LICENSE
  • Last published: 2025-02-05