Page 1 of 1

Differencing in Panel Data

Posted: Fri Jul 10, 2015 10:15 am
by diggetybo
Hey everyone,

I have a quick question on differencing in the case of two-period panel data. I can't seem to match my textbooks answer of the following simple regression (of crime rate and unemployment):

d_crmrte = 15.40 + 2.22d_unem

I know in time series, I can simply difference by the syntax: d(xj)

But in this workfile I get the wrong results using that kind of syntax. How would we go about panel differencing?

Re: Differencing in Panel Data

Posted: Fri Jul 10, 2015 11:58 am
by startz
You need to restructure your workfile into a panel.

Re: Differencing in Panel Data

Posted: Tue Jul 21, 2015 5:34 am
by diggetybo
I tried forum search and related web queries throughout the week, couldn't find anything about reformatting unstructured data to panel data. It's probably too simple for much of the reading audience here. I, on the other hand, can't quite figure it out.

It seems rather arduous, when I set the workfile structure type to panel, it asks for cross section id and date id. In the above workfile, the date id is easy enough. It is "year". However there are over 20 explanatory series used. Is there an easy, more elegant solution that I am not aware of?

Please elaborate

Thank you

Re: Differencing in Panel Data

Posted: Tue Jul 21, 2015 6:13 am
by startz
You need to have a variable which identifies the cross section, like "state" or "country" or something.

Re: Differencing in Panel Data

Posted: Tue Jul 21, 2015 7:02 am
by diggetybo
Thanks startz, one follow up question though,

As an alternative solution, assuming I was forced to work with the current workfile structure, and wanted to perform a difference of the change over the years 82 and 87 (as seen in the "year" series in the workfile) for my regressors, rather than the current difference operation which is xt+1-xt, is there a way to denote this during my equation estimation?

Thank you very much

Re: Differencing in Panel Data

Posted: Tue Jul 21, 2015 7:22 am
by startz
Try the @elem function to identify the years you want.

Re: Differencing in Panel Data

Posted: Tue Jul 21, 2015 7:47 am
by diggetybo
Oh yes! That's working well. Now I can tweak it as needed, thanks again.