Performs a grid search over combinations of yearly and monthly Fourier
(trigonometric) regressors and selects the number of terms that minimizes
AIC, AICc, or BIC. Candidate models are fitted by OLS to a detrended series,
where the trend is estimated using supsmu. Optional
holiday/trading-day regressors (H) and additive-outlier regressors
(AO) are included in every candidate specification if provided.
find_opt(
x,
dates,
H = NULL,
AO = NULL,
method = "additive",
l.max = 12,
k.max = 42,
by = 6
)List with the optimal number of (yearly and monthly) fourier variables according to AIC, AICc and BIC.
Numeric vector containing the observed weekly time series.
A vector of class "Date" corresponding to the observation dates.
Optional matrix of holiday and trading-day regressors with
nrow(H) = length(x).
Optional matrix of additive-outlier regressors with
nrow(AO) = length(x).
Character string specifying the decomposition type. Either
"additive" or "multiplicative". If "multiplicative",
the series is log-transformed prior to detrending. Defaults to "additive".
Integer. Maximum number of monthly-cycle Fourier harmonics to consider.
Defaults to 12.
Integer. Maximum number of yearly-cycle Fourier harmonics to consider.
Defaults to 42.
Integer. Step size for the grid search over k and l.
Defaults to 6.
data(gasoline.data)
res=find_opt(x=gasoline.data$y,dates=gasoline.data$date)
print(res)
Run the code above in your browser using DataLab