MATLAB Answers

WRONG FUNCTION? - Partial Autocorrelation (PACF) - parcorr greater than 1 (>1)

44 views (last 30 days)
Bruno
Bruno on 20 Mar 2014
Answered: Rick on 21 Mar 2014
How can it be ...? I have a time series named Y, 32 observations, and computing
parcorr(Y)
I get some results greater than 1 ...?!?

  3 Comments

Bruno
Bruno on 20 Mar 2014
Re-calculating PACF in R I get different results (all < 1).
It seems that in Matlab parcorr returns wrong results!! Is this a bug??
Bruno
Bruno on 20 Mar 2014
This is my vector "Y":
Y = [5318652; 5067267; 6744906; 7398702; 5815659; 5520288; 7267752; 8152524; 6287778; 5798178; 7183035; 7841988; 5857731; 5244168; 7002093; 7778247; 6128292; 5398098; 6938373; 8100198; 6170235; 5598933; 8105205; 10511214; 7538601; 5689581; 8393967; 9536847; 6944970; 6059637; 8574045; 9802566]
Bruno
Bruno on 20 Mar 2014
Now:
[pacf,lags,bounds] = parcorr(Y)
Returns the following:
1
0,280562863224170
-0,664013471069800
0,910393001736870
0,116374829157432
-0,378677440712066
0,119341557951692
0,156167804527784
0,342152651434175
-0,404514380028935
-0,337126280056480
0,610333157926588
1,31413849637639
-0,154895329306712
2,52580778763616
3,30024056746381
4,60891095078434
0
0
0
0

Sign in to comment.

Answers (2)

Rick
Rick on 20 Mar 2014
Bruno,
My initial reaction is that this not a bug, but rather a result of different algorithms used to compute the PACF. For reference, we compute the PACF by fitting successive order AR models by OLS, retaining the last coefficient of each regression. This is, I suspect, an approximation, but should be a good one for reasonable sample sizes.
The exact approach we use is taken from a very standard reference:
Hamilton, J.D., “Time Series Analysis”, 1994.
In particular, see page 111, which discusses exactly what we doing.
Given the way we compute the PACF, and the fact that your data is short (only 32 observations), and highly cyclical, I suspect that values greater than 1 are possible. Moreover, with only 32 points, the PACF values at larger lags have very little data left that can used to estimate the PACF at these higher lags, which are those associated with greater-than-one values, and are therefore somewhat meaningless anyhow.
If you'd like to send along the R estimates (preferably to several decimal places so we can compare them), then feel free to do so and I'll investigate a little further as we'd like to understand why we differ from R, and make improvements if possible.
That said, I suspect this is due to the estimation algorithm used, and the fact that the data is cyclical and not particularly well-suited to this type of analysis (the PACF is best used to help determine the number of AR lags in a stationary/invertible ARMA model).
Best, -Rick

  2 Comments

Bruno
Bruno on 20 Mar 2014
Hello,
thanks for your reply.
You can find output and code of R here:
Furthermore the results in R are consistent with the calculation method explained here:
In Matlab results seem to be wrong, at least in my case (I tried also other samples)!
Please let me know, thanks.
Bruno
Bruno on 20 Mar 2014
Sorry, the results in R are compliant with the calculation method explained up to the II lag ...

Sign in to comment.


Rick
Rick on 21 Mar 2014
Hi Bruno,
Thanks for sending along the links. It appears as if the R implementation computes the PACF by iteratively solving the Yule-Walker equations, which is perfectly valid. That said, it's not the only way to do it. As I mentioned, PARCORR computes the PACF by fitting successive order AR models by OLS, retaining the last coefficient of each regression, which is also perfectly valid, yet different.
Moreover, if I paste your 32-point dataset into the linked website, I can certainly see that R and MATLAB results differ, but I do think that the results are just that, "different", and I suspect neither is "wrong" give the method of calculation.
Also, recall that the Yule-Walker equations are based on the assumption of a stationary/invertible model, and your data clearly does not satisfy that assumption.
As I mentioned previously, I suspect that for data well-described by a stationary/invertible model the results should be very close asymptotically. To test this, I tried a 1000-pont random series, and got virtually identical results in MATLAB and R. And for small samples sizes I would expect the results to differ bit as well, even for well-behaved data.
Therefore, again this does not seem to be a bug, and the MATLAB results are not wrong, yet they are different.
As an additional reference please see Box, Jenkins, and Reinsel (1994), bottom of page 67.
Although they generally illustrate the calculation of PACF by solving the Yule-Walker equations they also say that "The partial autocorrelations may be estimated by fitting successive autoregressive models of orders 1, 2, 3, ... by least squares and picking out the estimates phi11, phi22, phi33, ... of the last coefficient fitted at each stage".
This is exactly what the MATLAB function PARCORR does.
Moreover, please notice that this Box & Jenkins section is in the chapter entitled "Linear Stationary Models."
I'll look into this a bit more and discuss it with the Econometrics Team to see if we can enhance PARCORR to use the Yule-Walker equations as an alternative, and if we find a bug we'll fix it. That said, this certainly does not seem to be a bug at the moment.
Regards, -Rick

  0 Comments

Sign in to comment.


Translated by