adequacy.test: Model adequacy check procedure

Description Usage Arguments Value Author(s) Examples

View source: R/analysis.R

Description

Take fitted ARIMA model and perform adequacy checks. It runs Ljung-Box test with residuals for various lags and print out the test result to the console. If plot is TRUE, it also plots the test result.

Usage

1
2
3
4
5
6
adequacy.test(
  fit,
  alpha = 0.05,
  lag.max = min(30, length(fit$residuals) - 1),
  plot = TRUE
)

Arguments

fit

Fitted ARIMA model(ARIMA object).

alpha

The probability of type 1 error for normality tests. (default = 0.05)

lag.max

Maximum length of lag to be tested. (default = min(30, length(fit$residuals) - 1))

plot

If TRUE, the test result will be presented as a plot. Otherwise, not. (default = TRUE)

Value

A list containing the following elements:

ljung.box A list of all test results(htest objects).
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
9
# 228 is the station code for SNU
data <- get.subway(228)

# Fit SARIMA model with total on and off passenger counts
SNU.total <- ts(data$total, frequency = 7)
SNU.fit <- auto.arima(SNU.total)

# Normality check
adequacy.test(SNU.fit)

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