* * Example 11.6 * J. Wooldridge, Econometrics of Cross Section and Panel Data * * Note: The sample data files include all required data transformations. * However, in many cases we show how these data transformations would * be created in RATS from the basic data, as this is something you will * need to know how to do in practice. * cal(panelobs=14) 1980 all 51//14 open data prison.raw data(format=free,org=columns) / state year govelec black metro unem criv crip $ lcriv lcrip gcriv gcrip y81 y82 y83 y84 $ y85 y86 y87 y88 y89 y90 y91 y92 $ y93 ag0_14 ag15_17 ag18_24 ag25_34 incpc polpc gincpc $ gpolpc cag0_14 cag15_17 cag18_24 cag25_34 cunem cblack cmetro $ pris lpris gpris final1 final2 * set lcriv = log(criv) set lpris = log(pris) set gcriv = lcriv-lcriv{1} set gpris = lpris-lpris{1} * linreg gcriv # gpris polpc incpc black metro unem ag0_14 ag15_17 ag18_24 ag25_34 govelec $ y81 y82 y83 y84 y85 y86 y87 y88 y89 y90 y91 y92 y93 * * The following generates the set of time dummies (in case you don't have a data * set which already includes them). If you have just a few years, it's probably * easiest to define them with separate set instructions, but with 14 years, using * the vec[series] is going to be easier. Note, by the way, that this defines * dummies for each year. Because the first period is knocked out of the sample * for each individual, the first time dummy will be zero for all usable data * points. Don't worry. It will just show as a zero with zero standard error, and * won't be counted as a regressor in the summary statistics. * dec vect[series] tdummies(14) do i=1,14 set tdummies(i) = %period(t)==i end do i * * Same regression done using the tdummies vector instead of the separate dummy * variables. * linreg gcriv # gpris polpc incpc black metro unem ag0_14 ag15_17 ag18_24 ag25_34 govelec $ tdummies * * 2SLS using the two "final decision" dummies as instruments for the growth in * prison population. * instruments polpc incpc black metro unem ag0_14 ag15_17 ag18_24 ag25_34 govelec tdummies $ final1 final2 linreg(instruments) gcriv # gpris polpc incpc black metro unem ag0_14 ag15_17 ag18_24 ag25_34 govelec $ tdummies