This statistic measures whether a set of autocorrelations is significantly different from a set of autocorrelations that are all zero. The formula for calculating the Ljung-Box statistic:
Q’ is the Ljung-Box statistic; the probability that the set of autocorrelations is the same as a set of autocorrelations which are all 0.
n is the amount of data in the data sample.
h is the size of the set of autocorrelations used to calculate the statistic.
rk is the autocorrelation with a lag of k.
The size of the set of autocorrelations is equal to one-third the size of the data sample (or 100, if the sample is greater than 300).