Jonathan Sterne <[email protected]> asks:
> A colleague and I were recently caught by the way that xi: interacts with
> if clauses. In the following, the whole dataset contains a value 0 for
> variable e1swabtype, but the subset that we wish to deal with does not.
> Because xi: creates indicator variables corresponding to every value in the
> dataset, not every value to be processed by the logistic command, logistic
> has to pick an indicator to be dropped, which it does automatically.
> Unfortunately for us, it dropped the indicator for level 2, leaving the
> results of the logistic regression the opposite way round to the way that
> we would have expected (i.e. the way that we got when we dropped the
> unwanted observations, then ran a logistic regression.)
>
> Most of the time, we think of these two options (run the command on a
> subgroup using -if- or drop the observations not in the subgroup) as
> interchangeable. Is there a good reason that xi: does not respect the if
> clause?
>
> <cut of example output>
-xi- knows nothing about the syntax of the commands that follow
it. It simply looks forward for the "i." to find the variables
it is to work on. It expands those "i." items to the list of
created dummy variables. After it has done this substitution, it
turns control over to the command that is to be run.
However, you can control which indicator variable is dropped.
See -help xi- and go down to the section titled "Summary of
controlling the omitted dummy". There it says that by default
-xi- omits the first group, but by defining a "[omit]"
characteristic you can explicitly control what group is dropped.
Ken Higbee [email protected]
StataCorp 1-800-STATAPC
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/