| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Econometrics Toolbox |
| Contents | Index |
| Learn more about Econometrics Toolbox |
[h,pValue,stat,cValue] = lbqtest(Series,Lags,Alpha,DoF)
[h,pValue,stat,cValue] = lbqtest(Series,Lags,Alpha,DoF) performs the Ljung-Box lack-of-fit hypothesis test for model misspecification, which is based on the Q-statistic
![]()
where N = sample
size, L = the
number of autocorrelation lags included in the statistic, and
is the squared sample autocorrelation
at lag k.
Once you fit a univariate model to an observed time series, you can use the Q-statistic as a lack-of-fit test for a departure from randomness. Under the null hypothesis that the model fit is adequate, the test statistic is asymptotically chi-square distributed.
Vector of observations of a univariate time series for which lbqtest computes the sample Q-statistic. The last row of Series contains the most recent observation of the stochastic sequence. Typically, Series is either:
| |
Vector of positive integers indicating the lags of the sample autocorrelation function included in the Q-statistic. If specified, each lag must be less than the length of Series. If Lags = [] or is unspecified, the default is Lags = min([20, length(Series)-1]). | |
Significance levels. Alpha can be a scalar applied to all lags, or a vector the same length as Lags. If Alpha = [] or is unspecified, the default is 0.05. For all elements, α, of Alpha,0 < α < 1. | |
Degrees of freedom. DoF can be a scalar applied to all lags, or a vector the same length as Lags. If specified, all elements of DoF must be positive integers less than the corresponding element of Lags. If DoF = [] or is unspecified, the elements of Lags serve as the default degrees of freedom for the chi-square distribution. |
Boolean decision vector. 0 indicates acceptance of the null hypothesis that the model fit is adequate (no serial correlation at the corresponding element of Lags). 1 indicates rejection of the null hypothesis. h is the same size as Lags. | |
Vector of probability values of the test statistics. | |
Vector of Q-statistics for each lag in Lags. | |
Vector of critical values of the chi-square distribution for comparison with the corresponding element of stat. |
Create a vector of 100 Gaussian random numbers:
strm = RandStream('mt19937ar'); % reproducible
RandStream.setDefaultStream(strm);
Series = randn(100, 1); % 100 Gaussian deviates ~ N(0, 1)Compute the Q-statistic for autocorrelation lags 20 and 25 at the 10 percent significance level:
[h,P,stat,CV] = lbqtest(Series, [20 25]', 0.10);
[h,P,stat,CV]
ans =
0 0.6185 17.5278 28.4120
0 0.4438 25.3342 34.3816[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.
![]() | lagmatrix | lmtest | ![]() |
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-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |