Hi everybody,
in chapter 15 of the user guide under "Generating lists of transformed
variables" there is an explanation of how to use the "^" operator to
create a list of interaction effects. This is nice, but to the average
user it might be surprising to read in the footnote "this construct does
not work if neither D nor Z are of the the list type." The reason for
this, AFAIK, is that if both D and Z are series objects, then D^Z is
just the exponentiation of the corresponding values of D by Z, and so we
get a single series in return with a totally different meaning. (And
since this series is then anonymous, trying to assign it to a list type
yields an error.)
I believe there are some little problems with this situation.
1) This is not my main point, but there might be a danger of
inadvertently doing the exponentiation although it wasn't intended. Example:
<hansl>
open mroz87.gdt
# KL6 is a discrete number of children, WA is (pseudo-) continuous
inter = KL6 ^ WA # note no explicit "list" type is indicated
</hansl>
This will create a series "inter" which has nothing to do with
interaction effects. Possibly this could imply subtle bugs, if "inter"
is mistakenly treated as a regressor list down the road.
Possible solutions for this problem: Perhaps mention this danger
explicitly in the documentation. Also, why actually is the "^" operator
overloaded with these very different things? Couldn't the interaction
thing be indicated through, say, "^^" instead?
2) It's a bit of a pity that interactions through this mechanism aren't
possible for single series, i.e. that 'list inter = KL6 ^ WA' currently
must fail. It would be nice if this could be generalized, no?
Possible solutions for this second point: Agani, if we had a different
and exclusive operator like "^^", then it would seem to be fairly easy
to implement, right? Apart from that, I guess that a pretty
straightforward workaround could be mentioned in the guide, namely
something like:
list H = deflist(D) ^ Z
(which in the specific context above becomes: list inter = deflist(KL6)
^ WA, tested as working).
OK, so bottom line, I think we should add some remarks to the
documentation, and then maybe discuss the pros and cons of having a
separate operator.
thanks
sven
Show replies by date