EXERCISE 1

baseball <- read.csv(“C:/Users/katwh/Downloads/baseball.csv”)

RS_model <- lm(RS ~ OBP + SLG, data = baseball)

summary(RS_model)

new_team_1 <- data.frame( OBP = 0.361, SLG = 0.409 )

predict(RS_model, newdata = new_team_1)

830.9116

EXERCISE 2

RA_model <- lm(RA ~ OOBP + OSLG, data = baseball)

summary(RA_model)

new_team_2 <- data.frame( OOBP = 0.267, OSLG = 0.392 )

predict(RA_model, newdata = new_team_2)

527.2847