--- title: "Olympics" author: "Chris Parrish" date: "January 16, 2016" output: pdf_document --- Olympics references: - Cannon, et al., Stat2, chapter 01, example 1.8 - [Bob Beamon, 1968 Mexico City Olympic Games, YouTube](https://www.youtube.com/watch?v=DEt_Xgg8dzc) - [model diagnostics for regression](http://www.stat.columbia.edu/~martin/W2024/R7.pdf) Import the data. ```{r} data <- read.csv("LongJumpOlympics.csv", header=TRUE) head(data, 4) dim(data) ``` View the data. ```{r fig.width=6, fig.height=4.2} plot(Gold ~ Year, data=data, pch=20, col="darkred") olympics.lm <- lm(Gold ~ Year, data=data) abline(olympics.lm, col="orange") ``` Linear model. \$\widehat{Gold} =\$ `r round(coef(olympics.lm)[1], 3)` + `r round(coef(olympics.lm)[2], 3)` \$Year\$ ```{r} olympics.lm ``` Residuals. ```{r} plot(fitted(olympics.lm), resid(olympics.lm), pch=20, col="darkred") abline(h=0, col="orange", lty="dashed") ``` 1968 residual. ```{r} y.1968 <- data[data\$Year==1968, "Gold"] y.1968 new.data <- data.frame(Year=1968) y.hat.1968 <- predict(olympics.lm, new.data) y.hat.1968 residual.1968 <- as.numeric(y.1968 - y.hat.1968) residual.1968 ``` Studentized residuals. ```{r} studentized.residuals <- rstudent(olympics.lm) studentized.residuals[16] plot(studentized.residuals, pch=20, col="darkred") abline(h=c(2, 1, -1, -2), col="orange", lty="dashed") ```