Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: PAC and seasonal differencing

From   Bernhard Hansen <>
To   "''" <>
Subject   st: RE: PAC and seasonal differencing
Date   Mon, 23 Feb 2004 12:07:02 +0100

Thank you very much for a clear answer

Bernhard Hansen

Earlier today Berhard Hansen ( asked:

> I have recently been working with STATA's time series options. The manual
> seems to indicate that a variable can be seasonally differenced in STATA,
> however I can't find the syntax. The first difference is simple enough 
> e.g.:   "generate newvariable = D.oldvariable", but what is the code if
> wants to difference e.g. with respect to the 12th period?

> I have also noticed that when STATA calculates a partial autocorrelation
> function for a series the results differ from the results generated by
> for the same series. Can anyone explain that?

To create a seasonal difference with a 12-period lag, one can do

   . generate seasdiff = oldvariable - L12.oldvariable

The key is the notation L12.oldvariable, which returns the value
from 12 periods ago.

Regarding how the partial autocorrelation function is calculated,
Stata uses a linear regression technique.  Suppose we want the PAC 
at lag v for variable x.  Then we run an OLS regression of x on lags
1 through v of x, and the PAC for lag v is the coefficient on the 
v-th lag of x.  This method is also mentioned in James Hamilton's
textbook (1993, "Time Series Analysis").

I do not know how SPSS calculates PAC's, but I do know that there are
several different ways to do it.  McCullough (1998, Journal of Economic
and Social Measurement) discussed several different methods, including
least squares methods and a method based on the Yule-Walker equations.
His results suggest that least squares works better than the
Yule-Walker-based method.

Hope this helps.

   -- Brian

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index