|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: bug in -anova-
David Airey <[email protected]> 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
[email protected] [email protected]
*
* 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/