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   Finne H�kon <[email protected]>
To   [email protected]
Subject   st: RE: reg with xi and if exp
Date   Thu, 29 Aug 2002 09:38:38 +0200

I would guess that Stata parses from left to right before it parses from the
inside out so that the xi command doesn't see the if constraint on the reg
command. You might try something like

preserve
keep if r2>15
xi: reg qa_ek i.r2
restore

--H�kon
[email protected]

> -----Original Message-----
> From: Plattner, Dankwart [mailto:[email protected]]
> Sent: 28. august 2002 17:31
> To: '[email protected]'
> Subject: st: reg with xi and if exp
> 
> 
> Dear Co-Stata-Users,
> 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?
> TIA
> Sincerely 
> Dankwart Plattner
> 
> *
> *   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/
> 
*
*   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