当前位置:文档之家› stata上机实验操作

stata上机实验操作

第六章第二题:1. 建立完成的教育年数(ED )对到最近大学的距离(Dist )的回归:. reg ed dist, robust斜率估计值是:-0.0732. reg ed dist bytest female black hispanic incomehi ownhome dadcoll cue80 stwmfg80,robustDist 对ED 的效应估计是:-0.0323. 系数下降50%,存在很大差异,(1)中回归存在遗漏变量偏差4. di e(r2_a)(可看到调整后的R2)第一问中=0.0074 调整的2R =0.00718796_cons 13.95586 .0378112 369.09 0.000 13.88172 14.02999dist -.0733727 .0134334 -5.46 0.000 -.0997101 -.0470353ed Coef. Std. Err. t P>|t| [95% Conf. Interval]RobustRoot MSE = 1.8074R-squared = 0.0074Prob > F = 0.0000F( 1, 3794) = 29.83Linear regression Number of obs = 3796. reg ed dist , robust2R第二问中=0.2788 2R = 0.27693235可以得到第二问中的拟合效果要优于第一问。

第二问中相似的原因:因为n 很大。

5. Dadcoll 父亲有没有念过大学:系数为正(0.6961324)衡量父亲念过大学的学生接受的教育年数平均比其父亲没有年过大学的学生多。

.0232052-.0517777 1)原因:这些参数在一定程度上构成了上大学的机会成本。

2)它们的系数估计值的符号应该如此。

当Stwmfg80增加时,放弃的工资增加,所以大学入学率降低了;因而Stwmfg80的系数对应为负。

而当Cue80增加时,人们会发现找工作很困难,这降低上大学的机会成本,所以平均的大学入学率就会增加;因而Cue80的系数对应为正。

7.带入计算即可(14.75)8.同7.(14.69)第七章第二题1. . reg course_eval beauty,robust95%置信区间见上表。

2.2R_cons 3.998272 .0253493 157.73 0.000 3.948458 4.048087beauty .1330014 .0323189 4.12 0.000 .0694908 .1965121course_eval Coef. Std. Err. t P>|t| [95% Conf. Interval]RobustRoot MSE = .54545R-squared = 0.0357Prob > F = 0.0000F( 1, 461) = 16.94Linear regression Number of obs = 463Linear regression Number of obs = 463 F( 7, 455) = 14.43 Prob > F = 0.0000 R-squared = 0.1556 Root MSE = .51377Robustcourse_eval Coef. Std. Err. t P>|t| [95% Conf. Interval]age -.0019545 .0026218 -0.75 0.456 -.0071068 .0031978 beauty .1592092 .0306846 5.19 0.000 .098908 .2195104 minority -.1694282 .067891 -2.50 0.013 -.3028471 -.0360093 female -.1832345 .0521947 -3.51 0.000 -.2858071 -.0806619 onecredit .633 .1077655 5.87 0.000 .4212201 .8447798 intro .0079488 .0565469 0.14 0.888 -.1031766 .1190742 nnenglish -.2438402 .0958959 -2.54 0.011 -.432294 -.0553863 _cons 4.16853 .1390349 29.98 0.000 3.8953 4.44176由P值得出age 及intro 变量均不显著。

所以应该去掉。

Source SS df MS Number of obs = 463F( 5, 457) = 16.71Model 21.9857702 5 4.39715404 Prob > F = 0.0000Residual 120.25285 457 .263135339 R-squared = 0.1546Adj R-squared = 0.1453Total 142.23862 462 .307875801 Root MSE = .51297course_eval Coef. Std. Err. t P>|t| [95% Conf. Interval]minority -.1647853 .0756893 -2.18 0.030 -.3135275 -.0160431female -.1741755 .049113 -3.55 0.000 -.2706909 -.0776601onecredit .6413254 .1063165 6.03 0.000 .4323955 .8502554beauty .1660434 .0306266 5.42 0.000 .1058569 .2262299nnenglish -.2480077 .1052349 -2.36 0.019 -.4548121 -.0412033_cons 4.072006 .032976 123.48 0.000 4.007203 4.13681变量均显著合理的置信区间应为(0 .1058569 0.2262299)第八章第二题:1.reg course_eval beauty intro onecredit female minority nnenglish,r2. gen age2=age*age. reg course_eval age age2,beauty intro onecredit female minority nnenglish ,r由age 与age2 的p值可看出均大于0.05,因此不能拒绝原假设,即没有充分的证据显示age 对course_eval的效应是非线性的,也没有证据显示Age对Course_Eval 有影响。

3.生成交互项:generate a= female* beauty.regress course_eval beauty intro onecredit female minority nnenglish fb,robustfemale与Beauty的交互作用的变量后,其P值为0.000变量是显著的,即有充分证据表明性别不同时,Beauty的效应之差存在。

4.. sum beautyVariable Obs Mean Std. Dev. Min> Max>beauty 463 4.75e-08 .7886477 -1.450494> 1.970023可知:手术前的beauty为-0.7886,术后为0.7886,上升了0.231 * (2 * 0.79) = 0.37.课程提高的95%置信区间为(0.231*1.96*0.048) *(2 *0.79) ,即(0.22 ,0.51)5.计算略第八章第四题:keep if country_name != "Malta"reg growth tradeshare yearsschool //回归1est store m1gen ly=ln( yearsschool )reg growth tradeshare lyest store m2gen lr=ln( rgdp60)reg growth tradeshare ly rev_coups assasinations lrest store m3gen tly= tradeshare* lyreg growth tradeshare ly rev_coups assasinations lr tlyest store m4gen t2= tradeshare* tradesharegen t3= tradeshare* t2reg growth tradeshare t2 t3 ly rev_coups assasinations lrest store m5outreg2 [m1 m2 m3 m4 m5] using myfile , word replace see或者分步:首先drop in 651.. reg growth tradeshare yearsschoolSource SS df MS Number of obs = 64 F( 2, 61) = 5.84 Model 33.3764711 2 16.6882356 Prob > F = 0.0048 Residual 174.431689 61 2.85953588 R-squared = 0.1606 Adj R-squared = 0.1331 Total 207.80816 63 3.29854222 Root MSE = 1.691growth Coef. Std. Err. t P>|t| [95% Conf. Interval]tradeshare 1.897823 .9360473 2.03 0.047 .0260808 3.769565 yearsschool .2429753 .083702 2.90 0.005 .0756027 .4103478 _cons -.1222363 .6626687 -0.18 0.854 -1.447324 1.2028522.. gene ly=ln( yearsschool ). reg growth tradeshare lySource SS df MS Number of obs = 64F( 2, 61) = 12.29Model 59.6761976 2 29.8380988 Prob > F = 0.0000Residual 148.131962 61 2.42839283 R-squared = 0.2872Adj R-squared = 0.2638Total 207.80816 63 3.29854222 Root MSE = 1.5583growth Coef. Std. Err. t P>|t| [95% Conf. Interval]tradeshare 1.748979 .8599768 2.03 0.046 .0293485 3.468608ly 1.016292 .2230901 4.56 0.000 .5701953 1.462388_cons -.185739 .5642853 -0.33 0.743 -1.314097 .94261913. gen lr=ln( rgdp60). reg growth tradeshare ly rev_coups assasinations lrSource SS df MS Number of obs = 64F( 5, 58) = 9.61Model 94.1730235 5 18.8346047 Prob > F = 0.0000Residual 113.635136 58 1.95922649 R-squared = 0.4532Adj R-squared = 0.4060Total 207.80816 63 3.29854222 Root MSE = 1.3997growth Coef. Std. Err. t P>|t| [95% Conf. Interval]tradeshare 1.10353 .8331579 1.32 0.191 -.5642168 2.771277ly 2.161291 .3626545 5.96 0.000 1.435359 2.887223rev_coups -2.299537 1.004465 -2.29 0.026 -4.310193 -.2888816assasinations .2277195 .4336512 0.53 0.602 -.6403278 1.095767lr -1.621135 .3985046 -4.07 0.000 -2.418829 -.8234416_cons 11.74591 2.919804 4.02 0.000 5.901285 17.590534. gen tly= tradeshare* ly. reg growth tradeshare ly rev_coups assasinations lr tlySource SS df MS Number of obs = 64F( 6, 57) = 8.00Model 94.9878003 6 15.8313001 Prob > F = 0.0000Residual 112.82036 57 1.97930455 R-squared = 0.4571Adj R-squared = 0.3999Total 207.80816 63 3.29854222 Root MSE = 1.4069growth Coef. Std. Err. t P>|t| [95% Conf. Interval]tradeshare 1.882807 1.475292 1.28 0.207 -1.071415 4.837029ly 2.524742 .6736203 3.75 0.000 1.175841 3.873644rev_coups -2.35021 1.012683 -2.32 0.024 -4.378073 -.3223463assasinations .2242049 .435902 0.51 0.609 -.6486738 1.097084lr -1.641397 .4017843 -4.09 0.000 -2.445956 -.8368374tly -.6900855 1.075573 -0.64 0.524 -2.843883 1.463712_cons 11.49852 2.959949 3.88 0.000 5.57132 17.425715.gen t2= tradeshare* tradeshare. gen t3= tradeshare* t2. regress growth tradeshare t2 t3 ly rev_coups assasinations lrSource SS df MS Number of obs = 64 F( 7, 56) = 7.13 Model 97.8981719 7 13.9854531 Prob > F = 0.0000 Residual 109.909988 56 1.96267836 R-squared = 0.4711 Adj R-squared = 0.4050 Total 207.80816 63 3.29854222 Root MSE = 1.401growth Coef. Std. Err. t P>|t| [95% Conf. Interval]tradeshare -5.701945 9.755116 -0.58 0.561 -25.24379 13.8399 t2 8.487876 17.43505 0.49 0.628 -26.43872 43.41448 t3 -2.759735 9.249782 -0.30 0.767 -21.28927 15.76981 ly 2.133188 .3669534 5.81 0.000 1.398092 2.868284 rev_coups -2.035454 1.025946 -1.98 0.052 -4.09067 .0197616 assasinations .1021111 .4435059 0.23 0.819 -.7863379 .9905601 lr -1.584348 .4079428 -3.88 0.000 -2.401556 -.7671405 _cons 12.92906 3.098466 4.17 0.000 6.722087 19.136031.散点图----------twoway (scatter growth yearsschool)2.预测growth回归1预测Growth 的增长为0.243×(6-4)=0.486回归2预测Growth 的增长为1.016×(ln6-ln4)=0.412。

相关主题