*
* Dougherty, Introduction to Econometrics, 4th ed
* Example from Section 5.2
* Dummy variables
*
open data schools.xls
data(format=xls,org=columns) 1 74 cost n occ regular tech worker voc gen res
*
linreg cost
# constant n
linreg cost
# constant occ n
linreg cost
# constant tech worker voc n
*
exclude(title="Test of school categories")
# tech worker voc
*
* Change in reference category
*
linreg cost
# constant n tech voc gen
*
* Dummy variable trap. RATS detects the problem and zeros out the coefficient and
* standard error on the final one of the dummies.
*
linreg cost
# constant tech worker voc gen n
*
* Full set of dummies without CONSTANT
*
linreg cost
# tech worker voc gen n
*
* Multiple sets of dummies
*
linreg cost
# constant occ res n
*
set nonresreg = %if(regular.and..not.res,cost,%na)
set nonresocc = %if(occ.and..not.res,cost,%na)
set resreg = %if(regular.and.res,cost,%na)
set resocc = %if(occ.and.res,cost,%na)
*
* There don't seem to be any data points with REGULAR and RES
*
scatter(footer="Figure 5.4 Cost functions for residential and nonresidential schools in Shanghai") 3
# n nonresreg
# n nonresocc
# n resocc