Li McLeod autocorrelation test
res = li_mcleod(namey,p,arg1,...,argn)
* namey = a time series, a real (nx1) vector or a string equal to the name of a time series or a (nx1) real vector between quotes
* p = a scalar, the # of autocorrelations considered
* argi = arguments which can be:
- 'noplt' if the user does not want to plot the autocorrelations
- 'noprint' if the user does not want to print the results of the test
- 'meth=Box-Pierce' if the user wants to use the Box-Pierce formula instead of the Li Mcleod one
- 'size=x' if the user wants to choose the size of the autocorrelation confidence band (defaut = 0.05)
- 'styleg=x' with x between 1 and 7 if the user wants to choose the location of the legend for the graph of autocorrelations (default = 7, that is to the right of the graph)
- 'dropna' if the user wants to remove the NA values from the data
* res = a results tlist with:
- res('meth') = 'Li Mcleod'
- res('y') = values of the input variable (residuals in the case of a tlist)
- res('acf') = autocorrelation coefficients
- res('acf_l') = low bound of the confidence interval
- res('acf_u') = upper bound of the confidence interval
- res('size') = size of the confidence band
- res('chistat') = Li Mcleod (or Box-Pierce) chi-squared
- res('chi_pvalue') = the p-value of the test
- res('chi_df') = the # of degrees of freedom
- res('namey') = name of the variable tested
- res('prests') = a boolean indicating whether the tested variable is a ts
- res('bounds') = the estimation period (if the variable was a ts)
- res('dropna') = boolean indicating if NAs have been droped
- res('nonna') = vector indicating position of non-NAs (if the option 'dropna' was active)
load(GROCERDIR+'/macros/grocer/db/bdhenderic.dat'); bounds() res1=li_mcleod('delts(lm1)',6) // Example taken from function li_mcleod_d. Provides the Li Mcleod test for the variation of the logrithm of M1 // in the UK and 1 to 6 autocorrelations. r=varma_d4(); res2=li_mcleod(r,10) // Also taken from function li_mcleod_d. Provides the Li Mcleod test for the residuals of the arma estimation // provided in demo varma_d4() and 1 to 10 autocorrelations. | ![]() | ![]() |