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.

Cheers
Leon



04.01.2013 11:52, schrieb Pindar:
> 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(a)univpm.it
>> http://www2.econ.univpm.it/servizi/hpp/lucchetti
>> -------------------------------------------------------
>>
>>
>> _______________________________________________
>> Gretl-users mailing list
>> Gretl-users(a)lists.wfu.edu
>> http://lists.wfu.edu/mailman/listinfo/gretl-users
>

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.

Cheers
Leon



04.01.2013 11:52, schrieb Pindar:
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.lucche...@univpm.it
  http://www2.econ.univpm.it/servizi/hpp/lucchetti
-------------------------------------------------------


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


Attachment: interaction.inp
Description: application/gretlscript

Reply via email to