Am 11.01.2015 um 14:09 schrieb Riccardo (Jack) Lucchetti:
On Sun, 11 Jan 2015, Sven Schreiber wrote:
>
> For the direction list-to-matrix we have the wonderful {} syntax, and
> section 15.9 describes how to do matrix-to-series. So why not
> matrix-to-list?
Well, a problem I see with is that list elements are series you ought to
give a name to. I guess you could call the X1, X2 and so forth, or
otherwise you could supply a second "strings" argument.
Yes you're right, and my example code would therefore not work as-is. As
you say, one could have an optional string argument, or if the matrix
has column names, those could be used, or as a fall-back one could use
the supplied list name with appended numbers 1 to n.
> The thing is that currently lists and matrices in gretl are
> complementary; you cannot use matrices in estimation commands for
> example, and you cannot apply many calculations to lists.
The good thing about matrices is that you're free from the tyranny of
$nobs. Also, don't forget that we have lincomb(), which I find very
useful, plus a host of other functions for lists, such as nelem(),
sum(), sd(), max(), min() etc.
I haven't forgotten those, but they are far from complete, for the same
naming issues that you pointed out. But you're right (again) in that an
alternative route could be to enable more arithmetic functions with
lists. However, the a priori arbitrary naming of the resulting series
would then involve more hardwired choices like the "d_" and "l_"
prefixes for diffs and lags.
> So I think we need to ensure quick and easy conversion from one type
> to the other. In terms of syntax, I wouldn't mind an explicit
> function like mat2list() above, to be built-in. What do you think?
I don't know, I can't see myself using this a lot, but maybe it's just me.
My impression from your code that I have seen is that you quickly go the
all-matrix route. That is fine of course but my interpretation is that
it's exactly because of the list limitations. I would bet that that is
also the reason why somebody (you?) invented the mols() and related
matrix-only functions, which are essentially a duplication of existing
functionality. So it looks like that was your way of solving similar
problems. I'm not sure that this duplication solution is optimal, but of
course one can argue about that.
cheers,
sven