A possible bug and a request
by Gordon Hughes
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
16 years, 8 months
Re: Functions for stochastic frontier analysis
by Gordon Hughes
I will leave the DEA analysis to someone else. Personally, I have
never dealt with a dataset for which DEA provided a plausible set of
results, let alone improved on what ones gets from SFA. Normally,
the set of comparators turns out to be empty or too small to be useful.
I will modify the packages to include the description strings and
then re-load them to the server.
Finally, I have been thinking about the panel data SFA. I will start
with the time invariant version which is little more than a set of
restrictions on the conventional model - e.g. u[i,t] = u[i] for all
t. That should mean that it is possible to produce equivalent
versions for all of my cross section models once I understand how
panel data can be manipulated conveniently.
There is one approach that would facilitate the implementation of
estimator. The log-likelihood function has the form
sum over cross section units { sum over time periods [ ... ] }
Thus, it would be easiest to write the log-likelihood and its
derivatives in this structure. However, if I understand the logic of
mle correctly, then every observation is treated identically so that
what mle hands to the maximiser is the contribution of that
observation to the log-likelihood and its gradients. If correct, the
problem is manageable but less efficient than if one could take
advantage of the structure of the log-likelihood to avoid repetition
of various calculations.
Gordon Hughes
16 years, 8 months