[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
st: RE: RE: lagging variables in 3-dim unbalanced panel w/ gaps
> I am trying to find a way to lag variables in a 3 dimensional panel
> dataset. I have 25 countries each with unique election dates from
> 1945-98 (day-month-year in stata format) and each with political
> parties. On average, each party has gone thru 15 elections, and I want
> to use a party's score from the last election to predict something about
> the way it behaves in the current election.
> The problem seems to be that the election dates are unique to each
> country and have gaps within them (i.e., US presidential elections occur
> every four years). When I try to use the L1 command after tsset-ing the
> data ("tsset pty edate"), Stata creates a variable with 0 observations.
> I have been doing the lagging manually, but that is cumbersome and
> error-prone. Is there some way to get Stata(v7) to lag the variables?
It sounds as if there is an easy solution to part of this:
If you create a variable from 1 up
bysort pty (edate): gen eorder = _n
You can then
tsset pty eorder
In other words, the natural metric is election number, not years.
Are you intending that each party can be modelled
as a separate time series, without reference to
other parties in the same election?
* For searches and help try: