In a panel study you may wish to construct dummy variables of one or both of the following sorts: (a) dummies as unique identifiers for the cross-sectional units, and (b) dummies as unique identifiers for the time periods. The former may be used to allow the intercept of the regression to differ across the units, the latter to allow the intercept to differ across periods.
You can use three special functions to create such dummies. These are found under the "Data, Add variables" menu in the GUI, or under the genr command in script mode or gretlcli.
"periodic dummies" (script command
genr dummy). This command creates a set
of dummy variables identifying the periods. The variable
dummy_1
will have value 1 in each row
corresponding to a period 1 observation, 0 otherwise;
dummy_2
will have value 1 in each row
corresponding to a period 2 observation, 0 otherwise; and so
on.
"unit dummies" (script command
genr unitdum). This command creates a
set of dummy variables identifying the cross-sectional
units. The variable du_1
will have value
1 in each row corresponding to a unit 1 observation, 0
otherwise; du_2
will have value 1 in each
row corresponding to a unit 2 observation, 0 otherwise; and
so on.
"panel dummies" (script command
genr paneldum). This creates both period
and unit dummy variables. The unit dummies are named
du_1
, du_2
and so on,
while the period dummies are named dt_1
,
dt_2
, etc.
If a panel data set has the YEAR of the observation entered as one of the variables you can create a periodic dummy to pick out a particular year, e.g. genr dum = (YEAR=1960). You can also create periodic dummy variables using the modulus operator, %. For instance, to create a dummy with value 1 for the first observation and every thirtieth observation thereafter, 0 otherwise, do
genr index genr dum = ((index-1)%30) = 0