0% found this document useful (0 votes)
176 views4 pages

Comparing Coefficients Across Groups Using Suest and Test

The document compares regression coefficients across groups using Stata commands suest and test. It runs a regression predicting hourly wage using variables like total work experience, current work experience, education and occupation. It then runs the regression separately for those who do and do not work in a union, and stores the results in estimates to later compare coefficients across the groups.

Uploaded by

amnoman17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
176 views4 pages

Comparing Coefficients Across Groups Using Suest and Test

The document compares regression coefficients across groups using Stata commands suest and test. It runs a regression predicting hourly wage using variables like total work experience, current work experience, education and occupation. It then runs the regression separately for those who do and do not work in a union, and stores the results in estimates to later compare coefficients across the groups.

Uploaded by

amnoman17
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Comparingcoefficientsacrossgroupsusingsuestandtest

TUESDAY,DECEMBER14,2010AT12:02AMPOSTACOMMENT

Forthelastfewweeksthetidbitshavecoveredtheuseofthetestcommandfollowingthemlogitcommand.Thishasbeenusefulfor
seeingthedifferentwaysthatthetestcommandcanbeusedforcomparingcoefficientswithinequationsandbetweenequations.

Let'sapplythesetoolstoanothersituation,tothecaseofcomparingthesizeofregressioncoefficientsbetween(among)groups.We
willcontinuetousethenlswdataset,andrenamethevariabletenuretocurr_expandcreatethevariableocc3basedonocc5.

.usenlsw
(NLSW,1988extract)

.renametenurecurr_exp

.recodeocc5(1=1"Prof/Mgmt")(2=2"Sales")(345=3"Other"),generate(occ3)
(837differencesbetweenocc5andocc3)

Let'srunaregressionpredictinghourlywagefromtotalworkexperience,currentworkexperience,educationstatus,andthreelevel
occupation.

.regresswagettl_expcurr_expgradei.occ3

Source|SSdfMSNumberofobs=2227
+F(5,2221)=106.98
Model|14370.805752874.16113Prob>F=0.0000
Residual|59668.6568222126.8656717Rsquared=0.1941
+AdjRsquared=0.1923
Total|74039.4625222633.261214RootMSE=5.1832


wage|Coef.Std.Err.tP>|t|[95%Conf.Interval]
+
ttl_exp|.1780861.0300155.930.000.1192256.2369466
curr_exp|.0550347.02445312.250.025.0070813.102988
grade|.5413644.046132311.740.000.4508973.6318314
|
occ3|
2|2.611124.29765448.770.0003.1948342.027414
3|3.142856.287814210.920.0003.7072692.578443
|
_cons|.2900189.73116970.400.6921.1438291.723867

Thisdatasetcontainsamixtureofwomenwhodoanddonotworkinaunion(indicatedbythevariableunion).Let'srunthis
regressionagain,butdososeparatelyforthosewhodoanddonotworkinaunion.

.regresswagettl_expcurr_expgradei.occ3ifunion==0

Source|SSdfMSNumberofobs=1405
+F(5,1399)=161.12
Model|8647.3191751729.46383Prob>F=0.0000
Residual|15016.6108139910.7338176Rsquared=0.3654
+AdjRsquared=0.3632
Total|23663.93140416.854651RootMSE=3.2763


wage|Coef.Std.Err.tP>|t|[95%Conf.Interval]
+
ttl_exp|.181499.02370177.660.000.1350042.2279937
curr_exp|.0563036.01955022.880.004.0179527.0946545
grade|.5461508.038129114.320.000.4713544.6209472
|
occ3|
2|2.366008.228289210.360.0002.8138341.918182
3|2.777399.229953512.080.0003.228492.326308
|
_cons|.7187908.60136711.200.2321.898469.4608877

.regresswagettl_expcurr_expgradei.occ3ifunion==1
Source|SSdfMSNumberofobs=459
+F(5,453)=26.13
Model|1788.81375357.76274Prob>F=0.0000
Residual|6202.5489445313.692161Rsquared=0.2238
+AdjRsquared=0.2153
Total|7991.3626445817.44839RootMSE=3.7003


wage|Coef.Std.Err.tP>|t|[95%Conf.Interval]
+
ttl_exp|.1909579.05031013.800.000.0920878.2898281
curr_exp|.0582129.03747861.550.121.0154405.1318664
grade|.4788253.06493347.370.000.3512172.6064334
|
occ3|
2|.8742659.52333851.670.0961.902738.1542066
3|1.177582.47815772.460.0142.117264.2378993
|
_cons|.06084091.1239370.050.9572.1479372.269619

Thecoefficientsforttl_expandcurr_expappearverysimilarforthesetwogroups,butthecoefficientforgrademaybedifferent.The
coefficientsforthedummyvariableseemratherdifferentbetweenthegroups.

Let'srunthesemodelsseparatelyagain,butusetheestimatesstorecommandtostoretheresultsofeachmodel.

.regresswagettl_expcurr_expgradei.occ3ifunion==0

Source|SSdfMSNumberofobs=1405
+F(5,1399)=161.12
Model|8647.3191751729.46383Prob>F=0.0000
Residual|15016.6108139910.7338176Rsquared=0.3654
+AdjRsquared=0.3632
Total|23663.93140416.854651RootMSE=3.2763


wage|Coef.Std.Err.tP>|t|[95%Conf.Interval]
+
ttl_exp|.181499.02370177.660.000.1350042.2279937
curr_exp|.0563036.01955022.880.004.0179527.0946545
grade|.5461508.038129114.320.000.4713544.6209472
|
occ3|
2|2.366008.228289210.360.0002.8138341.918182
3|2.777399.229953512.080.0003.228492.326308
|
_cons|.7187908.60136711.200.2321.898469.4608877

.estimatesstorem0

.
.regresswagettl_expcurr_expgradei.occ3ifunion==1

Source|SSdfMSNumberofobs=459
+F(5,453)=26.13
Model|1788.81375357.76274Prob>F=0.0000
Residual|6202.5489445313.692161Rsquared=0.2238
+AdjRsquared=0.2153
Total|7991.3626445817.44839RootMSE=3.7003


wage|Coef.Std.Err.tP>|t|[95%Conf.Interval]
+
ttl_exp|.1909579.05031013.800.000.0920878.2898281
curr_exp|.0582129.03747861.550.121.0154405.1318664
grade|.4788253.06493347.370.000.3512172.6064334
|
occ3|
2|.8742659.52333851.670.0961.902738.1542066
3|1.177582.47815772.460.0142.117264.2378993
|
_cons|.06084091.1239370.050.9572.1479372.269619

.estimatesstorem1

Wecannowusethesuestcommandtosimultaneouslyestimatethesetwomodelsatonce.

.suestm0m1

Simultaneousresultsform0,m1

Numberofobs=1864


|Robust
|Coef.Std.Err.zP>|z|[95%Conf.Interval]
+
m0_mean|
ttl_exp|.181499.02369977.660.000.1350484.2279495
curr_exp|.0563036.02231662.520.012.0125639.1000433
grade|.5461508.044237712.350.000.4594466.632855
|
occ3|
2|2.366008.24311839.730.0002.8425111.889505
3|2.777399.257198310.800.0003.2814982.2733
|
_cons|.7187908.64099431.120.2621.975117.5375349
+
m0_lnvar|
_cons|2.373399.080351329.540.0002.2159142.530885
+
m1_mean|
ttl_exp|.1909579.05754193.320.001.0781778.303738
curr_exp|.0582129.04746171.230.220.0348104.1512362
grade|.4788253.0551098.690.000.3708137.5868369
|
occ3|
2|.8742659.54449161.610.1081.94145.192918
3|1.177582.48311112.440.0152.124462.2307013
|
_cons|.0608409.96613880.060.9501.8327561.954438
+
m1_lnvar|
_cons|2.616823.187671513.940.0002.2489942.984653

Now,wecanusethetestcommandtomakecomparisonsofthecoefficientsbetweenthetwomodels(comparingthecoefficients
betweenthegroups).

Let'sstartbyaskingwhetherthecoefficientsfromthetwomodelsareequaltoeachother.Notethatthefirstmodelis
namedm0_meanandthesecondisnamedm1_mean.Thetestcommandbelowcomparesallofthecoefficientsfromthesetwo
models.

.test[m0_mean=m1_mean]

(1)[m0_mean]ttl_exp[m1_mean]ttl_exp=0
(2)[m0_mean]curr_exp[m1_mean]curr_exp=0
(3)[m0_mean]grade[m1_mean]grade=0
(4)[m0_mean]1b.occ3[m1_mean]1b.occ3=0
(5)[m0_mean]2.occ3[m1_mean]2.occ3=0
(6)[m0_mean]3.occ3[m1_mean]3.occ3=0
Constraint4dropped

chi2(5)=10.41
Prob>chi2=0.0645

Thistestisnotsignificant.But,let'slookateachofthecontinuousvariablesindividually,comparingeachvariablebetweenthetwo
models.

.test[m0_mean]ttl_exp=[m1_mean]ttl_exp

(1)[m0_mean]ttl_exp[m1_mean]ttl_exp=0
chi2(1)=0.02
Prob>chi2=0.8792

.test[m0_mean]curr_exp=[m1_mean]curr_exp

(1)[m0_mean]curr_exp[m1_mean]curr_exp=0

chi2(1)=0.00
Prob>chi2=0.9710

.test[m0_mean]grade=[m1_mean]grade

(1)[m0_mean]grade[m1_mean]grade=0

chi2(1)=0.91
Prob>chi2=0.3407

Noneofthesetestsaresignificant.

Let'sjointlytestthetwodummyvariablesassociatedwithocc3,comparingthembetweenthetwogroups.

.test([m0_mean]2.occ3=[m1_mean]2.occ3)///
>([m0_mean]3.occ3=[m1_mean]3.occ3)

(1)[m0_mean]2.occ3[m1_mean]2.occ3=0
(2)[m0_mean]3.occ3[m1_mean]3.occ3=0

chi2(2)=8.83
Prob>chi2=0.0121

Thistestissignificant.Wecanseparatelytesteachoftheoccupationdummies,asshownbelow.

.test[m0_mean]2.occ3=[m1_mean]2.occ3

(1)[m0_mean]2.occ3[m1_mean]2.occ3=0

chi2(1)=6.26
Prob>chi2=0.0124

.test[m0_mean]3.occ3=[m1_mean]3.occ3

(1)[m0_mean]3.occ3[m1_mean]3.occ3=0

chi2(1)=8.54
Prob>chi2=0.0035

Eachofthesedummiesareindividuallysignificant.

Thisconcludesthistidbitaboutcomparingcoefficientsbetweengroupsusingthesuestandtestcommands.

Youcandownloadtheexampledatafilesfromthistidbit(aswellasalloftheothertidbits)asshownbelow.Thesewilldownloadallof
theexampledatafilesintothecurrentfolderonyourcomputer.(Ifyouhavedonethisbefore,thenyoumayneedtospecifynetget
stowdata,replacetooverwritetheexistingfiles.

netfromhttp://www.MichaelNormanMitchell.com/storage/stowdata
netgetstowdata

IfyouhavethoughtsonthisStataTidbitoftheWeek,youcanpostacomment.Youcanalsosendmeanemailat
MichaelNormanMitchellandthentheatsignandgmaildotcom.Ifyouarereceivingthistidbitviaemail,youcanfindthewebversion
athttp://www.MichaelNormanMitchell.com/.

You might also like