Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: RE: reg with xi and if exp


From   "Nick Cox" <[email protected]>
To   <[email protected]>
Subject   st: RE: reg with xi and if exp
Date   Wed, 28 Aug 2002 20:09:51 +0100

Plattner, Dankwart

> I encounter a behavior I don't understand. I'm running a regression
> (stripped down to its bones in order to better present my
> problem) with xi
> and an if expression:
>
> . xi: reg qa_ek i.r2 if  r2>15
> i.r2              _Ir2_15-93          (naturally coded;
> _Ir2_15 omitted)
>
>       Source |       SS       df       MS
> Number of obs =
> 85825
> -------------+------------------------------           F(
> 2, 85822) =
> 132.51
>        Model |  207587.248     2  103793.624           Prob
> > F      =
> 0.0000
>     Residual |  67223628.8 85822  783.291333
> R-squared     =
> 0.0031
> -------------+------------------------------           Adj
> R-squared =
> 0.0031
>        Total |  67431216.0 85824  785.691834           Root
> MSE      =
> 27.987
>
> ------------------------------------------------------------
> ----------------
> --
>        qa_ek |      Coef.   Std. Err.      t    P>|t|     [95% Conf.
> Interval]
> -------------+----------------------------------------------
> ----------------
> --
>      _Ir2_91 |  -4.046854   .2492706   -16.23   0.000    -4.535422
> -3.558285
>      _Ir2_92 |  (dropped)
>      _Ir2_93 |  -2.513805   .2658109    -9.46   0.000    -3.034792
> -1.992818
>        _cons |   22.55939   .2058561   109.59   0.000     22.15592
> 22.96287
> ------------------------------------------------------------
> ----------------
> --
>
> My questions are,
> - why does STATA use r2==15 as the omitted category when I
> excluded this
> category in the if exp? Is an if exp useless with xi when
> the same var is in
> the if exp and handled by xi?
> - why is r2=92 dropped? Is it because the omitted category
> was chosen
> wrongly (there should be no with the data)?
> Maybe somebody could possibly point me to an explanation
> and a remedy?

On the first, my guess is that you are seeing
a strict division of labour. -xi- has the job
of setting up the interactions. Only when -regress-
is fired up is there attention to any -if- restrictions.
To put it another way, there is code within the -regress-
command to do this, so it would have been pointless
for the Stata programmers to duplicate that code with
(much slower) interpreted
code within -xi-.

On the second, my guess is that this is just a
consequence of the relationships between
your covariates.

I doubt you did anything wrong.

Nick
[email protected]

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index