baseball <- read.csv("baseball.csv")
moneyball <- subset(baseball, Year < 2002)
RunsReg = lm(RS ~ OBP + SLG + BA, data=moneyball)
summary(RunsReg)
## 
## Call:
## lm(formula = RS ~ OBP + SLG + BA, data = moneyball)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -70.941 -17.247  -0.621  16.754  90.998 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  -788.46      19.70 -40.029  < 2e-16 ***
## OBP          2917.42     110.47  26.410  < 2e-16 ***
## SLG          1637.93      45.99  35.612  < 2e-16 ***
## BA           -368.97     130.58  -2.826  0.00482 ** 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 24.69 on 898 degrees of freedom
## Multiple R-squared:  0.9302, Adjusted R-squared:   0.93 
## F-statistic:  3989 on 3 and 898 DF,  p-value: < 2.2e-16
runs_scored=-804.63+2737.77*(0.361)+1584.91*(0.409)
runs_scored
## [1] 831.9332

RunsAllowedReg = lm(RA ~ OOBP + OSLG, data=moneyball) summary(RunsAllowedReg)



``` r
runs_allowed=-837.38+2913.60*(0.267)+1514.29*(0.392)
runs_allowed
## [1] 534.1529

We expect the team to allow between 534 and 535 runs. ```