On Mon, 10 Sep 2018, Sven Schreiber wrote:
Am 10.09.2018 um 02:30 schrieb Allin Cottrell:
>
>
> And I thereby left the business unresolved! Here's an attempt at
> resolution. It turns out that the problem for which stack() provides a
> solution is pretty easily handled by
>
> series -> matrix -> reshape matrix -> series
>
> ...
>
> So here's a suggestion: in section 4.5 of the Guide I delete the discussion
> of the fix using the mysterious stack() in favour of an example and
> explanation of the method illustrated above.
>
> Should I do that? If so, stack would then be undocumented, but we could
> keep it for the time being for backward compatibility.
Thanks for the suggestion. What I like about it is to clean up the gretl
syntax and remove that "oddball", as you called it. However, replacing a
built-in command/function/whatever by a description of a relatively more
advanced scripting solution is not optimal IMO.
First I thought the functionality of stack() (and of your solution) could be
merged into the 'dataset' or the 'setobs' command -- but actually the
description in the guide ch.4 and the whole business of stack() is to read in
data from external files. So wouldn't 'join' be a natural candidate for this
stuff?
So from a user's point of view the first stack() example in section 4.5 would
become something like this:
join panel.txt x1 --panelstack --length=50
join panel.txt x2 --panelstack --length=50 --offset=50
(Perhaps a --no-header option might be needed, but OTOH it might be implicit
in --panelstack.)
I agree it would be nice from the user's PoV if "join" could handle
this case. However, my first reaction is that this sort of
transposition and reshuffling is not in join's present repertoire and
would induce a fair amount more complexity, plus it means adding at
least three more options to a command that already has more than
any other.
Just thinking out loud, but maybe we could have a pstack() function (a
proper function) that does the business of transposing and reshaping
the data, with "skip_missing" temporarily turned off. It could take
two arguments: the integer number of individuals and an optional list
argument (defaulting to the entire dataset), and would return a matrix
with panelized variables in the columns.
In itself that would leave the user with the task of extracting the
series from the matrix. But maybe this pstack, or whatever we call it,
could write out the transformed dataset as CSV (or gdt) so it could
then be loaded easily -- either in addition to, or instead of,
returning a matrix.
Allin