Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Stata post test (simple question)


From   Richard Williams <[email protected]>
To   [email protected]
Subject   Re: st: Stata post test (simple question)
Date   Thu, 29 Jan 2004 20:00:28 -0500

At 11:47 PM 1/29/2004 +0000, Joao Pedro W. de Azevedo wrote:
Dear Stata users,

I have a very simple question.

I would like to test the hypothesis of equality of all coefficients (except
the intercept) using two or more different sub samples of my dataset.

For example, I would like to compare the results of the following models:

        Lnwage = cons + educ + exp + expsq + error (if inside==1)
        Lnwage = cons + educ + exp + expsq + error (if inside==0)
Here are two UCLA FAQs on making comparisons across groups if they help any:

http://www.ats.ucla.edu/stat/stata/faq/compreg2.htm

http://www.ats.ucla.edu/stat/stata/faq/compreg3.htm

I know you said you did not want to compute new variables, but it is really not hard to do and life will be much simpler if you do. Here is how you could do it with the xi command (I just made up some data with your variable names to make sure I got it right:)

. xi: reg Lnwage i.inside*educ i.inside*exp i.inside*expsq

i.inside _Iinside_0-1 (naturally coded; _Iinside_0 omitted)
i.inside*educ _IinsXeduc_# (coded as above)
i.inside*exp _IinsXexp_# (coded as above)
i.inside*expsq _IinsXexpsq_# (coded as above)

Source | SS df MS Number of obs = 100
-------------+------------------------------ F( 7, 92) = 0.34
Model | 2.06640451 7 .295200644 Prob > F = 0.9353
Residual | 80.7333601 92 .877536523 R-squared = 0.0250
-------------+------------------------------ Adj R-squared = -0.0492
Total | 82.7997646 99 .836361259 Root MSE = .93677

------------------------------------------------------------------------------
Lnwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
_Iinside_1 | (dropped)
educ | .0718497 .1402154 0.51 0.610 -.2066302 .3503296
_IinsXeduc_1 | -.0836037 .1942447 -0.43 0.668 -.4693904 .3021831
_Iinside_1 | .0222896 .2546331 0.09 0.930 -.4834337 .5280129
exp | -.1128918 .1267362 -0.89 0.375 -.3646009 .1388172
_IinsXexp_1 | .2634762 .2252115 1.17 0.245 -.1838132 .7107656
_Iinside_1 | (dropped)
expsq | .025165 .096337 0.26 0.795 -.1661686 .2164986
_IinsXexps~1 | -.0140251 .2183539 -0.06 0.949 -.4476947 .4196445
_cons | -.1139492 .1711175 -0.67 0.507 -.4538033 .2259048
------------------------------------------------------------------------------

. test _IinsXeduc_1 _IinsXexp_1 _IinsXexpsq_1

( 1) _IinsXeduc_1 = 0
( 2) _IinsXexp_1 = 0
( 3) _IinsXexpsq_1 = 0

F( 3, 92) = 0.66
Prob > F = 0.5815

Note that I am only testing the three interaction terms, so that allows the intercept to differ across groups. You would conclude that the effects of educ, exp and expsq do not differ between groups.

If you had more than two groups, xi would compute more vars, and (I think) you would want to test all the ones that started with _IinsX. Equivalently, you would not test _Iinside_1 _Iinside_2 etc.

If the weird variable names created by xi drive you blind (they do me!) this is equivalent to (assuming inside is coded 0-1 and nothing else)

. gen inseduc = inside * educ

. gen insexp = inside * exp

. gen insexpsq = inside * expsq

. reg Lnwage educ exp expsq inside inseduc insexp insexpsq

Source | SS df MS Number of obs = 100
-------------+------------------------------ F( 7, 92) = 0.34
Model | 2.06640451 7 .295200644 Prob > F = 0.9353
Residual | 80.7333601 92 .877536523 R-squared = 0.0250
-------------+------------------------------ Adj R-squared = -0.0492
Total | 82.7997646 99 .836361259 Root MSE = .93677

------------------------------------------------------------------------------
Lnwage | Coef. Std. Err. t P>|t| [95% Conf. Interval]
-------------+----------------------------------------------------------------
educ | .0718497 .1402154 0.51 0.610 -.2066302 .3503296
exp | -.1128918 .1267362 -0.89 0.375 -.3646009 .1388172
expsq | .025165 .096337 0.26 0.795 -.1661686 .2164986
inside | .0222896 .2546331 0.09 0.930 -.4834337 .5280129
inseduc | -.0836037 .1942447 -0.43 0.668 -.4693904 .3021831
insexp | .2634762 .2252115 1.17 0.245 -.1838132 .7107656
insexpsq | -.0140251 .2183539 -0.06 0.949 -.4476947 .4196445
_cons | -.1139492 .1711175 -0.67 0.507 -.4538033 .2259048
------------------------------------------------------------------------------

. test inseduc insexp insexpsq

( 1) inseduc = 0
( 2) insexp = 0
( 3) insexpsq = 0

F( 3, 92) = 0.66
Prob > F = 0.5815


*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/




© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index