[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

From |
jpitblado@stata.com (Jeff Pitblado, StataCorp LP) |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: bug in -anova- |

Date |
Mon, 14 Dec 2009 10:23:26 -0600 |

David Airey <david.airey@Vanderbilt.Edu> used the -noconstant- option with -anova- and notice that it did not affect the base level of factor variables: > I think I am noticing a bug in -anova- in Stata 11 in relation to automatic > handling of categorical variables. Notice how if I don't tell -anova- a > variable is categorical, it misses a level when noconstant is used. > > (Stata output omitted) > > I know that at <http://www.stata.com/support/faqs/stat/test1.html> the ibn.c > notation is used, but this should be fixed if I'm not missing anything. In David's example, he compared the results of > . anova htr ibn.c, noconstant with that of > . anova htr c, noconstant and found that the oneway model with factor 'ibn.c' produced 6 model degrees of freedom whereas the oneway model with factor 'c' produced 5 model degrees of freedom. This is intended behavior. The difference in degrees of freedom in the above two model fits is explained by the fact that factor 'c' has an implied base level even when the -noconstant- option is specified. Using the -baselevels- option with -regress- to replay the -anova- results will reveal that 'c==1' is the base. ----- In order to see why Stata acts this way, consider the following hypothetical example: . anova y A B, noconstant The question becomes, which factor should keep all of its levels. We opted to give you the control (via the 'ibn.' operator) to specify which factor gets to keep all its levels, as opposed to Stata arbitrarily picking which one. So if we wanted 'A' to keep all its levels we would type . anova y ibn.A B, noconstant ----- In summary, if you say -noconstant- you almost always want to use the "no base" operator 'ibn.' with one of your factor variables; otherwise, a base level will be determined for each specified factor variable. --Jeff --Ken jpitblado@stata.com khigbee@stata.com * * 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/

- Prev by Date:
**st: AW: Dropping all missing values** - Next by Date:
**AW: st: AW: Help with ologit** - Previous by thread:
**st: bug in -anova-** - Next by thread:
**re: st: bug in -anova-** - Index(es):

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