------------------------------------------------------------------------------- log: d:\bill\fall2008\econ30331\attendance.log log type: text opened on: 29 Aug 2008, 09:54:08 . . * read in baseball data . * wins and attendance for 2003 season . use attendance . . * dscribe data . desc Contains data from attendance.dta obs: 30 vars: 3 28 Aug 2008 15:25 size: 810 (99.9% of memory free) ------------------------------------------------------------------------------- storage display value variable name type format label variable label ------------------------------------------------------------------------------- team str13 %13s team city attendance long %12.0g avg attendance per game wins int %8.0g wins during year ------------------------------------------------------------------------------- Sorted by: . . * get means of wins and payroll . sum wins attendance Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- wins | 30 80.83333 14.75334 55 103 attendance | 30 28157.3 9317.7 10031 43712 . . * get correlation coefficient . corr wins attendance (obs=30) | wins attend~e -------------+------------------ wins | 1.0000 attendance | 0.4909 1.0000 . . * get detailed data for attendance . sum attendance, detail avg attendance per game ------------------------------------------------------------- Percentiles Smallest 1% 10031 10031 5% 10038 10038 10% 15169.5 13157 Obs 30 25% 20703 17182 Sum of Wgt. 30 50% 28934.5 Mean 28157.3 Largest Std. Dev. 9317.7 75% 34527 39494 90% 39828.5 40163 Variance 8.68e+07 95% 43323 43323 Skewness -.2430352 99% 43712 43712 Kurtosis 2.256339 . . * run simple regression . reg attendance wins Source | SS df MS Number of obs = 30 -------------+------------------------------ F( 1, 28) = 8.89 Model | 606784507 1 606784507 Prob > F = 0.0059 Residual | 1.9110e+09 28 68249360.1 R-squared = 0.2410 -------------+------------------------------ Adj R-squared = 0.2139 Total | 2.5178e+09 29 86819537.6 Root MSE = 8261.3 ------------------------------------------------------------------------------ attendance | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- wins | 310.0473 103.9825 2.98 0.006 97.04894 523.0457 _cons | 3095.14 8539.507 0.36 0.720 -14397.25 20587.53 ------------------------------------------------------------------------------ . . * output predicted attendance . predict pred_att, xb . . list team wins attendance pred_att +--------------------------------------------+ | team wins attend~e pred_att | |--------------------------------------------| 1. | Seattle 93 43712 31929.54 | 2. | New York-AL 103 43323 35030.02 | 3. | Baltimore 67 33122 23868.31 | 4. | Boston 93 32717 31929.54 | 5. | Cleveland 74 32308 26038.64 | |--------------------------------------------| 6. | Texas 72 29405 25418.55 | 7. | Anaheim 99 28464 33789.83 | 8. | Oakland 103 26788 35030.02 | 9. | Minnesota 94 23759 32239.59 | 10. | Chicago--AL 81 20703 28208.97 | |--------------------------------------------| 11. | Toronto 78 20221 27278.83 | 12. | Detroit 55 18795 20147.74 | 13. | Kansas City 62 17182 22318.07 | 14. | Tampa Bay 55 13157 20147.74 | 15. | San Francisco 95 40163 32549.64 | |--------------------------------------------| 16. | Arizona 98 39494 33479.78 | 17. | Los Angeles 92 38657 31619.5 | 18. | St. Louis 97 37176 33169.73 | 19. | New York-NL 75 35959 26348.69 | 20. | Chicago--NL 67 34527 23868.31 | |--------------------------------------------| 21. | Colorado 73 33800 25728.6 | 22. | Atlanta 101 32142 34409.92 | 23. | Houston 84 31078 29139.12 | 24. | San Diego 66 27415 23558.26 | 25. | Milwaukee 56 24311 20457.79 | |--------------------------------------------| 26. | Cincinnati 78 23197 27278.83 | 27. | Pittsburgh 72 22591 25418.55 | 28. | Philadelphia 80 20484 27898.93 | 29. | Florida 79 10038 27588.88 | 30. | Montreal 83 10031 28829.07 | +--------------------------------------------+ . . * predict residuals . predict res_att, residuals . . * show that the mean of the . * residuals is zero . sum res_att Variable | Obs Mean Std. Dev. Min Max -------------+-------------------------------------------------------- res_att | 30 .00012 8117.631 -18798.07 11782.46 . . * shows that the residuals . * are uncorrelated with x . corr res_att wins (obs=30) | res_att wins -------------+------------------ res_att | 1.0000 wins | 0.0000 1.0000 . . log close log: d:\bill\fall2008\econ30331\attendance.log log type: text closed on: 29 Aug 2008, 09:54:09 -------------------------------------------------------------------------------