Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: D. Time series operator


From   Michael Hanson <mshanson@mac.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: D. Time series operator
Date   Thu, 13 Nov 2008 20:59:17 -0500

On Nov 13, 2008, at 1:16 PM, Diana Eastman wrote:

I know that D., generates differences of any order. Could someone
explain how to interpret
D(0/1).(dummyvar1 dummyvar2)

Specifically, what does (0/1) do with regards to the differencing?

The context of this is an instrumental variable regression.


Diana:

What you are looking for -- admittedly somewhat tricky to find -- is - help tsvarlist- to explain this syntax. See also <http:// www.stata.com/support/faqs/stat/lags.html>. (You can find both of these resources by typing -findit time series operators- in Stata, although it does take a little digging through the resulting list of items.)

D(0/1).(x y) expands to D(0/1).x D(0/1).y, which in turn expands to D0.x D1.x D0.y D1.y -- that is, the "zeroth" and first differences of the time series variables x and y. (And although you mentioned you understand the D. operator, for the sake of posterity I should note that the "zeroth" difference of a series is just that series: D0.x is simply x. Also, D1.x and D.x are synonymous in Stata.)

Another example of this syntax: L(1/4).z expands to L.z L2.z L3.z L4.z . All told, D(0/1).(x y) is just a convenient shorthand for specifying several time series operations on several variables all at once. This syntax saves time and typing with VARs, ADL models, etc. -- as well as long lists of lagged instruments for IV or GMM estimation.

More generally, the "/" between two numbers is used in Stata notation to denote a sequence of integers. For example, consider the syntax:

	forvalues i = 1/4 {
		generate L`i'_z = L`i'.z
	}

Here, `i' takes on the values 1, 2, 3, 4 in turn. This code snippet creates four new time series variables: L1_z through L4_z, which equal the first through fourth lags of the variable z. (One might want to do this to use lagged series with Stata commands that do not accept the lag operator notation.)


Hope that helps,
Mike

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



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