|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: st: Dummy variable p value question
At 07:52 PM 11/30/2008, Jimmy Verner wrote:
Suppose you have an interval dependent variable Y, an interval
independent variable B and a nominal variable C. C has four
categories, C1, C2, C3 and C4. C is coded by four dummy variables, C1
through C4, with the value 1 when "in play" and the value 0 otherwise.
One may regress Y on B and C1 through C4 by dropping the constant:
Model A: reg Y B C1 C2 C3 C4, nocon
Alternatively, one may keep the constant but drop a category to avoid
falling into the dummy variable trap. The constant replaces the
dropped category:
Model B: reg Y B C1 C2 C3
If what I have said is correct, why are the p values different for C1
through C3 between the two models? And should not the p value for C4
in Model A be the same as for the constant in Model B?
In Model A, you are testing whether the C coefficients equal 0. In
Model B, you are testing whether the C coefficients equal the
constant. In model A, testing whether C1, C2 or C3 = C4 is
equivalent to the tests of C1, C2 and C3 in Model B. In other words,
the P values differ because the hypotheses being tested are
different. As for the C4 and constant P values being different --
can you give an example where that is the case? It isn't in the
example I give below.
. use "http://www.indiana.edu/~jslsoc/stata/spex_data/ordwarm2.dta", clear
(77 & 89 General Social Survey)
. quietly tab1 warm, gen(warm)
. reg ed warm1 warm2 warm3 warm4, nocon
Source | SS df MS Number of obs = 2293
-------------+------------------------------ F( 4, 2289) = 8936.13
Model | 343220.884 4 85805.2209 Prob > F = 0.0000
Residual | 21979.1163 2289 9.60206042 R-squared = 0.9398
-------------+------------------------------ Adj R-squared = 0.9397
Total | 365200 2293 159.267335 Root MSE = 3.0987
------------------------------------------------------------------------------
ed | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
warm1 | 10.94613 .1798059 60.88 0.000 10.59353 11.29873
warm2 | 11.85339 .1152426 102.86 0.000 11.6274 12.07938
warm3 | 12.63435 .105912 119.29 0.000 12.42665 12.84204
warm4 | 12.90168 .1517449 85.02 0.000 12.60411 13.19925
------------------------------------------------------------------------------
. test warm1 = warm4
( 1) warm1 - warm4 = 0
F( 1, 2289) = 69.08
Prob > F = 0.0000
. reg ed warm1 warm2 warm3
Source | SS df MS Number of obs = 2293
-------------+------------------------------ F( 3, 2289) = 31.93
Model | 919.856222 3 306.618741 Prob > F = 0.0000
Residual | 21979.1163 2289 9.60206042 R-squared = 0.0402
-------------+------------------------------ Adj R-squared = 0.0389
Total | 22898.9725 2292 9.99082571 Root MSE = 3.0987
------------------------------------------------------------------------------
ed | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
warm1 | -1.955551 .23528 -8.31 0.000 -2.416935 -1.494166
warm2 | -1.04829 .190545 -5.50 0.000 -1.421949 -.6746312
warm3 | -.2673329 .185051 -1.44 0.149 -.6302181 .0955524
_cons | 12.90168 .1517449 85.02 0.000 12.60411 13.19925
------------------------------------------------------------------------------
. test warm1 = 0
( 1) warm1 = 0
F( 1, 2289) = 69.08
Prob > F = 0.0000
-------------------------------------------
Richard Williams, Notre Dame Dept of Sociology
OFFICE: (574)631-6668, (574)631-6463
HOME: (574)289-5227
EMAIL: [email protected]
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/