Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Michael N. Mitchell" <Michael.Norman.Mitchell@gmail.com> |
To | Statalist <statalist@hsphsun2.harvard.edu> |
Subject | st: regress with vce(robust) and hascons |
Date | Mon, 13 Dec 2010 00:42:32 -0800 |
GreetingsI am puzzled by the behavior of Stata when I include the -vce(robust)- option along with the -hascons- option.
Consider the example below in which I estimate a model predicting -price- from -foreign- but do so using a cell means model by specifying ibn.foreign and thus include the -hascons- option. I further want robust standard errors so specify the -vce(robust)- option.
. sysuse auto, clear (1978 Automobile Data) . regress price ibn.foreign, vce(robust) hascons Linear regression Number of obs = 74 F( 2, 72) = 165.64 Prob > F = 0.0000 R-squared = 0.0024 Root MSE = 2966.4 ------------------------------------------------------------------------------ | Robust price | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- foreign | 0 | 6072.423 431.2084 14.08 0.000 5212.825 6932.021 1 | 6384.682 553.6754 11.53 0.000 5280.95 7488.413 | _cons | (omitted) ------------------------------------------------------------------------------The omnibus F test shows 2 degrees of freedom, but I only expected 1 df. The omnibus F test appears to be testing the joint hypothesis that each of the cell means is 0 (see below).
. test 0.foreign 1.foreign ( 1) 0bn.foreign = 0 ( 2) 1.foreign = 0 F( 2, 72) = 165.64 Prob > F = 0.0000But because I specified -hascons- I expect it to test the equality of the cell means. This is the case when I omit the -vce(robust)-, as shown below.
. regress price ibn.foreign, hascons Source | SS df MS Number of obs = 74 -------------+------------------------------ F( 1, 72) = 0.17 Model | 1507382.66 1 1507382.66 Prob > F = 0.6802 Residual | 633558013 72 8799416.85 R-squared = 0.0024 -------------+------------------------------ Adj R-squared = -0.0115 Total | 635065396 73 8699525.97 Root MSE = 2966.4 ------------------------------------------------------------------------------ price | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- foreign | 0 | 6072.423 411.363 14.76 0.000 5252.386 6892.46 1 | 6384.682 632.4346 10.10 0.000 5123.947 7645.417 ------------------------------------------------------------------------------ In this case, the omnibus F test matches the test of the equality of the cell means. . test 0.foreign = 1.foreign ( 1) 0bn.foreign - 1.foreign = 0 F( 1, 72) = 0.17 Prob > F = 0.6802 Perhaps someone can help me understand where I am askew in my thinking about this. Many thanks, 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 * * 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/