Thank you very much for a clear answer
Bernhard Hansen
Earlier today Berhard Hansen (berh@dda.dk) 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
one
> 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
SPSS
> 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
-- bpoi@stata.com
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/