I have come across slightly strange and inconsistent behaviour in
gretl. It is generated by the following script commands for a
dataset that has been declared as a panel
series panel_unit=$unit
genr unitdum
list dlist = du_*
matrix dunit={dlist}
matrix pnumb=sumc(dunit)
print pnumb
matrix dnumb=dunit*transp(pnumb)
matrix dnper=sumr(dnumb)
print dnper
When I run this as a script it fails at the "matrix dunit={dlist}"
because all of the dummy variables are missing or rather "NA" even
though panel_unit has created correctly. However, when I use the
Add/Unit dummies dialogue the dummy variables are valid with 1's and
0's in the correct places. Am I doing something wrong or is there a bug?
This script is a rather cumbersome way of trying to get round the
apparent lack of certain functions that would be very useful for
handling panel data. These are:
A. $period - give access to the period indicators within each panel
unit, similar to $unit.
B. pnumb(x) - returns a series contining the numbers of non-missing
values for the series x for each panel unit (similar to pmean).
C. pmax(x) - returns a series containing the maximum values of
series x for each panel unit.
D. pmin(x) - returns a series containing the minimum value of series
x for each panel unit.
As my example shows, it is possible to write external functions to
perform the same tasks, but built-in functions would be much more efficient.
Gordon
Show replies by date