* output results to log file
log using attendance.log, replace
* read in baseball data
* wins and attendance for 2003 season
use attendance
* dscribe data
desc
* get means of wins and payroll
sum wins attendance
* get correlation coefficient
corr wins attendance
* get detailed data for attendance
sum attendance, detail
* run simple regression
reg attendance wins
* output predicted attendance
predict pred_att, xb
list team wins attendance pred_att
* predict residuals
predict res_att, residuals
* show that the mean of the
* residuals is zero
sum res_att
* shows that the residuals
* are uncorrelated with x
corr res_att wins
log close