11.07.2015 Views

[U] User's Guide

[U] User's Guide

[U] User's Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

354 [ U ] 25 Working with categorical data and factor variables. regress marriagert medage i6.state i30.state, baselevelsSource SS df MS Number of obs = 50F( 2, 47) = 2311.15Model 171657575 2 85828787.6 Prob > F = 0.0000Residual 1745428.85 47 37136.784 R-squared = 0.9899Adj R-squared = 0.9895Total 173403004 49 3538836.82 Root MSE = 192.71marriagert Coef. Std. Err. t P>|t| [95% Conf. Interval]medage -61.23095 16.2825 -3.76 0.000 -93.98711 -28.47479state6 (base)30 13255.81 194.9742 67.99 0.000 12863.57 13648.05_cons 2875.366 481.5533 5.97 0.000 1906.606 3844.126Look at the result for state. Rather than obtaining a coefficient for 6.state as we expected,Stata instead chose to omit it as the base category.Stata considers all the individual specifiers for a factor variable together as being related. In ourcommand, we specified that we wanted i6.state and i30.state by typing. regress marriagert medage i6.state i30.stateand Stata put that together as “include state, levels 6 and 30”. Then Stata applied its standard logicfor dealing with factor variables: treat the smallest level as the base category.To achieve the desired result, we need to tell Stata that we want no base, which we do by typingthe “base none” (bn) modifier:. regress marriagert medage i6bn.state i30.stateWe need to specify bn only once, and it does not matter where we specify it. We could type. regress marriagert medage i6.state i30bn.stateand we would obtain the same result. We can specify bn more than once:. regress marriagert medage i6bn.state i30bn.stateThe result of typing any one of these commands is. regress marriagert medage i6bn.state i30.state, baselevelsSource SS df MS Number of obs = 50F( 3, 46) = 1514.31Model 171664796 3 57221598.6 Prob > F = 0.0000Residual 1738208.24 46 37787.1357 R-squared = 0.9900Adj R-squared = 0.9893Total 173403004 49 3538836.82 Root MSE = 194.39marriagert Coef. Std. Err. t P>|t| [95% Conf. Interval]medage -60.66128 16.47607 -3.68 0.001 -93.82589 -27.49667state6 86.12456 197.0209 0.44 0.664 -310.4578 482.70730 13257.18 196.6991 67.40 0.000 12861.25 13653.12_cons 2856.788 487.6072 5.86 0.000 1875.286 3838.29

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!