Friday, February 13, 2015

Gretl: Picking between stacked time-series and stacked cross-sectional formats

When you're doing panel data regression in GRETL or any statistical software, you need your data formatted in a way that differentiates the time series dimensions from the cross sectional dimensions, which is more sophisticated and more informative in that matter. In GRETL, you can do this by allowing the software to "flatten" the data being used in two different ways:
  • Stacked cross-sections: the successive vertical blocks each comprise a cross-section for a given period.
  • Stacked time-series: the successive vertical blocks each comprise a time series for a given cross-sectional unit.
 ...but these two get confusing because they both seem to be the same thing, having the same options to set the number of cross-sectional units and time periods, regardless of whether you choose to make it 'stacked cross sections' or 'stacked time series'.
So it made me wonder whats so important about one versus the other, and whether it should matter which one you pick, and based off on the searches I made, it turns out that these options GRETL ultimately end up turning the data into just, stacked time series. A word from Allin Cottrell, one of GRETL's founders, sheds some light on this case. 

Allin Cottrell:
...maybe it's a bit confusing but in fact it is intended. The main point is that a panel dataset _must_ be organized as stacked time series for use in gretl. "Stacked cross sections" is not an option for panel data in gretl, it's just a way of saying that your data are currently the wrong way round and need to be fixed. 
So, if you go to "/Data/Dataset structure" and say that your dataset is stacked cross sections, gretl will reorganize it for you as stacked time series (a "physical" reorganization of the data). Note that if you then go back to the "Dataset structure" dialog your data will initially appear as "Stacked time series", so, naturally, stating that the structure is stacked time series will produce no change. 
If you want to change the actual data layout back to what it was originally, you have to say that it's stacked cross sections (again), and gretl will reorganize the data in the opposite direction.
Perhaps that could be easier for users to understand in later updates.

1 comment: