To fit a simple AR(5) model, I use SAS PROC AUTOREG. I called the option ARCHTEST=(QLM) which provides Engle’s Lagrange Multiplier Test for ARCH Disturbances and the Portmanteau Q Test. The statistics SAS provided for Engle’s Lagrange Multiplier Test were:
Order LM p-value
1 0.018 0.893
2 0.079 0.961
3 0.881 0.830
4 1.088 0.896
5 1.105 0.954
6 4.114 0.661
7 4.179 0.759
8 4.182 0.840
9 4.528 0.873
10 4.528 0.920
11 5.565 0.901
12 6.318 0.899
I took the residuals of this model and used the ArchTest function of the FinTS package of R ... library(FinTS).
# A function to do ArchTest at multiple lags where 'data' are the residuals of
# the model.
library(FinTS)
arch.m1 = matrix(NaN,12,3)
for(i in 1:12) {s = ArchTest(data,lags=i)
arch.m1[i,1] = s$statistic
arch.m1[i,2] = s$parameter
arch.m1[i,3] = s$p.value}
The test results from the ArchTest function of the FinTS package are very different:
Order LM p-value
1 0.014 0.907
2 0.092 0.955
3 0.835 0.841
4 2.194 0.700
5 3.189 0.671
6 13.013 0.043
7 19.157 0.008
8 23.161 0.003
9 18.780 0.027
10 18.467 0.048
11 22.565 0.020
12 23.828 0.021
I thought the SAS ARCHTEST=(QLM) option and the ArchTest function of the FinTS package were performing the same test but apparently not. Does anyone know what the difference is between the tests in SAS and FinTS?
Note, the data used by Tsay (2005) in the example on page 102 is available here.
Using the following R code:
library(FinTS)
intc=read.table("http://faculty.chicagobooth.edu/ruey.tsay/teaching/fts2/m-intc7303.txt", quote="\"")
ArchTest(intc$V2,lags=12)
I find:
$\chi^2$= 48.0425, df = 12, p-value = 3.073e-06
However, Tsay (2005:102) reports:
$\chi^2$= 43.5041, df = 12, p-value = 0.0000
If I use:
ArchTest(log(1+intc$V2),lags=12)
Then:
$\chi^2$= 43.5041, df = 12, p-value = 0.0000
However, this doesn't explain the differences observed between SAS and FinTS.
Thanks for your reply @mpiktas.
The statistic calculated by the FinTS library using the ArchTest function is based on the second statistic provided by @mpiktas:
$$TR^2=T\left(1-\frac{SSR_1}{SSR_0}\right)$$
intc=read.table("http://faculty.chicagobooth.edu/ruey.tsay/teaching/fts2/m-intc7303.txt",quote="\"")
intc.ln=log(1+intc$V2)
lag=12
mat=embed(intc.ln^2,lag+1)
m=summary(lm(mat[,1]~mat[,-1]))
SSR1=sum(residuals(lm(mat[,1]~mat[,-1]))^2)
SSR0=sum(residuals(lm(mat[,1]~1))^2)
stat=length(mat[,1])*(1-(SSR1/SSR0))
which gives $\chi^2$ = 43.5041.
If I apply the first statistic provided by @mpiktas and shown on page 102 of Tsay (2005):
$$F=\frac{(SSR_0-SSR_1)/m}{SSR_1/(T-2m-1)}$$
intc=read.table("http://faculty.chicagobooth.edu/ruey.tsay/teaching/fts2/m-intc7303.txt",quote="\"")
intc.ln=log(1+intc$V2)
lag=12
mat=embed(intc.ln^2,lag+1)
m=summary(lm(mat[,1]~mat[,-1]))
SSR1=sum(residuals(lm(mat[,1]~mat[,-1]))^2)
SSR0=sum(residuals(lm(mat[,1]~1))^2)
stat=((SSR0-SSR1)/lag)/(SSR1/(length(mat[,1])-(2*lag)-1))
This version of the statistic gives $\chi^2$ = 3.837.
These are very different answers? I have provided the residuals for the AR(5) model from SAS below:
c(0.14167,0.14019,-0.42499,0.0222,0.04388,-0.03157,0.00897,
-0.04567,0.29171,-0.06735,0.05235,-0.04062,-0.18694,
-0.2407,0.03766,-0.15011,0.11023,-0.30812,-0.02399,
0.13434,0.05836,0.09368,-0.01832,-0.15669,-0.00127,
0.19431,0.10366,-0.09682,-0.04597,0.07162,0.16411,-0.02181,
-0.00459,-0.16325,-0.09615,-0.04581,0.10441,0.12845,-0.0398,
-0.03349,-0.01575,0.06923,-0.05006,-0.05827,
-0.0317,0.08914,0.07323,0.06519,0.16141,0.0537,0.08213,
0.01073,-0.06628,0.01297,0.00622,-0.10171,0.05598,-0.05615,
0.10322,-0.04991,-0.01223,-0.04975,-0.06043,0.01794,
-0.00071,0.05425,-0.05462,0.01659,0.08656,0.02482,-0.04214,
0.01221)
For lag 5, SAS gives $\chi^2$ = 1.105, FinTS gives $\chi^2$ = 3.189, and the F-statistic version gives $\chi^2$ = 0.560.
References:
Engle, R. F. 1982. Autoregressive conditional heteroscedasticity with estimates of the variance of United Kingdom inflation. Econometrica 50:987-1007.
Tsay, R. S. 2005. Analysis of financial time series. Second edition. John Wiley & Sons, Inc., Hoboken, New Jersey, USA.