Choose a graph from one of the prior check-in assignments and make it look nice here. You should make sure that the axes are clearly labeled (including units if needed), the graph has a title, it does not have the gray background, and you include color.
## Warning in geom_histogram(mapping = aes(x = YEAR), fill = "purple", color =
## "white", : Ignoring unknown parameters: `bidwith`
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
Crime went up in 2016 and 2017, and crime went down in the year 2018. The data-set we provided does not lend itself for analysis for this project.
Choose two of your numerical variables (or one can be a date) to analyze with a regression. First, you will make a scatter plot with these variables below.
##
## Call:
## lm(formula = crime$YEAR ~ crime$MONTH)
##
## Coefficients:
## (Intercept) crime$MONTH
## 2017.3318 -0.1167
Does it look like these variables have a linear relationship? Yes, there appears to be a correlation, crime appears to slow down in 2018.
Calculate the Pearson coefficient below to measure how close the data is to linear.
##
## Pearson's product-moment correlation
##
## data: crime$YEAR and crime$MONTH
## t = -234.45, df = 319071, p-value < 2.2e-16
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.3863067 -0.3803869
## sample estimates:
## cor
## -0.3833507
Now, copy your scatter plot code into the chunk below and add a regression line by adding this code to it: stat_smooth(method = lm, color=“darkorchid4”)
## `geom_smooth()` using formula = 'y ~ x'
It appears that the reggression line has a negative relationship with the amount of crime over time. Crime rates went down.