Hi,

I'm of the opinion that a "*" operator for interaction variables is a very useful means!
A few weeks ago we discussed such possibilities in terms of MANOVA.
This would be the solution to such problems of descriptive statistics and further analysis.
What should be achieved? Well, I think list creation and usage in a model command like "dummify" now.

Would be great if this functionality would be implemented!

Have nice weekend
Leon



Am 30.12.2012 13:15, schrieb Riccardo (Jack) Lucchetti:
On Sun, 30 Dec 2012, Allin Cottrell wrote:

With regard to dummify, I'm not sure that accepting a list argument
is a great idea, since a (single) series argument already produces a
list result. Producing a "list of lists" seems to me on the verge of
being out of control.

Partially OT: I'm asking myself if we should go back to an idea that we briefly considered when we introduced operators for lists, and ended up being put on hold.

The idea is to use the "*" operator for a specialised version of the Cartesian product, commony known among applied economists as "interaction" variables. To be more explicit: suppose you have two lists, X and Y, with the only requirement that X should contain discrete variables only. Then, the construct "X*Y" would perform what is accomplished through the following script.

<hansl>
open keane.gdt
list X = choice status
list Y = wage educ

loop foreach j X --quiet
    matrix v = values($j)
    scalar n = rows(v)
    loop foreach i Y --quiet
        loop for k=1..n --quiet
            xi = v[k]
            sprintf vname "$i_$j_%d", xi
            series @vname = ($j == xi)*$i
        end loop
    end loop
end loop
</hansl>

Note that the dummify command/function would be a special case of this for "Y=const". I have the feeling that people working with micro data would love this.

Thoughts?


-------------------------------------------------------
  Riccardo (Jack) Lucchetti
  Dipartimento di Scienze Economiche e Sociali (DiSES)

  Università Politecnica delle Marche
  (formerly known as Università di Ancona)

  r.lucchetti@univpm.it
  http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------


_______________________________________________
Gretl-users mailing list
Gretl-users@lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users