[Gretl-devel] Bugs, missing features and a suggestion

andreas.rosenblad at ltv.se andreas.rosenblad at ltv.se
Wed Sep 26 05:40:40 EDT 2007


r.lucchetti at univpm.it @ INTERNET skrev 2007-09-25 15:10:06 :

> On Tue, 25 Sep 2007, andreas.rosenblad at ltv.se wrote:
>
> > Third, I have a few feature requests:
> >
> > 1. It should be possible to use the xtab command with nx1 matrices,
i.e.
> > the inputs are matrix vectors
>
> matrix->series conversion is not that hard; are you sure you need this
> badly?


Well, currently I have to do as follows:

a = rows(A)
smpl 1 a
series Anew = A
series Bnew = B
xtab Anew Bnew
delete Anew bnew
smpl --full

Thus, I have to use 7 commands. Instead I would like to use just one
command:

xtab A B

It would be much easier and efficient, having to write less code. So I
would really appreciate it.


> > 2. The xtab command should be able to take a nxn matrix with discrete
> > values as input an calculate a cross table from this, where this matrix
is
> > the inner square matrix of the cross table (i.e. the cross table except
the
> > marginals)
>
> I'm afraid this is not very clear to me. What is the input, exactly? By
my
> possibly wrong impression, however, it looks like you can get this by
> using sumc(), sumr() and the concatenation operators "~" and "|".


For a matrix C = {3,2;2,3} gretl currently give the following output:

? C
C (2 x 2)

  3   2
  2   3

What I am asking for is following output

? xtab C

       [   1][   2]  TOT.

[   1]     3     2      5
[   2]     2     3      5

TOTAL      5     5     10

I need this function mainly for producing nice outputs with column and row
headings, and I thought this would be the easiest way to implement it.

A better solution, that better suits my needs, but maybe is harder to
implement, is to create a new "printtable" command that attaches column and
row names to a matrix (something like the dimnames argument in the matrix
command in R) as well as row and column headings.

Ideally, a command "printtable" would produce something like:

A = {3, 2, 5; 2, 3, 5; 5, 5, 10}

printtable A rownames={"row 1", "row2", "Total"} columnnames={"col 1", "col
2", "Total"} \
columnheading="Variable 1" rowheading="Variable 2"

And then with this input give the following output:

                        Variable 1
                   col 1  col 2  Total
            row 1      3      2      5
Variable 2  row 2      2      3      5
            Total      5      5     10

Would this be possible to implement in gretl?


> > 3. After calculating a cross classification table from View > Cross
> > Tabulation in the GUI, one gets the possibility to save the output
table as
> > a matrix. This feature should be available also from the command line
> > interface.
>
> This is exactly what the mxtab function is for. Am I missing something?


I'm sorry, I couldn't find anytning about that function in the Gretl
Command Reference, the Gretl User's Guide or the help files.


> > 4. The parameterts of a function can currently be of six types: bool,
int,
> > scalar, series, list, matrix. Please include a third type "discrete" or
> > "disc" for a discrete data series
> >
> > 5. Create a new boolean command isdiscrete() to check if a series or
matrix
> > contains only discrete values, with outputs 1 if it is discrete and 0
> > otherwise.
>
> This is doable quite easily and certainly useful. The availability of
such
> function, though, would probably make your item 4 redundant, wouldn't it?


Maybe.


Best regards,
Andreas



More information about the Gretl-devel mailing list