model.select: SARIMA model selection procedure

Description Usage Arguments Value Author(s) Examples

View source: R/analysis.R

Description

Take data and candidate parameters and run grid search. For efficiency, it computes in parallel with heuristics on CPU load balancing. For SARIMA model fitting, it uses Arima from forecast. Sometimes, the fitting results in error for specific parameter combination (e.g. failiure in stationarity). In such case, it just ignores such combination. If plot is TRUE, it also plots the grid search result.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
model.select(
  data,
  p,
  d,
  q,
  P,
  D,
  Q,
  period,
  ...,
  criterion = c("aic", "aicc", "bic"),
  plot = TRUE,
  verbose = TRUE,
  log = TRUE
)

Arguments

data

Time series data for grid search. The data should be either ts object or numeric vector.

p

Candidates for AR order.

d

Candidates for degree of differencing.

q

Candidates for MA order.

P

Candidates for seasonal AR order.

D

Candidates for seasonal degree of differencing.

Q

Candidates for seasonal MA order.

period

Candidates for seasonal term period. Note that long period needs quite long computation time.

...

Extra arguments for SARIMA fitting. Refer to Arima.

criterion

Model selection criterion. Should be one of "aic", "aicc", and "bic".

plot

If TRUE, the obtained values of criterion for each candidiate model will be plotted. Otherwise, not. (default = TRUE)

verbose

If TRUE, it prints out messages indicating the internal progress. Otherwise, not. Since model selection procedure can take a long time, we highly recommend to keep it TRUE. (default = TRUE)

Value

A list containing the following elements:

min Achieved minimum of the criterion.
select Selected model(Arima object).
tune Data frame holding the grid search result. Ordered by the criterion values.
models List of all models fitted. Ordered by the criterion values.
plot ggplot object of the plot. (Returned only if plot is TRUE.)

Author(s)

Sanghyun Park, Daun Jeong, and Sehun Kim

Examples

1
2
3
4
5
6
7
8
# 228 is the station code for SNU
data <- get.subway(228)

# Model selection
# It would take some time
model.select(data$total, p = 1:3, d = 1:3, q = 1:3,
             P = 1:3, D = 1:3, Q = 1:3, period = c(1, 7),
             criterion = "aic")

eik4862/Subway documentation built on Sept. 24, 2021, 3:39 a.m.