normal.test: Normality check procedure for residuals

Description Usage Arguments Value Author(s) Examples

View source: R/analysis.R

Description

Take fitted ARIMA model and perform normality checks. It runs three well-known normality test, Shapiro-Wilk test, Jarque-Bera test, and Kolmogorov-Smirnov test and prints out the result to the console. If plot is TRUE, it also plots Q-Q plot of residuals and estimated density of residual for visual check.

Usage

1
normal.test(fit, alpha = 0.05, plot = TRUE)

Arguments

fit

Fitted ARIMA model(ARIMA object).

alpha

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

plot

If TRUE, the Q-Q plot of residuals and estimated density of residuals will be presented. Otherwise, not. (default = TRUE)

Value

A list containing the following elements:

shapiro.wilk The test result of Shapiro-Wilk test(htest objects).
jarque.bera The test result of Jarque-Bera test(htest objects).
komogorov.smirnov The test result of Kolmogorov-Smirnov test(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
normal.test(SNU.fit)

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