On Thu, 14 Feb 2013, Pindar wrote:
Hi there,
I'd like to ask what the interaction operator 'makes'?
I was working on a function that generates new interaction series for each
step combination of factors.
This is working for a list of factors and generates bivariate combinations as
in A*B
I'm stuck with making it possible to generate A*B*C and so on.
This should be possible with a recursive function!
I think with a new gretl operato '*' the whole procedure would get much
easier to implement.
I also encountered some bugs (at least on W8):
- having 'opened' a bundle and then using the '= null' command gretl
crashes
- 'smpl full' does 'sometimes' not work in functions - I think if
it's
outside a loop.
- 'delete --type==' does not update the symbols window automatically
Here is the code for the function as well (gonna be implemented in my new
multivariate statistic package).
Perhaps someone has an idea how to solve the sorting issue for more than A*B.
I've documented the new operator (warning: it's "^", not "*")
in the CVS
version of the manual not very long ago: in the A4 version
(
http://sourceforge.net/projects/gretl/files/manual/gretl-guide-a4.pdf/dow...)
look for pages 91-92.
Anyway, the following script should give you a good idea:
<hansl>
open mroz87.gdt --quiet
# the coding below makes it so that
# KIDS = 0 -> no kids
# KIDS = 1 -> young kids only
# KIDS = 2 -> young or older kids
series KIDS = (KL6 > 0) + ((KL6 > 0) || (K618 > 0))
list D = CIT KIDS # interaction discrete variables
list X = WE WA # variables to "split"
list INTER = D ^ X
smpl 1 6
print D X INTER -o
</hansl>
-------------------------------------------------------
Riccardo (Jack) Lucchetti
Dipartimento di Scienze Economiche e Sociali (DiSES)
Università Politecnica delle Marche
(formerly known as Università di Ancona)
r.lucchetti(a)univpm.it
http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------