MathType

Monday 13 June 2016

Correlogram and Partial Correlogram with Stata (Time Series)





Beside the formal unit root test ( ADf test and PP test), the correlogram (or autocorrelation)  and partial correlogram (or partial autocorrelation) also can be used as graphical analysis to test whether our time series data are stationary or non-stationary.


The correlogram is useful when we deal with the ARIMA model.


The autocorrelation function (ACF) at lag k, denote by pk is defined as












Since both cov and variance mesured in the same units of measurement, pk is a unit unitless or pure number. It lies between -1 and +1, as any correlation coefficient does.



If we plot pk against k, the graph we obtain is known as the population correlogram.



In practice, we only have a realization (i.e. sample) of a stochastic process, we only computed sample autocorrelation function (SAFC);








 

A plot is known as the sample correlogram or ACF

The partial autocorrelation function (PACF) is analogous to concept of partial regression coefficient

In the k-variable multiple regression model, the k-th regression coefficient Bk measures the rate of change in the mean value of the regressand for a unit change in the  kth regressor xk, holding the influence of all other regressor constant.

In similar, the partial autocorrelation  pkk measure correlation between (time series) obs that are k time period apart after controlling for correlations at intermediate lags (i.e lags less that k ).


In other words, PACF is the correlation between  yt and yt-1 after removing the effect of the intermediate y's .


We have time series data on ppi (producer price index) and the data are quarterly from 1960 to 2002.

Plot the data ppi against t;


twoway (tsline ppi)



 





Plot the data differenced in ppi against t;



twoway (tsline D.ppi)


 



Original  variable does not look stationary.


Differenced variable looks stationary (although the variance increases).


To detect autocorrelation, which is the correlation between a variable  and its previous values, we use the command corrgram.

  
The number of lags depends on theory, AIC/BIC process, or experience. 

To produce the correlogram for ppi variable;


 corrgram ppi, lags (12)



 



AC shows that the correlation between the current value of ppi and its value three quarters ago is 0.9656. AC can be use to define the q in MA(q) only in stationary series

PAC shows that the correlation between the current value of ppi and its value three quarters ago is -0.0692 without the effect of two previous lags . PAC can be use to define the p in AR(p) only in stationary series

Box-Pierce Q statistics test the null hypothesis that all correlation up to lags k are equal to 0. The series ppi show significant autocorrelation as shown in in Prob>Q value which at any k are less than 0.05, therefor rejecting the null that all lags are not autocorrelated

Graphic view of AC which shows a slow decay in the trend, suggesting  non-stationary.

Graphic view of PAC which after the lags 2 are statistically insignificant


The correlogram for AC shows that a slow decay in the trend. 

The autocorrelation coefficients at various lags are very high even at lag of 12 quarters. 

This trend for the correlogram is the typical correlogram of nonstationary time series which means that our variable ppi in level form is nonstationary.

Stata also can produce the correlogram for AC and PAC more detail using the command ac and pac.

AC correlogram for ppi;


    ac ppi



 



PAC correlogram ppi;


pac ppi

 




Now, lets we see the correlogram for ppi in first difference form;


corrgram D.ppi, lags(12)


 



AC correlogram for D.ppi;


ac D.ppi







The correlogram for AC shows decays exponentially and only some spikes are significant.

The pattern of AC suggest that the variable ppi in first difference form is now stationary



























No comments:

Post a Comment