搜索
人大经济论坛 附件下载

附件下载

所在主题:
文件名:  Can online learning bend the higher education cost curve.pdf
资料下载链接地址: https://bbs.pinggu.org/a-1928637.html
附件大小:
478.44 KB   举报本内容
今天读论文,学习作者的原代码。该论文是用stata做的数据,其中有一块不是很明白。已经标红,请各位帮忙解释解释。
  1. *Table 2 - Are Prices Lower When More Students Are Enrolled Online?*
  2. foreach x in pub nonpub {
  3. xi: reg log_tuit share_alldist share_somedist i.year log_enroll `covs' if `x', robust
  4. outreg2 using price_online, keep(share_alldist share_somedist) alpha(0.01, 0.05, 0.10) bracket nocons excel dec(3)
  5. xtset cbsa
  6. xi: xtreg log_tuit share_alldist share_somedist i.year log_enroll `covs' if `x'==1, fe vce(cluster cbsa)
  7. outreg2 using price_online, keep(share_alldist share_somedist) alpha(0.01, 0.05, 0.10) bracket nocons excel dec(3)
  8. xtset opeid_year_group
  9. xi: xtreg log_tuit share_alldist share_somedist i.year log_enroll `covs' if `x'==1, fe vce(cluster opeid_year_group)
  10. outreg2 using price_online, keep(share_alldist share_somedist) alpha(0.01, 0.05, 0.10) bracket nocons excel dec(3)
  11. }
复制代码
`covs' if `x'及下面对应的几个是什么意思呢?

不知道为什么do文件上传失败,贴在这里吧:
  1. /*

  2. Replication file for Deming, Goldin, Katz and Yuchtman. "Can Online Education Bend the Higher Education Cost Curve?"
  3. American Economic Review: Papers & Proceedings, 105(5): 496-501.

  4. We provide a cleaned data set for replication. To replicate from the raw IPEDS files, here are the steps:

  5. Start by obtaining raw csv files from the IPEDS website
  6. They can be found here - http://nces.ed.gov/ipeds/datacenter/DataFiles.aspx
  7. The site includes stata do files for reading csv into .dta format and labeling vars.
  8. For tables 1 and 2, only 2012 and 2013 data are necessary.
  9. Download the following files - hd2012, efa2012 and efa2012_dist - same for 2013.
  10. Add local and state unemployment rate data from the BLS - http://www.bls.gov/lau/#data.
  11. Finally, add data from the 2009 Barron's college rankings, merging on unitid.
  12. */
  13. cd "YOUR DIR HERE"
  14. use DGKY_online_replication, clear

  15. drop if opeflag==5 | opeflag==6
  16. keep if year==2012 | year==2013
  17. drop if cyactive!=1
  18. drop if sector==0
  19. gen type_cat=type
  20. replace type_cat=6 if type_cat==5
  21. replace type_cat=5 if type_cat==4
  22. replace type_cat=4 if type_cat==3
  23. replace type_cat=3 if type_cat==2 & (sector==4 | sector==7)

  24. *replace tot variable with enroll_UGdegseek - small number of institutions that didnt' respond to distance ed survey - all FPs*
  25. *assume zero online enrollment*
  26. replace tot=enroll_UGdegseek if tot==.
  27. foreach x in alldist somedist nodist {
  28. gen share_`x'=`x'/tot
  29. }
  30. foreach x in alldist_instate alldist_outstate alldist_outUS {
  31. gen share_`x'=`x'/alldist
  32. }

  33. *Table 1 - Enrollment in Online Courses by Undergraduate, Degree-Seeking US Students 2013*
  34. *Divide percentages in first three columns by fourth column to get totals*
  35. tabstat alldist somedist nodist tot if year==2013, by(type_cat) s(sum)
  36. *Divide percentages in first three columns by fourth column to get totals*
  37. tabstat alldist_instate alldist_outstate alldist_outUS alldist if year==2013, by(type_cat) s(sum)

  38. *Set up for price regressions*
  39. gen log_enroll=ln(tot)
  40. gen log_tuit=ln(statetuit)
  41. gen log_charge=ln(hrchg2)

  42. *geographic FE use CBSA, CSA, county - results don't change that much*
  43. *for chain results, use first 5 digits of opeid*
  44. gen length=length(opeid)
  45. gen temp1="0"
  46. gen temp2="00"
  47. egen temp3=concat(temp1 opeid) if length==7
  48. egen temp4=concat(temp2 opeid) if length==6
  49. gen opeid_string=temp3 if length==7
  50. replace opeid_string=temp4 if length==6
  51. replace opeid_string=opeid if length==8

  52. gen opeid_6=substr(opeid_string,1,6)
  53. egen opeid_year_group=group(opeid_6 year sector)

  54. set more off
  55. local covs "i.sector i.type_cat i.iclevel i.control i.hloffer i.deggrant i.locale unemp_rate miss_unemp i.barrons_rank_2009 i.admcon1 i.admcon2 i.admcon3 i.admcon4 i.admcon5 i.admcon6 i.admcon7 i.admcon8 i.admcon9 i.openadmp satpct- actwr75 satpct_miss- actwr75_miss"
  56. gen nonpub=nfp==1 | fp==1

  57. *Table 2 - Are Prices Lower When More Students Are Enrolled Online?*
  58. foreach x in pub nonpub {
  59. xi: reg log_tuit share_alldist share_somedist i.year log_enroll `covs' if `x', robust
  60. outreg2 using price_online, keep(share_alldist share_somedist) alpha(0.01, 0.05, 0.10) bracket nocons excel dec(3)
  61. xtset cbsa
  62. xi: xtreg log_tuit share_alldist share_somedist i.year log_enroll `covs' if `x'==1, fe vce(cluster cbsa)
  63. outreg2 using price_online, keep(share_alldist share_somedist) alpha(0.01, 0.05, 0.10) bracket nocons excel dec(3)
  64. xtset opeid_year_group
  65. xi: xtreg log_tuit share_alldist share_somedist i.year log_enroll `covs' if `x'==1, fe vce(cluster opeid_year_group)
  66. outreg2 using price_online, keep(share_alldist share_somedist) alpha(0.01, 0.05, 0.10) bracket nocons excel dec(3)
  67. }


  68. /*
  69. For Figure 1, need trend data going back to 2000.
  70. Pull the following IPEDS files (in addition to files from 2000-2011:
  71. hd (directory variables
  72. efa (enrollment - note file is by race and gender but just use overall)
  73. ic_ay - (tuition and fees - note some schools report tuition by program rather than overall. when overall tuition is missing, replace with tuition of most common program)

  74. Merge these files on unitid and year.
  75. */

  76. use DGKY_online_replication, clear

  77. *Create indicator variable for online schools, based on having more than 50% of students enrolled in exclusively distance education in 2012*
  78. *Backcast after that for years with no distance education data*

  79. gen share_alldist= alldist/ tot if year==2012
  80. gen temp=share_alldist>0.5 & share_alldist!=.
  81. bysort unitid: egen online=max(temp)
  82. drop temp
  83. *drop very competitive or higher, using Barron's rankings*
  84. drop if barrons_rank>=1 & barrons_rank<=3
  85. *Restrict to active, Title IV eligible institutions*
  86. keep if cyactive==1
  87. keep if opeflag==1

  88. *Fix an obvious mistake in U Phoenix tuition variable - in 2001, data was reported as the total cost of a 4 year degree instead of per-year tuition cost*
  89. *This typically happens when tuition is reported at the program level*
  90. *Ideally would not use this variable, but then tuition is missing for many for-profits and not evenly by year*
  91. *Price goes from around $15k to $63k in a single year, and then back down*
  92. *Solution is to divide by four*
  93. gen phoenix=regexm(instnm, "University Of Phoenix")
  94. replace statetuit=statetuit/4 if phoenix==1 & year==2001

  95. *Fix a small number of other similar mistakes - dividing by four or two, as appropriate*
  96. *Issue is that tuition is inconsistently reported at program vs. school level*
  97. *These fixes are conservative - needs to be almost exactly 4x or 2x tuition in years right around*
  98. *This is an art, not a science!*
  99. replace statetuit=statetuit/4 if unitid==102845 & year>=2002 & year<=2003
  100. replace statetuit=statetuit/2 if unitid==438601 & year>=2001 & year<=2002
  101. replace statetuit=statetuit/4 if unitid==438601 & year>=2003 & year<=2004
  102. replace statetuit=statetuit/4 if unitid==448628 & year==2006
  103. replace statetuit=statetuit/2 if unitid==121275 & year>=2003 & year<=2004
  104. replace statetuit=statetuit/2 if unitid==234216 & year>=2002 & year<=2003
  105. replace statetuit=statetuit/4 if unitid==234216 & year>=2004 & year<=2009
  106. replace statetuit=statetuit/4 if unitid==142054 & year>=2004 & year<=2005
  107. replace statetuit=statetuit/2 if unitid==197832 & year>=2002 & year<=2004
  108. replace statetuit=statetuit/2 if unitid==440925 & year>=2002 & year<=2003
  109. replace statetuit=statetuit/2 if unitid==441061 & year>=2003 & year<=2005
  110. replace statetuit=statetuit/2 if unitid==262305 & year>=2003 & year<=2005
  111. replace statetuit=statetuit/2 if unitid==436474 & year>=2003 & year<=2004
  112. replace statetuit=statetuit/2 if unitid==260813 & year>=2000 & year<=2004
  113. replace statetuit=statetuit/2 if unitid==432834 & year>=2003 & year<=2009
  114. replace statetuit=statetuit/2 if unitid==260789 & year>=2003 & year<=2009
  115. replace statetuit=statetuit/4 if unitid==437848 & year==2002
  116. replace statetuit=statetuit/2 if unitid==135939 & year>=2004 & year<=2005
  117. replace statetuit=statetuit/2 if unitid==103893 & year>=2000 & year<=2001

  118. *adjust for inflation, expressing in 2014 dollars, using http://data.bls.gov/cgi-bin/cpicalc.pl*
  119. replace statetuit=statetuit*1.37 if year==2000
  120. replace statetuit=statetuit*1.34 if year==2001
  121. replace statetuit=statetuit*1.32 if year==2002
  122. replace statetuit=statetuit*1.29 if year==2003
  123. replace statetuit=statetuit*1.25 if year==2004
  124. replace statetuit=statetuit*1.21 if year==2005
  125. replace statetuit=statetuit*1.17 if year==2006
  126. replace statetuit=statetuit*1.14 if year==2007
  127. replace statetuit=statetuit*1.10 if year==2008
  128. replace statetuit=statetuit*1.10 if year==2009
  129. replace statetuit=statetuit*1.09 if year==2010
  130. replace statetuit=statetuit*1.05 if year==2011
  131. replace statetuit=statetuit*1.03 if year==2012
  132. replace statetuit=statetuit*1.02 if year==2013

  133. gen cat=1 if online==1 & pub!=1 & (barrons_rank==5 | barrons_rank==.)
  134. replace cat=2 if online!=1 & (barrons_rank==5 | barrons_rank==.) & (sector==2 | sector==3)
  135. replace cat=3 if sector==1

  136. collapse (mean) statetuit [w=enrollFTUG], by(cat year)
  137. drop if cat==.
  138. forvalues y=1(1)3 {
  139. gen temp=statetuit if cat==`y'
  140. bysort year: egen statetuit_`y'=max(temp)
  141. drop temp
  142. }
  143. drop cat statetuit
  144. duplicates drop
  145. tsset year

  146. *Figure 1 - Trends in Tuition by Institution Type*
  147. tsline statetuit_1 statetuit_2 statetuit_3
复制代码




    熟悉论坛请点击新手指南
下载说明
1、论坛支持迅雷和网际快车等p2p多线程软件下载,请在上面选择下载通道单击右健下载即可。
2、论坛会定期自动批量更新下载地址,所以请不要浪费时间盗链论坛资源,盗链地址会很快失效。
3、本站为非盈利性质的学术交流网站,鼓励和保护原创作品,拒绝未经版权人许可的上传行为。本站如接到版权人发出的合格侵权通知,将积极的采取必要措施;同时,本站也将在技术手段和能力范围内,履行版权保护的注意义务。
(如有侵权,欢迎举报)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

GMT+8, 2026-1-9 07:58