1
$\begingroup$

I have gathered criminal activity and GDP from 2012 to 2015 for over 30 countries and I'm trying to confirm my hypothesis about how higher GDP decreases criminal activity, but I'm baffled over which type of graph I should choose.

I can't use a regular plot, because I'd have too many lines... I'd like one axis to represent the GDP and one for criminal activity, however I don't where I'd fit the years (if that's even necessary).

I'm using Python for this, so something from matplotlib would be preffered

$\endgroup$
5
  • 1
    $\begingroup$ Please tell us what information you are trying to convey with your graph and who your audience might be. What are the format and quantity of your data? Could you give a small example? What do you mean by a "regular plot," by the way? $\endgroup$ – whuber Jun 3 '15 at 22:34
  • $\begingroup$ It's a school project. I'm trying to confirm my hypothesis about how higher gdp decreases criminal activity. I got data for 34 countries, from 2005-2012. I'd like if one axis would represent the gdp and one criminal activity, however I don't where I'd fit the years(if that's even necessary) . I meant it as a line that connects the points $\endgroup$ – jabk Jun 3 '15 at 22:47
  • $\begingroup$ Good! Please include that information in the post itself (you can edit it). Be cautious about how you use these data, though: they won't confirm any causal hypothesis at all. (If they could, I would be able to use the same technique to "confirm" hypotheses such as artificial satellites in earth orbit cause autism: both have been going up at remarkable rates, in parallel, for over half a century.) $\endgroup$ – whuber Jun 3 '15 at 22:51
  • $\begingroup$ Thank you for the guidance. What do you suggest, cross validation? $\endgroup$ – jabk Jun 3 '15 at 23:07
  • 2
    $\begingroup$ @TheGuyWithStreetCred no, that won't help you prove causality. To show that $X$ causes $Y$, you need to demonstrate 1) that $Y$ does not cause $X$, and 2) that the relationship between $X$ and $Y$ is not confounded by some other variable $Z$. Since you have data over time, you can get some leverage by "lagging" $X$, or finding natural changes in $X$ that you know are not caused by $Y$, such as GDP collapsing due to a recession. The latter technique is used in "regression discontinuity" models. $\endgroup$ – shadowtalker Jun 3 '15 at 23:23
4
$\begingroup$

This is a great use case for small multiples. You would have a grid of 34 plots, one for each country. Put GDP on the horizontal axis of each plot, and criminal activity on the vertical axis. If you wanted to show trends over time, you could put time on the horiztonal axis, and then have two vertical axes: one for GDP and one for criminal activity. Each plot would then contain two time series.

Alternatively, you could forget about country and year entirely. Just plot criminal activity against GDP: this will show you if there is an overall trend across time and space. You could also make a separate scatterplot for each year, since you only have three years.

Asking about code specifically is off-topic here, but it's doable in matplotlib:

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.