# Re: st: "if" statement

 From Richard Williams To "statalist@hsphsun2.harvard.edu" , statalist Subject Re: st: "if" statement Date Wed, 16 Sep 2009 17:01:09 -0500

```At 03:43 PM 9/16/2009, Victor Mauricio Herrera wrote:
```
```model 2 --> xi: logistic sex i.ageg if age>=30
i.ageg            _Iageg_2-7          (naturally coded; _Iageg_2 omitted)

note: _Iageg_4 dropped because of collinearity

Logistic regression                               Number of obs   =       8017
```
LR chi2(4) = 2.35 Prob > chi2 = 0.6713
```Log likelihood = -5544.1939                       Pseudo R2       =     0.0002

------------------------------------------------------------------------------
```
sex | Odds Ratio Std. Err. z P>|z| [95% Conf. Interval]
```-------------+----------------------------------------------------------------
```
_Iageg_3 | .9789833 .0734452 -0.28 0.777 .8451164 1.134055 _Iageg_5 | .9451487 .0748512 -0.71 0.476 .8092619 1.103853 _Iageg_6 | .9931979 .0670654 -0.10 0.919 .8700789 1.133739 _Iageg_7 | .8989579 .0765455 -1.25 0.211 .7607821 1.06223
```------------------------------------------------------------------------------
```
Why is the age group 4 (40-49) dropped due to collinearity if there are 610 males and 660 females in this stratum? More worrisome, why is the age group 2 (20-29) still being used as reference when it should have been dropped as a consequence of the "if" statement (i.e. _Iage_3 should be the reference instead of _Iage_2)?
```

```
I believe group 4 is being used as the reference, not group 2. Group 2 is not in the analysis. Also, I replicate your model 2 in Stata 10.1...but when I run it in Stata 11 I get
```
. xi: logistic sex i.ageg if age>=30
i.ageg            _Iageg_2-7          (naturally coded; _Iageg_2 omitted)
note: _Iageg_7 omitted because of collinearity

Logistic regression                               Number of obs   =       8017
LR chi2(4)      =       2.35
Prob > chi2     =     0.6713
Log likelihood = -5544.1939                       Pseudo R2       =     0.0002

------------------------------------------------------------------------------
sex | Odds Ratio   Std. Err.      z    P>|z|     [95% Conf. Interval]
-------------+----------------------------------------------------------------
_Iageg_3 |    1.08902   .0882688     1.05   0.293     .9290586    1.276523
_Iageg_4 |   1.112399   .0947198     1.25   0.211     .9414161    1.314437
_Iageg_5 |   1.051383   .0892948     0.59   0.555     .8901588    1.241807
_Iageg_6 |   1.104832   .0819438     1.34   0.179     .9553535      1.2777
_Iageg_7 |  (omitted)
------------------------------------------------------------------------------

```
This labeling may be a little clearer -- you can see that group 7 is the reference while group 2 is not in the analysis.
```
-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME:   (574)289-5227
EMAIL:  Richard.A.Williams.5@ND.Edu
WWW:    http://www.nd.edu/~rwilliam

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/
```