2
$\begingroup$

I am analyzing a time series with R version 4.0.4. I have created the ARIMA model for the series and I want to find the distribution of the residuals. Here are the residuals:

residuals <- c(-37583.717, -14253.658, -76085.067, -6305.700, -160826.850,
           100393.749, -105089.547, -108179.481, -55243.708, 162570.953,
           135430.865, -251294.174, 192270.990, -310060.883, -107645.350,
           71062.423, -89140.425, -87112.238, -125336.199, 91926.879,
           649967.685, -92925.131, -16501.053, -93573.476, 1116.598,
           20276.273,  -33654.591)

I created the histogram and calcultated the skewness and kurtosis

hist(residuals)

library(moments)
skewness(residuals) #1.891993
kurtosis(residuals) #8.716795

The histograms, along with the skewness and kurtosis do not suggest that the residuals are normally distributed. However, the results from the Anderson-Darling test suggest that they are in fact normally distributed.

library(goftest)
set.seed(1001)
ad.test(residuals, "pnorm", mean=mean(residuals), sd=sd(residuals), estimated=T)$p.value

The resulting p-value is 0.6197467. Which means that there is not enough evidence to reject the null hypothesis that the residuals are normally distributed.

I am now confused by these conflicting results. What do you think is the distribution? Is the test trustworthy considering that the data consists of only 27 data points?

$\endgroup$
2
  • 2
    $\begingroup$ The ad.test function in package nortest gives $p=0.002547$. I tried out the one from goftest with data generated from a normal plus one outlier, even an extreme one, and it wouldn't reject. The one in nortest does reject, which seems more sensible to me. Something dodgy seemingly going on with the function from goftest, but I can't say what's wrong here. $\endgroup$ Commented Jun 27, 2021 at 13:30
  • 2
    $\begingroup$ Maybe it's worth to write to the package maintainer of goftest. $\endgroup$ Commented Jun 27, 2021 at 13:35

1 Answer 1

3
$\begingroup$

Any GOF test looks for specific deviations from expectations. The A-D test in the goftest package uses a randomized version by Braun; that's not the one used by the nortest package mentioned by @Lewian. That could be why the p-values are different.

However, if you just look at

qqnorm(residuals)

it's pretty obvious that one of the residuals is too large to be plausibly normal, so either the test used in goftest is very weak, or it's not properly implemented. (To get a feeling for what qqnorm() plots should look like, plot qqnorm(rnorm(27)) a bunch of times. You'll almost never see outliers like yours. Even better, do it with residuals from simulated data from your hypothesized ARIMA model.)

So I would conclude you don't have normal residuals. Much harder questions are whether it matters, and if it does, what you can do about it.

$\endgroup$
2
  • $\begingroup$ Can I conclude that in the case that normality tests results on small number of samples are conflicting with the qqplot, skewness, kurtosis, and the histogram, we should put more weight into these statistics rather than the test results? $\endgroup$ Commented Jun 28, 2021 at 3:27
  • $\begingroup$ In this dataset that seems like a reasonable thing to do. $\endgroup$ Commented Jun 28, 2021 at 5:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.