About the Data

Graph

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`.

  1. What does the graph tell you about your topic? Does it tell you anything interesting?

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.

Regression

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
  1. Does it look like these variables have a linear relationship? Yes, there appears to be a correlation, crime appears to slow down in 2018.

  2. 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
  1. What is the value for Pearson’s r? What does this tell you about your data? -0.3833507 This means that the crime rate went down over time.

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'

  1. Describe the relationship between the regression line and the scatterplot.

It appears that the reggression line has a negative relationship with the amount of crime over time. Crime rates went down.