data538 <- read.csv('https://raw.githubusercontent.com/fivethirtyeight/data/master/hate-crimes/hate_crimes.csv')
data538=data538[c(1,7,10)]
head(data538)
## state share_white_poverty share_voters_voted_trump
## 1 Alabama 0.12 0.63
## 2 Alaska 0.06 0.53
## 3 Arizona 0.09 0.50
## 4 Arkansas 0.12 0.60
## 5 California 0.09 0.33
## 6 Colorado 0.07 0.44
plot(fitted(trumppoverty), resid(trumppoverty))
abline(h=0)
mean(resid(trumppoverty))
## [1] -6.114581e-19
There is no apparent trend in the residuals and the average of the residuals is very close to zero.
qqnorm(resid(trumppoverty))
qqline(resid(trumppoverty))
The q-q plot of the residuals shows that the residuals are nearly normal.
Since the p value is low, the residuals are nearly normal, and the average of the residuals is about zero, we can say that there is a linear relationship between the proportion of Trump voters in a state and the proportion of white residents living in poverty and it follows the following trend: Trump_Voters = .2463 + 2.6554xShare_of_White_Residents_Living_in_Poverty