-------------------------------------------------------------------------------- name: log: H:\Documents and Settings\Lee\My Documents\Document\Stata\E5.3.log log type: text opened on: 26 Oct 2009, 11:05:43 Part a. . . reg ed dist, vce(hc3) Linear regression Number of obs = 3796 F( 1, 3794) = 29.58 Prob > F = 0.0000 R-squared = 0.0074 Root MSE = 1.8074 ------------------------------------------------------------------------------ | Robust HC3 ed | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- dist | -.0733727 .0134906 -5.44 0.000 -.0998222 -.0469232 _cons | 13.95586 .0378502 368.71 0.000 13.88165 14.03006 ------------------------------------------------------------------------------ Ho: b2=0 Ha: b2 not= 0 t= -5.44<-1.96 therefore reject Ho in favor of Ha: at the 5% level. The pvalue is < .000 <.05 therefore we are in the rejection region of this test. Part b. . . /* Check the confidence interval computed by Stata */ . scalar lu = _b[dist]+1.96*_se[dist] . scalar ll = _b[dist]-1.96*_se[dist] . scalar list lu ll lu = -.04693118 ll = -.09981423 The 95% CI is (-.00998,-.0469) which matches the ones automatically produced by Stata. No need to recompute these for parts (c) and (d). . . /* CI results match, so no need to do this manually again */ . Part c. . reg ed dist if female ==1, vce(hc3) Linear regression Number of obs = 2070 F( 1, 2068) = 11.92 Prob > F = 0.0006 R-squared = 0.0056 Root MSE = 1.8024 ------------------------------------------------------------------------------ | Robust HC3 ed | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- dist | -.0641676 .0185887 -3.45 0.001 -.1006221 -.027713 _cons | 13.93587 .0514246 271.00 0.000 13.83502 14.03672 ------------------------------------------------------------------------------ . scalar fd = _b[dist] . scalar fd_se= _se[dist] The pvalue associated with the two sided test of b2=0 is .001<.05, therefore we reject the hypothesis that distance has no effect at the 5% level. The 95% CI excludes zero, which confirms this. Part d. . reg ed dist if female ==0, vce(hc3) Linear regression Number of obs = 1726 F( 1, 1724) = 18.01 Prob > F = 0.0000 R-squared = 0.0099 Root MSE = 1.8142 ------------------------------------------------------------------------------ | Robust HC3 ed | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- dist | -.083837 .0197567 -4.24 0.000 -.1225866 -.0450875 _cons | 13.97899 .0560429 249.43 0.000 13.86907 14.08891 ------------------------------------------------------------------------------ . scalar md = _b[dist] . scalar md_se= _se[dist] The pvalue associated with the two sided test of b2=0 is .001<.05, therefore we reject the hypothesis that distance has no effect at the 5% level. The 95% CI excludes zero, which confirms this. . Part e. . scalar diff = fd - md . scalar sd_diff = sqrt(fd_se^2+md_se^2) . scalar tstat = diff/sd_diff . scalar pval = 2*(1-normal(tstat)) . scalar list diff sd_diff tstat pval diff = .01966948 sd_diff = .02712686 tstat = .72509248 pval = .4683953 The p-value for the test of the null hypothesis that b2_m=b2_f against the alternative that they are not equal is .468>.05. We cannot reject the null at the 5% level. . . /* Using multiple regression to do the test */ . gen f_dist=female*dist . reg ed dist female f_dist, vce(hc3) Linear regression Number of obs = 3796 F( 3, 3792) = 9.98 Prob > F = 0.0000 R-squared = 0.0076 Root MSE = 1.8078 ------------------------------------------------------------------------------ | Robust HC3 ed | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- dist | -.083837 .0197567 -4.24 0.000 -.1225717 -.0451024 female | -.0431251 .0760612 -0.57 0.571 -.1922499 .1059997 f_dist | .0196695 .0271269 0.73 0.468 -.0335152 .0728541 _cons | 13.97899 .0560429 249.43 0.000 13.86911 14.08887 ------------------------------------------------------------------------------ Notice that the distance coefficient is the same and that the f_dist coefficient is now directly measuring the difference in slopes. The se is the same as is the t-ratio. . . log close name: log: H:\Documents and Settings\Lee\My Documents\Document\Stata\E5.3.log log type: text closed on: 26 Oct 2009, 11:05:43 --------------------------------------------------------------------------------