| Contents | Index |
[h,pValue,stat,cValue]
= lbqtest(res)
[h,pValue,stat,cValue]
= lbqtest(res,Name,Value)
[h,pValue,stat,cValue] = lbqtest(res) and [h,pValue,stat,cValue] = lbqtest(res,Name,Value) perform the Ljung-Box lack-of-fit hypothesis test for model misspecification.
The "portmanteau" test of Ljung and Box assesses the null hypothesis that a series of residuals exhibits no autocorrelation for a fixed number of lags L, against the alternative that some autocorrelation coefficient ρ(k), k = 1, ..., L, is nonzero. The test statistic is
![]()
where T is the sample size, L is the number of autocorrelation lags, and ρ(k) is the sample autocorrelation at lag k. Under the null, the asymptotic distribution of Q is chi-square with L degrees of freedom.
Specify optional comma-separated pairs of Name,Value arguments, where Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.
Test exchange rates for autocorrelation, ARCH effects:
load Data_MarkPound returns = price2ret(Data); residuals = returns-mean(returns); h1 = lbqtest(residuals) h2 = lbqtest(residuals.^2)
The input lags affects the power of the test. If L is too small, the test will not detect high-order autocorrelations; if it is too large, the test will lose power when significant correlation at one lag is washed out by insignificant correlations at other lags. The default value of min[20,T-1] is suggested by Box, Jenkins, and Reinsel [1]. Tsay [4] cites simulation evidence that a value approximating log(T) provides better power performance.
When res is obtained by fitting a model to data, the degrees of freedom are reduced by the number of estimated coefficients, excluding constants. For example, if res is obtained by fitting an ARMA(p,q) model, dof should be L−p−q.
lbqtest does not test directly for serial dependencies other than autocorrelation, but it can be used to identify conditional heteroscedasticity (ARCH effects) by testing squared residuals. See, e.g., McLeod and Li [3]. Engle's test, implemented by archtest, tests for ARCH effects directly.
[1] Box, G.E.P., G.M. Jenkins, and G.C. Reinsel. Time Series Analysis: Forecasting and Control. 3rd ed. Upper Saddle River, NJ: Prentice-Hall, 1994.
[2] Gourieroux, C. ARCH Models and Financial Applications. New York: Springer-Verlag, 1997.
[3] McLeod, A.I. and W.K. Li. "Diagnostic Checking ARMA Time Series Models Using Squared-Residual Autocorrelations." Journal of Time Series Analysis. Vol. 4, 1983, pp. 269–273.
[4] Tsay,R.S. Analysis of Financial Time Series. Hoboken, NJ: John Wiley & Sons, Inc., 2005.
View demos and recorded presentations led by industry experts.
Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |