Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# Re: st: regress with vce(robust) and hascons

 From "Michael N. Mitchell" To statalist@hsphsun2.harvard.edu Subject Re: st: regress with vce(robust) and hascons Date Mon, 13 Dec 2010 15:44:07 -0800

```Dear Jeff

```
This is now completely crystal clear. Thank you *so much* for taking the time to share this with me and all the other readers on the list and explain it with such patience and clarity. And thanks to the others who responded with references to look up (I pursued those as well).
```
Best regards,

Michael N. Mitchell
Data Management Using Stata      - http://www.stata.com/bookstore/dmus.html
A Visual Guide to Stata Graphics - http://www.stata.com/bookstore/vgsg.html
Stata tidbit of the week         - http://www.MichaelNormanMitchell.com

On 2010-12-13 3.01 PM, Jeff Pitblado, StataCorp LP wrote:
```
```Michael N. Mitchell<Michael.Norman.Mitchell@gmail.com>  has a follow-up
question regarding the different model degrees of freedom when the -hascons-
option is used with -regress-, with and without the -vce(robust)- option:

```
```Thank you very kindly for such an extensive answer. I highly suspected that
my flaw in reasoning came from overly generalizing from an ANOVA
perspective. Your email is very clear and very illuminating. I understand
about the switching from a sum of squares approach to a wald approach (and
how the two approaches diverge in the case of robust standard errors). The
way that you showed the divergence of the wald test and the computations
using sums of squares makes great sense.
```
```
```
```Unfortunately, I am still stuck on the issue of the model degrees of
freedom. Without -vce(robust)-, switching from -nocons- to -hascons- changes
the model degrees of freedom from 2 to 1 (see below).
```
```
```
```------- SNIP ------
. *** WITHOUT -vce(robust)-
. quietly regress price ibn.foreign, nocons
. di e(df_m)
2
. quietly regress price ibn.foreign, hascons
. di e(df_m)
1
------- SNIP ------
```
```
```
```But, in the presence of -vce(robust)-, the model degrees of freedom is the
same is both cases, still 2 df (see below). Can you explain why the model
degrees of freedom do not change from 2 to 1 when switching from -nocons- to
-hascons- in the presence of -vce(robust)-. It seems that these omnibus
F-tests are testing the same null hypotheses (that price is equal to 0).
```
```
```
```------- SNIP ------
. *** WITH -vce(robust)-
. quietly regress price ibn.foreign, nocons vce(robust)
. di e(df_m)
2
. quietly regress price ibn.foreign, hascons vce(robust)
. di e(df_m)
2
------- SNIP ------
```
```
The degrees of freedom for the overall model test are determined by the method
used to compute the F statistic.

For the ANOVA style F statistic computed from the reduction in the error sum
of squares, the single degree of freedom comes from the fact that we are
comparing the error sum of squares from the constant only model

. regress price

which has only 1 parameter, to the model with a mean for each level of
'foreign'

. regress price i.foreign

or equivalently

. regress price bn.foreign,  hascons

which has two parameters, yielding a mean estimate of 'price' at each level of
'foreign'.  This ANOVA style test has 1 degree of freedom because we are
adding one parameter estimate to the model fit compared to the constant-only
model.

The Wald style model F statistic is computed using all the coefficient
estimates (not including the intercept) and their VCE, which can be reproduced
by typing

. test [#1]

which is short-hand for

. test 0.foreign 1.foreign

and yields a Wald test against the Null hypothesis that the specified
parameters are zero.

With the -vce(robust)- option, -regress- is limited to reporting this test;
without the -vce(robust)- option, -regress- reports the ANOVA style test.

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