On Fri, 26 Sep 2008, Gordon Hughes wrote:
Responding to Allin's suggestion:
> list L = dummify(x, val)
> That leaves a question: is it easier/more intuitive to read 'val'
> as denoting the val'th category when the distinct values of x are
> ordered, or as the condition x == val? I tend to think the latter
> is better.
I agree. It is very difficult to ensure that the first option
produces predictable results in a function context when there
might be missing categories. Hence, in practice one would have
to adopt the "list DL = dummify(x, max(x))".
However, without wanting to raise unnecessary difficulties,
won't this imply a change in the use of "dummify(x)" as an
argument in, say, OLS as in "OLS y Z dummify(x)"? At the
moment, this seem to drop one category automatically, so that
list Z can contain const.
Yes, good point. For the moment (gretl 1.7.9) I think it would be
better not to break backward compatibility: I'll leave it so that
without a second argument dummify() drops the first category.
If you want to use dummify() and _not_ drop any categories, then
dummify(x, NA)
will do the trick: it makes NA the "omitted category" but NAs
would not be coded anyway.
Allin.