*
* Dougherty, Introduction to Econometrics, 4th ed
* Example from Section 1.4
* Simple linear regression
*
open data eaef21c.xls
data(format=xls,org=columns) 1 540 id female male ethblack ethhisp ethwhite age s educprof educphd educmast $
educba educaa educhsd educdo single married divorced faithn faithp faithc faithj faitho asvab01 asvab02 $
asvab03 asvab04 asvab05 asvab06 asvabc height weight85 weight02 sm sf siblings library pov78 earnings $
hours tenure exper collbarg catgov catpri catse urban regne regnc regw regs
*
linreg earnings
# constant s
*
* The HMIN and VMIN aren't common options, but are needed to get the regression
* line extended to 0 on the X-axis to demonstrate what the regression line looks
* like well outside the observed data.
*
scatter(style=dots,hmin=0.0,vmin=-15.0,lines=%beta,$
footer="Figure 1.7 A Simple Earnings Function")
# s earnings
*
* Adjusted regression using deviation from mean for S
* The intercept differs slightly from the text because this uses the
* full-precision sample mean, rather than 13.67 which is rounded.
*
diff(center) s / sdev
linreg earnings
# constant sdev