boxQ

boxQ(u, h, alpha, f_ver, f_comput, K_lim)

boxQ computes the vector form of the Box Q (also called Ljung-Box or Box-Pierce) statistic. The statistic is modified from its full form by allowing a restriction on the spatial extent of the statistic. Several proposed normalization options are available.

See: Lutkepohl - New Introduction to Multiple Time Series Analysis -

Portmanteau Tests p. 169-171 - eqn. 4.4.23 and 4.4.24

https://en.wikipedia.org/wiki/Ljung%E2%80%93Box_test

INPUTS:

u – matrix (K x T) of residuals. Required. h – integer number of time lags evaluated. Default is 10. alpha – significance level. Default is 0.05. f_ver – integer flag indicating type of normalization used.

1 - Lutkepohl version, T^2/(T-i) (Default) 2 - Ljung-Box version, T*(T+2)/(T-i) o.w. - Box-Pierce version, T.

f_comput – binary flag idication whether to compute the statistic

0 - element-wise via for loops 1 - using matrix operations (Default).

K_lim – integer number limiting the number of spatial bins

across which the correlations are evaluated. Default is K-1.

OUTPUTS:

Q – Q statistic value pVal – chi-square p-value cVal – chi-square critical value Qtest – chi-square test result

Created: Patrick Stokes