伍德里奇计量经济学第四章
- 格式:pdf
- 大小:142.44 KB
- 文档页数:8
伍德里奇计量经济学第四章name:log: /Users/wangjianying/Desktop/Chapter 4 Computer exercise.smcl log type: smclopened on: 25 Oct 2016, 22:20:411. do "/var/folders/qt/0wzmrhfd3rb93j2h5hhtcwqr0000gn/T//SD1945 6.000000"2. ****************************Chapter 4***********************************3. **C14. use "/Users/wangjianying/Documents/data of wooldridge/stata/VOTE1.DTA"5. desContains data from /Users/wangjianying/Documents/data of wooldridge/stata/VOTE1.DTA obs: 173vars: 10 25 Jun 1999 14:07size: 4,498storage display valuevariable name type format label variable labelstate str2 %9s state postal codedistrict byte %3.0f congressional districtdemocA byte %3.2f =1 if A is democratvoteA byte %5.2f percent vote for AexpendA float %8.2f camp. expends. by A, $1000sexpendB float %8.2f camp. expends. by B, $1000sprtystrA byte %5.2f % vote for presidentlexpendA float %9.0g log(expendA)lexpendB float %9.0g log(expendB)shareA float %5.2f 100*(expendA/(expendA+expendB)) Sorted by:6. reg voteA lexpendA lexpendB prtystrASource SS df MS Number of obs = 173F( 3, 169) = 215.23 Model 38405.1096 3 12801.7032 Prob > F = 0.0000Residual 10052.1389 169 59.480112 R-squared = 0.7926Adj R-squared = 0.7889 Total 48457.2486 172 281.728189 Root MSE = 7.7123voteA Coef. Std. Err. t P>|t| [95% Conf. Interval] lexpendA 6.083316 .38215 15.92 0.000 5.328914 6.837719 lexpendB -6.615417 .3788203 -17.46 0.000 -7.363246 -5.867588 prtystrA .1519574 .0620181 2.45 0.015 .0295274 .2743873 _cons 45.07893 3.926305 11.48 0.000 37.32801 52.829857. gen cha=lexpendB-lexpendA // variable cha is a new variable//8. reg voteA lexpendA cha prtystrASource SS df MS Number of obs = 173F( 3, 169) = 215.23 Model 38405.1097 3 12801.7032 Prob > F = 0.0000Residual 10052.1388 169 59.4801115 R-squared = 0.7926Adj R-squared = 0.7889 Total 48457.2486 172 281.728189 Root MSE = 7.7123 voteA Coef. Std. Err. t P>|t| [95% Conf. Interval] lexpendA -.532101 .5330858 -1.00 0.320 -1.584466 .5202638 cha -6.615417 .3788203 -17.46 0.000 -7.363246 -5.867588prtystrA .1519574 .0620181 2.45 0.015 .0295274 .2743873_cons 45.07893 3.926305 11.48 0.000 37.32801 52.829859. clear10.11. **C312. use "/Users/wangjianying/Documents/data of wooldridge/stata/hprice1.dta"13. desContains data from /Users/wangjianying/Documents/data of wooldridge/stata/hprice1.dta obs: 88vars: 10 17 Mar 2002 12:21size: 2,816storage display valuevariable name type format label variable labelprice float %9.0g house price, $1000sassess float %9.0g assessed value, $1000sbdrms byte %9.0g number of bdrmslotsize float %9.0g size of lot in square feetsqrft int %9.0g size of house in square feetcolonial byte %9.0g =1 if home is colonial stylelprice float %9.0g log(price)lassess float %9.0g log(assessllotsize float %9.0g log(lotsize)lsqrft float %9.0g log(sqrft)Sorted by:14. reg lprice sqrft bdrmsSource SS df MS Number of obs = 88F( 2, 85) = 60.73 Model 4.71671468 2 2.35835734 Prob > F = 0.0000Residual 3.30088884 85 .038833986 R-squared = 0.5883Adj R-squared = 0.5786 Total 8.01760352 87 .092156362 Root MSE = .19706 lprice Coef. Std. Err. t P>|t| [95% Conf. Interval] sqrft .0003794 .0000432 8.78 0.000 .0002935 .0004654bdrms .0288844 .0296433 0.97 0.333 -.0300543 .0878232_cons 4.766027 .0970445 49.11 0.000 4.573077 4.95897815. gen cha=sqrft-150*bdrms16. reg lprice cha bdrmsSource SS df MS Number of obs = 88F( 2, 85) = 60.73 Model 4.71671468 2 2.35835734 Prob > F = 0.0000Residual 3.30088884 85 .038833986 R-squared = 0.5883Adj R-squared = 0.5786 Total 8.01760352 87 .092156362 Root MSE = .19706lprice Coef. Std. Err. t P>|t| [95% Conf. Interval] cha .0003794 .0000432 8.78 0.000 .0002935 .0004654 bdrms .0858013 .0267675 3.21 0.002 .0325804 .1390223 _cons 4.766027 .0970445 49.11 0.000 4.573077 4.95897817. clear18.19. **C520. use "/Users/wangjianying/Documents/data of wooldridge/stata/MLB1.DTA"21. desContains data from /Users/wangjianying/Documents/data of wooldridge/stata/MLB1.DTA obs: 353vars: 47 16 Sep 1996 15:53size: 45,537storage display valuevariable name type format label variable labelsalary float %9.0g 1993 season salaryteamsal float %10.0f team payrollnl byte %9.0g =1 if national leagueyears byte %9.0g years in major leaguesgames int %9.0g career games playedatbats int %9.0g career at batsruns int %9.0g career runs scoredhits int %9.0g career hitsdoubles int %9.0g career doublestriples int %9.0g career tripleshruns int %9.0g career home runsrbis int %9.0g career runs batted inbavg float %9.0g career batting averagebb int %9.0g career walksso int %9.0g career strike outssbases int %9.0g career stolen basesfldperc int %9.0g career fielding perc frstbase byte %9.0g = 1 if first base scndbase byte %9.0g =1 if second base shrtstop byte %9.0g =1 if shortstop thrdbase byte %9.0g =1 if third base outfield byte %9.0g =1 if outfieldcatcher byte %9.0g =1 if catcheryrsallst byte %9.0g years as all-starhispan byte %9.0g =1 if hispanicblack byte %9.0g =1 if blackwhitepop float %9.0g white pop. in city blackpop float %9.0g black pop. in city hisppop float %9.0g hispanic pop. in city pcinc int %9.0g city per capita income gamesyr float %9.0g games per year in league hrunsyr float %9.0g home runs per year atbatsyr float %9.0g at bats per yearallstar float %9.0g perc. of years an all-star slugavg float %9.0g career slugging average rbisyr float %9.0g rbis per yearsbasesyr float %9.0g stolen bases per yearrunsyr float %9.0g runs scored per yearpercwhte float %9.0g percent white in citypercblck float %9.0g percent black in cityperchisp float %9.0g percent hispanic in cityblckpb float %9.0g black*percblckhispph float %9.0g hispan*perchispwhtepw float %9.0g white*percwhteblckph float %9.0g black*perchisphisppb float %9.0g hispan*percblcklsalary float %9.0g log(salary)Sorted by:22. reg lsalary years gamesyr bavg hrunsyrSource SS df MS Number of obs = 353F( 4, 348) = 145.24 Model 307.800674 4 76.9501684 Prob >F = 0.0000 Residual 184.374861 348 .52981282 R-squared =0.6254Adj R-squared = 0.6211 Total 492.175535 352 1.39822595 Root MSE = .72788lsalary Coef. Std. Err. t P>|t| [95% Conf. Interval] years .0677325 .0121128 5.59 0.000 .0439089 .091556 gamesyr .0157595 .0015636 10.08 0.000 .0126841 .0188348 bavg .0014185 .0010658 1.33 0.184 -.0006776 .0035147 hrunsyr .0359434 .0072408 4.96 0.000 .0217021 .0501847 _cons 11.02091 .2657191 41.48 0.000 10.49829 11.5435323. reg lsalary years gamesyr bavg hrunsyr runsyr fldperc sbasesyrSource SS df MS Number of obs = 353F( 7, 345) = 87.25 Model 314.510478 7 44.9300682 Prob > F = 0.0000 Residual 177.665058 345 .514971181 R-squared =0.6390Adj R-squared = 0.6317 Total 492.175535 352 1.39822595 Root MSE = .71761lsalary Coef. Std. Err. t P>|t| [95% Conf. Interval] years .0699848 .0119756 5.84 0.000 .0464305 .0935391 gamesyr .0078995 .0026775 2.95 0.003 .0026333 .0131657 bavg .0005296 .0011038 0.48 0.632 -.0016414 .0027007 hrunsyr .0232106 .0086392 2.69 0.008 .0062185 .0402027 runsyr .0173922 .0050641 3.43 0.001 .0074318 .0273525 fldperc .0010351 .0020046 0.52 0.606 -.0029077 .0049778 sbasesyr -.0064191 .0051842 -1.24 0.216 -.0166157 .0037775 _cons 10.40827 2.003255 5.20 0.000 6.468139 14.348424. test bavg fldperc sbasesyr( 1) bavg = 0( 2) fldperc = 0( 3) sbasesyr = 0F( 3, 345) = 0.69Prob > F = 0.561725. clear26. **C727. use "/Users/wangjianying/Documents/data of wooldridge/stata/twoyear.dta"28. sum phsrankVariable Obs Mean Std. Dev. Min Maxphsrank 6763 56.15703 24.27296 0 9929. reg lwage jc totcoll exper phsrankSource SS df MS Number of obs = 6763F( 4, 6758) = 483.85 Model 358.050568 4 89.5126419 Prob >F = 0.0000 Residual 1250.24552 6758 .185002297 R-squared =0.2226Adj R-squared = 0.2222 Total 1608.29609 6762 .237843255 Root MSE = .43012 lwage Coef. Std. Err. t P>|t| [95% Conf. Interval] jc -.0093108 .0069693 -1.34 0.182 -.0229728 .0043512 totcoll .0754756 .0025588 29.50 0.000 .0704595 .0804918 exper .0049396 .0001575 31.36 0.000 .0046308 .0052483 phsrank .0003032 .0002389 1.27 0.204 -.0001651 .0007716 _cons 1.458747 .0236211 61.76 0.000 1.412442 1.50505230. reg lwage jc univ exper idSource SS df MS Number of obs = 6763F( 4, 6758) = 483.42 Model 357.807307 4 89.4518268 Prob >F = 0.0000 Residual 1250.48879 6758 .185038293 R-squared =0.2225Adj R-squared = 0.2220 Total 1608.29609 6762 .237843255 Root MSE = .43016 lwage Coef. Std. Err. t P>|t| [95% Conf. Interval] jc .0666633 .0068294 9.76 0.000 .0532754 .0800511univ .0768813 .0023089 33.30 0.000 .0723552 .0814074exper .0049456 .0001575 31.40 0.000 .0046368 .0052543id 1.14e-07 2.09e-07 0.54 0.587 -2.97e-07 5.24e-07_cons 1.467533 .0228306 64.28 0.000 1.422778 1.51228831. reg lwage jc totcoll exper idSource SS df MS Number of obs = 6763F( 4, 6758) = 483.42 Model 357.807307 4 89.4518267 Prob > F = 0.0000Residual 1250.48879 6758 .185038293 R-squared = 0.2225 Adj R-squared = 0.2220 Total 1608.29609 6762 .237843255 Root MSE = .43016 lwage Coef. Std. Err. t P>|t| [95% Conf. Interval] jc -.010218 .0069366 -1.47 0.141 -.023816 .00338totcoll .0768813 .0023089 33.30 0.000 .0723552 .0814074exper .0049456 .0001575 31.40 0.000 .0046368 .0052543id 1.14e-07 2.09e-07 0.54 0.587 -2.97e-07 5.24e-07_cons 1.467533 .0228306 64.28 0.000 1.422778 1.51228832. clear33. **C934. use "/Users/wangjianying/Documents/data of wooldridge/stata/discrim.dta"35. desContains data from /Users/wangjianying/Documents/data of wooldridge/stata/discrim.dta obs: 410vars: 37 8 Jan 2002 22:26size: 47,150storage display valuevariable name type format label variable labelpsoda float %9.0g price of medium soda, 1st wavepfries float %9.0g price of small fries, 1st wavepentree float %9.0g price entree (burger or chicken), 1st wave wagest float %9.0g starting wage, 1st wavenmgrs float %9.0g number of managers, 1st wavenregs byte %9.0g number of registers, 1st wavehrsopen float %9.0g hours open, 1st waveemp float %9.0g number of employees, 1st wavepsoda2 float %9.0g price of medium soday, 2nd wavepfries2 float %9.0g price of small fries, 2nd wavepentree2 float %9.0g price entree, 2nd wavewagest2 float %9.0g starting wage, 2nd wavenmgrs2 float %9.0g number of managers, 2nd wavenregs2 byte %9.0g number of registers, 2nd wavehrsopen2 float %9.0g hours open, 2nd waveemp2 float %9.0g number of employees, 2nd wavecompown byte %9.0g =1 if company ownedchain byte %9.0g BK = 1, KFC = 2, Roy Rogers = 3, Wendy's= 4 density float %9.0g population density, towncrmrte float %9.0g crime rate, townstate byte %9.0g NJ = 1, PA = 2prpblck float %9.0g proportion black, zipcodeprppov float %9.0g proportion in poverty, zipcodeprpncar float %9.0g proportion no car, zipcodehseval float %9.0g median housing value, zipcodenstores byte %9.0g number of stores, zipcodeincome float %9.0g median family income, zipcodecounty byte %9.0g county labellpsoda float %9.0g log(psoda)lpfries float %9.0g log(pfries)lhseval float %9.0g log(hseval)lincome float %9.0g log(income)ldensity float %9.0g log(density)NJ byte %9.0g =1 for New JerseyBK byte %9.0g =1 if Burger KingKFC byte %9.0g =1 if Kentucky Fried ChickenRR byte %9.0g =1 if Roy RogersSorted by:36. reg lpsoda prpblck lincome prppovSource SS df MS Number of obs = 401F( 3, 397) = 12.60 Model .250340622 3 .083446874 Prob > F = 0.0000Residual 2.62840943 397 .006620679 R-squared = 0.0870Adj R-squared = 0.0801 Total 2.87875005 400 .007196875 Root MSE = .08137 lpsoda Coef. Std. Err. t P>|t| [95% Conf. Interval]prpblck .0728072 .0306756 2.37 0.018 .0125003 .1331141lincome .1369553 .0267554 5.12 0.000 .0843552 .1895553prppov .38036 .1327903 2.86 0.004 .1192999 .6414201_cons -1.463333 .2937111 -4.98 0.000 -2.040756 -.885909237. corr lincome prppov(obs=409)lincome prppovlincome 1.0000prppov -0.8385 1.000038. reg lpsoda prpblck lincome prppov lhsevalSource SS df MS Number of obs = 401F( 4, 396) = 22.31 Model .529488085 4 .132372021 Prob > F = 0.0000 Residual 2.34926197 396 .00593248 R-squared = 0.1839 Adj R-squared = 0.1757 Total 2.87875005 400 .007196875 Root MSE = .07702lpsoda Coef. Std. Err. t P>|t| [95% Conf. Interval] prpblck .0975502 .0292607 3.33 0.001 .0400244 .155076 lincome -.0529904 .0375261 -1.41 0.159 -.1267657 .0207848 prppov .0521229 .1344992 0.39 0.699 -.2122989 .3165447 lhseval .1213056 .0176841 6.86 0.000 .0865392 .1560721 _cons -.8415149 .2924318 -2.88 0.004 -1.416428 -.266601939. test lincome prppov( 1) lincome = 0( 2) prppov = 0F( 2, 396) = 3.52Prob > F = 0.030440.end of do-file41. log closename:log: /Users/wangjianying/Desktop/Chapter 4 Computer exercise.smcl log type: smclclosed on: 25 Oct 2016, 22:21:04。
使用普通最小二乘法,此时最小化的残差平方和为()211niii y x β=-∑利用一元微积分可以证明,1β必须满足一阶条件()110niiii x y x β=-=∑从而解出1β为:1121ni ii nii x yxβ===∑∑当且仅当0x =时,这两个估计值才是相同的。
2.2 课后习题详解一、习题1.在简单线性回归模型01y x u ββ=++中,假定()0E u ≠。
令()0E u α=,证明:这个模型总可以改写为另一种形式:斜率与原来相同,但截距和误差有所不同,并且新的误差期望值为零。
证明:在方程右边加上()0E u α=,则0010y x u αββα=+++-令新的误差项为0e u α=-,因此()0E e =。
新的截距项为00αβ+,斜率不变为1β。
2(Ⅰ)利用OLS 估计GPA 和ACT 的关系;也就是说,求出如下方程中的截距和斜率估计值01ˆˆGPA ACT ββ=+^评价这个关系的方向。
这里的截距有没有一个有用的解释?请说明。
如果ACT 分数提高5分,预期GPA 会提高多少?(Ⅱ)计算每次观测的拟合值和残差,并验证残差和(近似)为零。
(Ⅲ)当20ACT =时,GPA 的预测值为多少?(Ⅳ)对这8个学生来说,GPA 的变异中,有多少能由ACT 解释?试说明。
答:(Ⅰ)变量的均值为: 3.2125GPA =,25.875ACT =。
()()15.8125niii GPA GPA ACT ACT =--=∑根据公式2.19可得:1ˆ 5.8125/56.8750.1022β==。
根据公式2.17可知:0ˆ 3.21250.102225.8750.5681β=-⨯=。
因此0.56810.1022GPA ACT =+^。
此处截距没有一个很好的解释,因为对样本而言,ACT 并不接近0。
如果ACT 分数提高5分,预期GPA 会提高0.1022×5=0.511。
(Ⅱ)每次观测的拟合值和残差表如表2-3所示:根据表可知,残差和为-0.002,忽略固有的舍入误差,残差和近似为零。
伍德里奇计量经济学导论摘要:I.引言- 计量经济学的定义- 计量经济学的重要性II.伍德里奇计量经济学导论的基本内容- 经济数据的收集和处理- 建立经济模型- 参数估计和假设检验- 应用计量经济学III.伍德里奇计量经济学导论的特点- 强调经济理论和统计学方法的结合- 注重对经济模型的参数估计和假设检验- 涵盖了多种计量经济学方法IV.伍德里奇计量经济学导论的应用- 政策分析- 企业决策- 经济学研究V.结论- 伍德里奇计量经济学导论的重要性- 计量经济学在实际应用中的优势正文:I.引言计量经济学是经济学的一个重要分支,它运用数学和统计学的方法,通过建立经济模型,对经济变量之间的关系进行定量分析。
伍德里奇计量经济学导论是一本关于计量经济学的经典教材,涵盖了计量经济学的基本概念、方法和应用。
II.伍德里奇计量经济学导论的基本内容伍德里奇计量经济学导论主要包括以下内容:经济数据的收集和处理、建立经济模型、参数估计和假设检验、应用计量经济学。
书中详细介绍了如何收集和处理经济数据,如何建立经济模型,以及如何进行参数估计和假设检验。
此外,书中还介绍了一些应用计量经济学的方法,例如,政策分析、企业决策和经济学研究等。
III.伍德里奇计量经济学导论的特点伍德里奇计量经济学导论的特点是强调经济理论和统计学方法的结合,注重对经济模型的参数估计和假设检验。
书中涵盖了多种计量经济学方法,例如,普通最小二乘法、最大似然估计法和矩估计法等。
此外,书中还提供了丰富的案例和应用,帮助读者理解和掌握计量经济学的方法和应用。
IV.伍德里奇计量经济学导论的应用伍德里奇计量经济学导论可以应用于政策分析、企业决策和经济学研究等多个领域。
通过运用计量经济学的方法,我们可以更好地理解经济变量之间的关系,更准确地预测未来的发展趋势,更有效地制定政策和决策。
V.结论伍德里奇计量经济学导论是一本非常重要的教材,它为读者提供了计量经济学的基本概念、方法和应用。
班级:金融学×××班姓名:××学号:×××××××C4.1 voteA=β0+β1log expendA+β2log expendB+β3prtystrA+u 其中,voteA表示候选人A得到的选票百分数,expendA和expendB分别表示候选人A和B的竞选支出,而prtystrA则是对A所在党派势力的一种度量(A所在党派在最近一次总统选举中获得的选票百分比)。
解:(ⅰ)如何解释β1?β1表示当候选人B的竞选支出和候选人A所在党派势力固定不变时,候选人A的竞选支出(expendA)增加一个百分点时,voteA将增加β1 100。
(ⅱ)用参数表述如下虚拟假设:A的竞选支出提高1% 被B的竞选支出提高1% 所抵消。
虚拟假设为H0∶β1+β2=0 ,该假设意味着A的竞选支出提高x% 被B的竞选支出提高x% 所抵消,voteA保持不变。
(ⅲ)利用VOTE1.RAW中的数据来估计上述模型,并以通常的方式报告结论。
A的竞选支出会影响结果吗?B的支出呢?你能用这些结论来检验第(ⅱ)部分中的假设吗?所以,voteA=45.0789+6.0833log expendA−6.6154log expendB+0.1520prtystrA, n=173, R2=0.7926 .由截图可得:expendA 系数β1的 t 统计量为15.9187,在很小的显著水平上都是显著的,意味着当其他条件不变时,A 的竞选支出增加1%,voteA 将增加0.0608。
同理可得,expendB 系数β2的 t 统计量为-17.4632,在很小的显著水平上都是显著的,意味着当其他条件不变时,B 的竞选支出增加1%,voteA 将增加0.066。
由于A 的竞选支出的系数β1和B 的竞选支出的系数β2符号相反,绝对值差不多,所以近似有虚拟假设“ H 0∶β1+β2=0 ”成立,即第(ⅱ)部分中的假设成立。
第1 章解决问题的办法1.1(一)理想的情况下,我们可以随机分配学生到不同尺寸的类。
也就是说,每个学生被分配一个不同的类的大小,而不考虑任何学生的特点,能力和家庭背景。
对于原因,我们将看到在第 2 章中,我们想的巨大变化,班级规模(主题,当然,伦理方面的考虑和资源约束)。
(二)呈负相关关系意味着,较大的一类大小是与较低的性能。
因为班级规模较大的性能实际上伤害,我们可能会发现呈负相关。
然而,随着观测数据,还有其他的原因,我们可能会发现负相关关系。
例如,来自较富裕家庭的儿童可能更有可能参加班级规模较小的学校,和富裕的孩子一般在标准化考试中成绩更好。
另一种可能性是,在学校,校长可能分配更好的学生,以小班授课。
或者,有些家长可能会坚持他们的孩子都在较小的类,这些家长往往是更多地参与子女的教育。
(三)鉴于潜在的混杂因素- 其中一些是第(ii)上市- 寻找负相关关系不会是有力的证据,缩小班级规模,实际上带来更好的性能。
在某种方式的混杂因素的控制是必要的,这是多元回归分析的主题。
1.2(一)这里是构成问题的一种方法:如果两家公司,说 A 和B,相同的在各方面比 B 公司à用品工作培训之一小时每名工人,坚定除外,多少会坚定的输出从 B 公司的不同?(二)公司很可能取决于工人的特点选择在职培训。
一些观察到的特点是多年的教育,多年的劳动力,在一个特定的工作经验。
企业甚至可能歧视根据年龄,性别或种族。
也许企业选择提供培训,工人或多或少能力,其中,“能力”可能是难以量化,但其中一个经理的相对能力不同的员工有一些想法。
此外,不同种类的工人可能被吸引到企业,提供更多的就业培训,平均,这可能不是很明显,向雇主。
(iii )该金额的资金和技术工人也将影响输出。
所以,两家公司具有完全相同的各类员工一般都会有不同的输出,如果他们使用不同数额的资金或技术。
管理者的素质也有效果。
(iv)无,除非训练量是随机分配。
许多因素上市部分(二)及(iii )可有助于寻找输出和培训的正相关关系,即使不在职培训提高工人的生产力。
name: <unnamed>log: /Users/wangjianying/Desktop/Chapter 4 Computer exercise.smcl log type: smclopened on: 25 Oct 2016, 22:20:411. do "/var/folders/qt/0wzmrhfd3rb93j2h5hhtcwqr0000gn/T//SD19456.000000"2. ****************************Chapter 4***********************************3. **C14. use "/Users/wangjianying/Documents/data of wooldridge/stata/VOTE1.DTA"5. desContains data from /Users/wangjianying/Documents/data of wooldridge/stata/VOTE1.DTA obs: 173vars: 10 25 Jun 1999 14:07size: 4,498storage display valuevariable name type format label variable labelstate str2 %9s state postal codedistrict byte %3.0f congressional districtdemocA byte %3.2f =1 if A is democratvoteA byte %5.2f percent vote for AexpendA float %8.2f camp. expends. by A, $1000sexpendB float %8.2f camp. expends. by B, $1000sprtystrA byte %5.2f % vote for presidentlexpendA float %9.0g log(expendA)lexpendB float %9.0g log(expendB)shareA float %5.2f 100*(expendA/(expendA+expendB)) Sorted by:6. reg voteA lexpendA lexpendB prtystrASource SS df MS Number of obs = 173F( 3, 169) = 215.23 Model 38405.1096 3 12801.7032 Prob > F = 0.0000Residual 10052.1389 169 59.480112 R-squared = 0.7926Adj R-squared = 0.7889 Total 48457.2486 172 281.728189 Root MSE = 7.7123voteA Coef. Std. Err. t P>|t| [95% Conf. Interval] lexpendA 6.083316 .38215 15.92 0.000 5.328914 6.837719 lexpendB -6.615417 .3788203 -17.46 0.000 -7.363246 -5.867588 prtystrA .1519574 .0620181 2.45 0.015 .0295274 .2743873 _cons 45.07893 3.926305 11.48 0.000 37.32801 52.829857. gen cha=lexpendB-lexpendA // variable cha is a new variable//8. reg voteA lexpendA cha prtystrASource SS df MS Number of obs = 173F( 3, 169) = 215.23 Model 38405.1097 3 12801.7032 Prob > F = 0.0000Residual 10052.1388 169 59.4801115 R-squared = 0.7926Adj R-squared = 0.7889 Total 48457.2486 172 281.728189 Root MSE = 7.7123 voteA Coef. Std. Err. t P>|t| [95% Conf. Interval]lexpendA -.532101 .5330858 -1.00 0.320 -1.584466 .5202638cha -6.615417 .3788203 -17.46 0.000 -7.363246 -5.867588prtystrA .1519574 .0620181 2.45 0.015 .0295274 .2743873_cons 45.07893 3.926305 11.48 0.000 37.32801 52.829859. clear10.11. **C312. use "/Users/wangjianying/Documents/data of wooldridge/stata/hprice1.dta"13. desContains data from /Users/wangjianying/Documents/data of wooldridge/stata/hprice1.dta obs: 88vars: 10 17 Mar 2002 12:21size: 2,816storage display valuevariable name type format label variable labelprice float %9.0g house price, $1000sassess float %9.0g assessed value, $1000sbdrms byte %9.0g number of bdrmslotsize float %9.0g size of lot in square feetsqrft int %9.0g size of house in square feetcolonial byte %9.0g =1 if home is colonial stylelprice float %9.0g log(price)lassess float %9.0g log(assessllotsize float %9.0g log(lotsize)lsqrft float %9.0g log(sqrft)Sorted by:14. reg lprice sqrft bdrmsSource SS df MS Number of obs = 88F( 2, 85) = 60.73 Model 4.71671468 2 2.35835734 Prob > F = 0.0000Residual 3.30088884 85 .038833986 R-squared = 0.5883Adj R-squared = 0.5786 Total 8.01760352 87 .092156362 Root MSE = .19706 lprice Coef. Std. Err. t P>|t| [95% Conf. Interval]sqrft .0003794 .0000432 8.78 0.000 .0002935 .0004654bdrms .0288844 .0296433 0.97 0.333 -.0300543 .0878232_cons 4.766027 .0970445 49.11 0.000 4.573077 4.95897815. gen cha=sqrft-150*bdrms16. reg lprice cha bdrmsSource SS df MS Number of obs = 88F( 2, 85) = 60.73 Model 4.71671468 2 2.35835734 Prob > F = 0.0000Residual 3.30088884 85 .038833986 R-squared = 0.5883Adj R-squared = 0.5786 Total 8.01760352 87 .092156362 Root MSE = .19706lprice Coef. Std. Err. t P>|t| [95% Conf. Interval] cha .0003794 .0000432 8.78 0.000 .0002935 .0004654 bdrms .0858013 .0267675 3.21 0.002 .0325804 .1390223 _cons 4.766027 .0970445 49.11 0.000 4.573077 4.95897817. clear18.19. **C520. use "/Users/wangjianying/Documents/data of wooldridge/stata/MLB1.DTA"21. desContains data from /Users/wangjianying/Documents/data of wooldridge/stata/MLB1.DTA obs: 353vars: 47 16 Sep 1996 15:53size: 45,537storage display valuevariable name type format label variable labelsalary float %9.0g 1993 season salaryteamsal float %10.0f team payrollnl byte %9.0g =1 if national leagueyears byte %9.0g years in major leaguesgames int %9.0g career games playedatbats int %9.0g career at batsruns int %9.0g career runs scoredhits int %9.0g career hitsdoubles int %9.0g career doublestriples int %9.0g career tripleshruns int %9.0g career home runsrbis int %9.0g career runs batted inbavg float %9.0g career batting averagebb int %9.0g career walksso int %9.0g career strike outssbases int %9.0g career stolen basesfldperc int %9.0g career fielding percfrstbase byte %9.0g = 1 if first basescndbase byte %9.0g =1 if second baseshrtstop byte %9.0g =1 if shortstopthrdbase byte %9.0g =1 if third baseoutfield byte %9.0g =1 if outfieldcatcher byte %9.0g =1 if catcheryrsallst byte %9.0g years as all-starhispan byte %9.0g =1 if hispanicblack byte %9.0g =1 if blackwhitepop float %9.0g white pop. in cityblackpop float %9.0g black pop. in cityhisppop float %9.0g hispanic pop. in citypcinc int %9.0g city per capita incomegamesyr float %9.0g games per year in leaguehrunsyr float %9.0g home runs per yearatbatsyr float %9.0g at bats per yearallstar float %9.0g perc. of years an all-starslugavg float %9.0g career slugging averagerbisyr float %9.0g rbis per yearsbasesyr float %9.0g stolen bases per yearrunsyr float %9.0g runs scored per yearpercwhte float %9.0g percent white in citypercblck float %9.0g percent black in cityperchisp float %9.0g percent hispanic in cityblckpb float %9.0g black*percblckhispph float %9.0g hispan*perchispwhtepw float %9.0g white*percwhteblckph float %9.0g black*perchisphisppb float %9.0g hispan*percblcklsalary float %9.0g log(salary)Sorted by:22. reg lsalary years gamesyr bavg hrunsyrSource SS df MS Number of obs = 353F( 4, 348) = 145.24 Model 307.800674 4 76.9501684 Prob > F = 0.0000 Residual 184.374861 348 .52981282 R-squared = 0.6254Adj R-squared = 0.6211 Total 492.175535 352 1.39822595 Root MSE = .72788lsalary Coef. Std. Err. t P>|t| [95% Conf. Interval] years .0677325 .0121128 5.59 0.000 .0439089 .091556 gamesyr .0157595 .0015636 10.08 0.000 .0126841 .0188348 bavg .0014185 .0010658 1.33 0.184 -.0006776 .0035147 hrunsyr .0359434 .0072408 4.96 0.000 .0217021 .0501847 _cons 11.02091 .2657191 41.48 0.000 10.49829 11.5435323. reg lsalary years gamesyr bavg hrunsyr runsyr fldperc sbasesyrSource SS df MS Number of obs = 353F( 7, 345) = 87.25 Model 314.510478 7 44.9300682 Prob > F = 0.0000 Residual 177.665058 345 .514971181 R-squared = 0.6390Adj R-squared = 0.6317 Total 492.175535 352 1.39822595 Root MSE = .71761lsalary Coef. Std. Err. t P>|t| [95% Conf. Interval] years .0699848 .0119756 5.84 0.000 .0464305 .0935391 gamesyr .0078995 .0026775 2.95 0.003 .0026333 .0131657 bavg .0005296 .0011038 0.48 0.632 -.0016414 .0027007 hrunsyr .0232106 .0086392 2.69 0.008 .0062185 .0402027 runsyr .0173922 .0050641 3.43 0.001 .0074318 .0273525 fldperc .0010351 .0020046 0.52 0.606 -.0029077 .0049778 sbasesyr -.0064191 .0051842 -1.24 0.216 -.0166157 .0037775 _cons 10.40827 2.003255 5.20 0.000 6.468139 14.348424. test bavg fldperc sbasesyr( 1) bavg = 0( 2) fldperc = 0( 3) sbasesyr = 0F( 3, 345) = 0.69Prob > F = 0.561725. clear26. **C727. use "/Users/wangjianying/Documents/data of wooldridge/stata/twoyear.dta"28. sum phsrankVariable Obs Mean Std. Dev. Min Maxphsrank 6763 56.15703 24.27296 0 9929. reg lwage jc totcoll exper phsrankSource SS df MS Number of obs = 6763F( 4, 6758) = 483.85 Model 358.050568 4 89.5126419 Prob > F = 0.0000 Residual 1250.24552 6758 .185002297 R-squared = 0.2226Adj R-squared = 0.2222 Total 1608.29609 6762 .237843255 Root MSE = .43012 lwage Coef. Std. Err. t P>|t| [95% Conf. Interval] jc -.0093108 .0069693 -1.34 0.182 -.0229728 .0043512 totcoll .0754756 .0025588 29.50 0.000 .0704595 .0804918 exper .0049396 .0001575 31.36 0.000 .0046308 .0052483 phsrank .0003032 .0002389 1.27 0.204 -.0001651 .0007716 _cons 1.458747 .0236211 61.76 0.000 1.412442 1.50505230. reg lwage jc univ exper idSource SS df MS Number of obs = 6763F( 4, 6758) = 483.42 Model 357.807307 4 89.4518268 Prob > F = 0.0000 Residual 1250.48879 6758 .185038293 R-squared = 0.2225Adj R-squared = 0.2220 Total 1608.29609 6762 .237843255 Root MSE = .43016 lwage Coef. Std. Err. t P>|t| [95% Conf. Interval]jc .0666633 .0068294 9.76 0.000 .0532754 .0800511univ .0768813 .0023089 33.30 0.000 .0723552 .0814074exper .0049456 .0001575 31.40 0.000 .0046368 .0052543id 1.14e-07 2.09e-07 0.54 0.587 -2.97e-07 5.24e-07_cons 1.467533 .0228306 64.28 0.000 1.422778 1.51228831. reg lwage jc totcoll exper idSource SS df MS Number of obs = 6763F( 4, 6758) = 483.42 Model 357.807307 4 89.4518267 Prob > F = 0.0000Residual 1250.48879 6758 .185038293 R-squared = 0.2225Adj R-squared = 0.2220 Total 1608.29609 6762 .237843255 Root MSE = .43016 lwage Coef. Std. Err. t P>|t| [95% Conf. Interval]jc -.010218 .0069366 -1.47 0.141 -.023816 .00338totcoll .0768813 .0023089 33.30 0.000 .0723552 .0814074exper .0049456 .0001575 31.40 0.000 .0046368 .0052543id 1.14e-07 2.09e-07 0.54 0.587 -2.97e-07 5.24e-07_cons 1.467533 .0228306 64.28 0.000 1.422778 1.51228832. clear33. **C934. use "/Users/wangjianying/Documents/data of wooldridge/stata/discrim.dta"35. desContains data from /Users/wangjianying/Documents/data of wooldridge/stata/discrim.dta obs: 410vars: 37 8 Jan 2002 22:26size: 47,150storage display valuevariable name type format label variable labelpsoda float %9.0g price of medium soda, 1st wavepfries float %9.0g price of small fries, 1st wavepentree float %9.0g price entree (burger or chicken), 1st wave wagest float %9.0g starting wage, 1st wavenmgrs float %9.0g number of managers, 1st wavenregs byte %9.0g number of registers, 1st wavehrsopen float %9.0g hours open, 1st waveemp float %9.0g number of employees, 1st wavepsoda2 float %9.0g price of medium soday, 2nd wavepfries2 float %9.0g price of small fries, 2nd wavepentree2 float %9.0g price entree, 2nd wavewagest2 float %9.0g starting wage, 2nd wavenmgrs2 float %9.0g number of managers, 2nd wavenregs2 byte %9.0g number of registers, 2nd wavehrsopen2 float %9.0g hours open, 2nd waveemp2 float %9.0g number of employees, 2nd wavecompown byte %9.0g =1 if company ownedchain byte %9.0g BK = 1, KFC = 2, Roy Rogers = 3, Wendy's = 4 density float %9.0g population density, towncrmrte float %9.0g crime rate, townstate byte %9.0g NJ = 1, PA = 2prpblck float %9.0g proportion black, zipcodeprppov float %9.0g proportion in poverty, zipcodeprpncar float %9.0g proportion no car, zipcodehseval float %9.0g median housing value, zipcodenstores byte %9.0g number of stores, zipcodeincome float %9.0g median family income, zipcodecounty byte %9.0g county labellpsoda float %9.0g log(psoda)lpfries float %9.0g log(pfries)lhseval float %9.0g log(hseval)lincome float %9.0g log(income)ldensity float %9.0g log(density)NJ byte %9.0g =1 for New JerseyBK byte %9.0g =1 if Burger KingKFC byte %9.0g =1 if Kentucky Fried ChickenRR byte %9.0g =1 if Roy RogersSorted by:36. reg lpsoda prpblck lincome prppovSource SS df MS Number of obs = 401F( 3, 397) = 12.60 Model .250340622 3 .083446874 Prob > F = 0.0000Residual 2.62840943 397 .006620679 R-squared = 0.0870Adj R-squared = 0.0801 Total 2.87875005 400 .007196875 Root MSE = .08137 lpsoda Coef. Std. Err. t P>|t| [95% Conf. Interval]prpblck .0728072 .0306756 2.37 0.018 .0125003 .1331141lincome .1369553 .0267554 5.12 0.000 .0843552 .1895553prppov .38036 .1327903 2.86 0.004 .1192999 .6414201_cons -1.463333 .2937111 -4.98 0.000 -2.040756 -.885909237. corr lincome prppov(obs=409)lincome prppovlincome 1.0000prppov -0.8385 1.000038. reg lpsoda prpblck lincome prppov lhsevalSource SS df MS Number of obs = 401F( 4, 396) = 22.31 Model .529488085 4 .132372021 Prob > F = 0.0000 Residual 2.34926197 396 .00593248 R-squared = 0.1839Adj R-squared = 0.1757 Total 2.87875005 400 .007196875 Root MSE = .07702lpsoda Coef. Std. Err. t P>|t| [95% Conf. Interval] prpblck .0975502 .0292607 3.33 0.001 .0400244 .155076 lincome -.0529904 .0375261 -1.41 0.159 -.1267657 .0207848 prppov .0521229 .1344992 0.39 0.699 -.2122989 .3165447 lhseval .1213056 .0176841 6.86 0.000 .0865392 .1560721 _cons -.8415149 .2924318 -2.88 0.004 -1.416428 -.266601939. test lincome prppov( 1) lincome = 0( 2) prppov = 0F( 2, 396) = 3.52Prob > F = 0.030440.end of do-file41. log closename: <unnamed>log: /Users/wangjianying/Desktop/Chapter 4 Computer exercise.smcl log type: smclclosed on: 25 Oct 2016, 22:21:04。