{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Crime and Policing Expenditures Descriptive Analysis\n", "\n", "In this exercise we'll be examining the relationship between crime and policing expenditures using county-level data from Massachusetts. " ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Exercise 1\n", "\n", "Begin by downloading the data for this exercise from https://github.com/nickeubank/MIDS_Data/blob/master/descriptive_exercise/crime_expend_MA.csv (just go to `github.com/nickeubank/MIDS_Data`, then go to `descriptive_exercise` and get `crime_expend_MA.csv` if you don't want to type all that).\n" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Exercise 2\n", "\n", "This data includes monthly data on both each county's policing expenditures (`policeexpenditures` as share of county budget) and an index of crime (`crimeindex`, scaled 0-100) from 1990 to late 2001. \n", "\n", "In these exercises, we'll be focusing on just two counties -- `county_code` 4 and 10. \n", "\n", "First, for each of these two counties, calculate the mean expenditure level and mean crimeindex score (i.e. calculate both means separately for each county). \n", "\n", "Just to make sure we're practicing applied skills—use a loop to calculate your means and print your results nicely! So you should get output like this (though obviously with different numbers—I'm not gonna give you the answer!):\n", "\n", "```\n", "for county 4, average policing expenditure is 23.7 and average crime index is 75.83\n", "for county 10, average policing expenditure is 62.15 and average crime index is 55.88\n", "```" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Exercise 3\n", "\n", "Now calculate the standard deviation of both expenditures and crime for these two counties." ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Exercise 4\n", "\n", "Now calculate the correlation between `policeexpenditures` and `crimeindex` for both of these counties (again, output the correlations with nicely formatted and labelled statements!)" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Exercise 5\n", "\n", "Based on your results up to this point, what would you guess about whether policing reduces crime? (I know -- this is just a descriptive statistics, and correlation does not imply causality. But what would you infer if this was all you knew?" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Exercise 6\n", "\n", "Given what you've seen up till now, would you infer that county 4 and county 10 have a similar relationship between crime and police expenditures?" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Exercise 7\n", "\n", "Now plot histograms of `policeexpenditures` for both county 4 and county 10. Do the results change you impression of the similarity of county 4 and county 10?" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "## Exercise 8\n", "\n", "Finally, create a scatter plot of the relationship between crime and police expenditures for each county (e.g. crime on one axis, police expenditures on the other). Does this change your sense of how similar these are?" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## After you have answered...\n", "\n", "Read this [discussion page](discussion_descriptive.ipynb).\n" ] } ], "metadata": { "kernelspec": { "display_name": "base", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.8 | packaged by conda-forge | (main, Nov 22 2022, 08:25:29) [Clang 14.0.6 ]" }, "vscode": { "interpreter": { "hash": "718fed28bf9f8c7851519acf2fb923cd655120b36de3b67253eeb0428bd33d2d" } } }, "nbformat": 4, "nbformat_minor": 4 }