Hi everyone,
Background:
I estimated ARMA-GARCH(GED) model on single stock returns using EViews (not rugarch). I have:
- Standardized residuals from EViews GARCH(GED) model
- Model coefficients from EViews
- EViews doesn't have Anderson-Darling test
Question:
How to run Anderson-Darling test in R on my EViews GARCH(GED) standardized residuals?
My data:
- xlsx file with standardized residuals (
resid01) exported from EViews - GED shape parameter from EViews output
What I need:
- R code to read EViews residuals + run AD test vs GED distribution
- Correct interpretation for GED standardized residuals
I already tried this AD test code for my EViews GARCH(GED) standardized residuals:
install.packages("readxl")
install.packages("fGarch")
install.packages("goftest")
library(readxl)
library(fGarch)
library(goftest)
data <- read_excel("C:/Users/myusername/Skripsi/1. data/resid01.xlsx")
z <- data$resid01
z <- na.omit(z)
mean(z)
sd(z)
Box.test(z, lag = 20, type = "Ljung-Box")
Box.test(z^2, lag = 20, type = "Ljung-Box")
### ==============================
### ANDERSON-DARLING TEST FOR GED
### ==============================
nu <- 1.127493 # shape
ad.test(z,
null = pged,
mean = 0,
sd = 1,
nu = nu)
### ==============================
### QQ-PLOT GED
### ==============================
n <- length(z)
p <- ppoints(n)
q_theoretical <- qged(p, mean = 0, sd = 1, nu = nu)
z_sorted <- sort(z)
# plot
plot(q_theoretical, z_sorted,
main = "QQ-Plot Standardized Residual vs GED",
xlab = "Theoretical GED Quantiles",
ylab = "Sample Quantiles")
abline(0, 1, col = "red", lwd = 2)
RESULTS from this code: Residuals FOLLOW GED distribution (p > 0.05 + Perfect fit in middle, BUT tails deviate)
My questions:
- Is my
ad.test()code correct for EViews GARCH(GED) residuals? - Why different AD test codes give opposite results? Should I trust my code (accepts GED) or the other codes (reject GED)?
- Why QQ-plot tails deviate despite AD test accepting GED?
- What do tail deviations mean for GARCH(GED) model validity?
- Should I trust AD test or worry about QQ-plot tails?
Please help for my thesis, thank you
