alexios ghalanos alexios at 4dscape.com
Wed Sep 19 00:40:39 CEST 2012

```Jaimie,

In my experience, the ARCH-LM test is pretty solid for detecting ARCH
effects in reasonably sized datasets. If you are feeling up to doing
some reading (see the rugarch vignette), a class of misspecification
tests can also be used. They test the i.i.d. assumption of the
standardized data i.e. how well the model has captured the conditional
moments present in the dataset (this are ex-post tests on the full
density while the ARCH-LM is an ex-ante test on the conditional
variance). Here's an example:

library(rugarch)
data(dji30ret)
# 'Fit' an unconditional distribution to the dataset ignoring
# any dynamics (or just take the mean and variance for the normal):

fit1= rugarch::fitdist(distribution = "norm",x = dji30ret[,1])
# Convert to Uniform by the cdf transformation (Probability Integral
# Transformation) which is used by the HLTest function:

PIT1 = pnorm(dji30ret[,1]-fit1\$pars[1])/fit1\$pars[2])

# Fit a GARCH model to take into account ARCH effects
fit2 = ugarchfit(ugarchspec(), dji30ret[,1])
# get PIT:
PIT2 = pnorm(fit2 at fit\$z)

# Hong-Li non parametric density test:

HLTest(PIT1, lags = 4, conf.level = 0.9 )
HLTest(PIT2, lags = 4, conf.level = 0.9 )

# Observe that the individual moment statistics are rejected for the
# unconditional model. While the joint statistic is rejected in both
# cases, the value of the statistic is much closer to the acceptance
# region in the GARCH case.

# GMM orthogonality test:

GMMTest((dji30ret[,1]-fit1\$pars[1])/fit1\$pars[2], kurt = 3)
GMMTest(fit2 at fit\$z, kurt = 3)

The help pages on these tests list the published papers which they are
based on, and the vignette briefly describes them.

Regards,

Alexios

On 18/09/2012 16:52, Patrick Burns wrote:
> Jaime,
>
> I'm not a big fan of testing, especially
> this form of testing.  My prior is that all
> market data experience volatility clustering.
>
> The question is more whether the heteroscedasticity
> has an affect on what you are trying to do with
> the results of your model.
>
> believe a Ljung-Box test on squared residuals
> no matter what the p-value.  The reason is because
> the Ljung-Box test (which is really robust) is
> not robust enough when used on the squares of a
> long-tailed distribution.  The outliers can mess
> with the p-value as they wish.
>
> You can trust Ljung-Box tests on the ranks of
> squared residuals.
>
> I don't know enough about other tests of autocorrelation
> to comment.  But if they don't agree with a rank Ljung-Box
> test, then I'd be suspicious.
>
> Pat
>
>
> On 18/09/2012 12:52, jaimie villanueva wrote:
>>
>> OK Patrick, Thanks.
>>
>> I'm not sure if I've understood this sentence:
>>
>> ".If you are used to looking at p-values from goodness of fit tests, you
>> might notice something strange.  The p-values are suspiciously close to
>> 1.  The tests are saying that we have overfit 1547 observations with 4
>> parameters.  That is 1547 really noisy observations.  I don’t think so.
>> A better explanation is that the test is not robust to this extreme
>> data, even though the test is very robust.  It is probably
>> counter-productive to test the squared residuals.  An informative test
>> is on the ranks of the squared standardized residuals."
>>
>> it is exactly what is happening to me. p-values close to 1.
>>
>> What does the sentence mean:
>>
>> - Whenever Ljung -Box  p-values close to 1 , never belive it.? or
>> - Should I run other type of autocorrelation test?
>>
>> best
>>
>> Jaimie
>>
>> 2012/9/18 Patrick Burns <patrick at burns-stat.com
>> <mailto:patrick at burns-stat.com>>
>>
>>     You should *not* believe the Ljung-Box
>>     test.  For an explanation of why, see:
>>
>>
>> http://www.portfolioprobe.com/__2012/07/06/a-practical-__introduction-to-garch-__modeling/
>>
>>
>> <http://www.portfolioprobe.com/2012/07/06/a-practical-introduction-to-garch-modeling/>
>>
>>
>>     Pat
>>
>>
>>
>>     On 18/09/2012 11:55, jaimie villanueva wrote:
>>
>>         Hi R users,
>>
>>         I'm trying to fit an ARMA or GARCH or ARMA/GARCH model over a
>>         financial
>>         time series of daily Log returns.
>>         I've followed the same procedure as most texts are recommending
>>         in order to
>>         check whether an autocorrelation structure exist (either on
>>         residuals or
>>         squared residuals) or not. After run the Ljung-Box and LM ARCH
>>         test over
>>         squared residuals and I realise that NO autocorrelation
>>         structure exist, I
>>         supposed that, if i try to fit a GARCH model the fitting results
>>         would be
>>         quite useless.
>>
>>         Instead of that, I've found that the fitting was pretty good.
>>
>>         The question is: Should I go ahead with the GARCH model or
>>         Should i belive
>>         the Ljung-Box and LM ARCH test ?.
>>
>>
>>         Jaimie
>>
>>                  [[alternative HTML version deleted]]
>>
>>         _________________________________________________
>>         R-SIG-Finance at r-project.org <mailto:R-SIG-Finance at r-project.org>
>>         mailing list
>>         https://stat.ethz.ch/mailman/__listinfo/r-sig-finance
>>         <https://stat.ethz.ch/mailman/listinfo/r-sig-finance>
>>         -- Subscriber-posting only. If you want to post, subscribe first.
>>         -- Also note that this is not the r-help list where general R
>>         questions should go.
>>
>>
>>     --
>>     Patrick Burns
>>     patrick at burns-stat.com <mailto:patrick at burns-stat.com>
>>     http://www.burns-stat.com
>>     http://www.portfolioprobe.com/__blog
>>     <http://www.portfolioprobe.com/blog>