Users of panel data have a number of panel unit root tests written by
Stata users at their disposal, but often find it highly annoying that
the official unit-root test commands such as dfuller, pperron, and now
dfgls refuse to work with panel data, even if only a single timeseries
within that panel is specified. Of course, one could reshape the data
to wide format, or preserve/drop if unit ~=`i'/test/restore, but those
workarounds seem unnecessarily complicated. Why can't these commands
work with panel data, at least to massage a single timeseries within
the panel? With one line of code altered, they can.
ssc install panelunit
provides panel-capable versions of dfgls, dfuller, and pperron named
dfgls2, dfuller2, pperron2, respectively. In a panel context, they must
be invoked with an 'if' or 'in' qualifier to ensure that a single panel
is presented to the routine. That can, of course, be automated to work
with all units in a panel (as could be the accumulation of results
returned by the routine):
webuse grunfeld, clear
forvalues i=1/10 {
di _n "company `i'"
dfgls2 invest if company==`i'
}
Other than this feature, they work identically to their official
relatives, and thus the help-files are those of the official routines.
Dialog files are provided.