Relationship Between Personal Crime and Average Temperatures in Pittsburgh, PA: Is Mother Nature our Greatest Crimefighter?

Research Question

This analysis looks at the relationship between the amount of personal crime and average temperatures in the city of Pittsburgh. Studies have shown that higher temperatures can lead to higher numbers of violent crimes in an area. I was particularly
curious about this relationship in light of the unseasonably warm weather that most of the East Coast enjoyed for the winter of 2015-2016. Using data gathered
from the Western PA Regional Data Center and the National Climatic Data Center, I sought to first provide a visual illustration of the average daily temperatures
plotted against the total number of personal crimes (assaults, public drunkenness, etc), as shown in the graph below. Average temperature for each day was calculated
by taking the maximum temperature for that day and the minimum temperature for that day and finding the average. As you can see, there appears to be a strong
correlation between the two variables.

Regression Analysis of Personal Crime vs. Average Temperature

In order to show that there was in fact a relationship between the two variables, I then imported the dataset into the R programming language and conducted a
regression analysis, the results of which can be found below. The output shows that for every one degree increase in temperature, there is an increase of 0.72 in the number
of personal crimes that are committed. This relationship is extremely statistically significant, with a p-value of 2.2e-16.

Coefficients:

(Intercept): 10.37627

Intercept p-value: 0.0242

Personal.Crime Coeff: 0.72492

Personal.Crime Coeff p-value: < 2.2e-16

Residual standard error: 15.46 on 349 degrees of freedom

Multiple R-squared: 0.2159

Adjusted R-squared: 0.2137

F-statistic: 96.11 on 1 and 349 DF

Relationship Between Property Crime vs. Average Temperature

I was curious to see if the same relationship held true for the number of property crimes committed (burglary, graffiti, etc) and the average temperature.
As you can see below, the relationnship is not as defined as the relationship between personal crime illustrated above.

Visualizing the Relationship Using D3

The graph below, constructed using the D3 library, shows the number of daily personal crimes committed and the coloring of the bar chart is based on the
average temperature of that day. It is also interactive if you hover over the bars. All temperatures are in degrees Fahrenheit. Note: Some data for personal daily crimes committed were missing from the database.

Magenta: Extremely Cold (Less than 32)

Blue: Cold (32-50)

Yellow: Moderate (50-60)

Orange: Warm (60-75)

Red: Extremely Warm (Greater than 75)

The temperature range was from 8.69 degrees (2/14) to 81.5 degrees (7/18) with an average annual temperature of 54.6 degrees.

Additional Analysis of Regression Outputs

This scatterplot plots the points of average daily temperature and number of personal crimes and includes the line of best fit with a 95% confidence band around the line. As you can see,
there is a positive relationship between the two variables (which we previously showed in regression above).

Outliers

I included this graph because it provides additional narrative to the study of crimes. One can see that the residuals vs. leverage graph, which allows
a researcher to identify outliers that may be influencing their model, is quite compact in this example (indicating that most points follow the same relationship
between temperature and number of crimes committed). However, there is one point (labeled as "291") that is an extreme
outlier on the righthand side of this graph. In this case, it's because on this day it was particularly warm (50 degrees) but crimes were extremely low. Why might that be? The day was Christmas, an important
reminder that crime can be influenced by a lot of factors, both natural occurrences like temperature or even holidays.