Is Minneapolis 'happier' than Boston?

So, this is a terrible title, but do let me explain. Recently, a close friend recently forwarded me the "happy city index" rankings. His contention was that Minneaplis, which is a 'gold' ranked city, is better than Boston, which is a 'silver' ranked city. I thought I would dig in a bit as it's an interesting dataset and give some thoughts.

What is the Happy City Index?

The Happy City Index ranks cities based on happiness-related factors like education, inclusive policies, economy, mobility, environmental protection, and access to green areas. It emphasizes that happiness varies greatly by demographic and that no single city can be deemed the happiest. Instead, it highlights a group of cities committed to enhancing residents' quality of life. Rankings and detailed scores for numerous cities are provided annually.

The index methods are somewhat opaque and, to be honest, I am extremely skeptical of Boston's ratings. In particular, the lower economic and mobility scores are a little surprising. However, I'm not about to entirely redo their analysis (although I'm occasionally super vindictive, so I reserve the right to do so in the future). That said, let's add in some additional data to rationalize and offer another angle to the Minneapolis superiority argument.

All the happiness are belong to us

Here's the location and 'rank' for the American cities. Madison is bronze, which is suprising. There's a lot of silber on the east coast, in general. Also, salt lake city is a kind of a shock, as well, but I'll refrain from commenting my thoughts on why.

Ok. That's cool and all, but I'm curious. What if we were to look at gun violence as a category?

To do so, let's create a density plot using the location and mass shooting statistics to see if we think differently. Data is available for download from the Gun Violence Archive.

NOTE: I'm only grabbing mass shootings across the US in whatever order the Gun Violence Archive people think is appropriate. Also, I'm limiting myself to ~2000 incidents in total, because while I like messing with my friends, it's not worth eating up too much money geocoding locations.

Play with these to tweak the viz. Slide the thresholds to '0' to see the location of each event.

Aggregated Data by City

Ok. So, despite that this chart is quite quantitative, it's somehow unsatisfying for understanding a direct comparison in violence between cities. Noting that the populaton differences between these two metropolitan areas is relatively similar:

Now, it's likely that I didn't grab all the data from the gun violence archive (I only did the most recent 2000 incidents), but it does appear that things are not trending super well for Minneapolis in comparison to Boston this year.

Let's take a look at how our two cities are stacking up over time.

Ouch. Minneapolis definetly leads Boston in Mass shootings with respect to victims injured, killed, and suspects injured. I will note that boston does lead in suspects arresed and injured, but somehow that seems less terrible...but only slightly.

I'll note further that I could have calculated this per capita, but the reality is that I think this would make it look even worse for Minneapolis, as it has a lower population and worse mass shooting stats than Boston.

Conclusion

I'll admit that it's not an overwhelming win for Boston re: mass shootings and gun violence, Boston definetly does win in the "mass shooting" category. The fact that I even have to consider this makes me physically ill. I want off this American timeline or we'll end up in the Star Wars universe instead of the Star Trek universe.

Methods

Most of the methods are available by inspecting the js associated with this github repo's markdown.

For those of you who were interested in how I was using the GoogleAPI to automate geocoding of locations. Here's my full AppScript (sans my API key).

var apiKey = "YOURAPIKEY"; // Replace with your actual API key
var cache = CacheService.getScriptCache();

function GOOGLEMAPS_LATLONG(address, city, state) {
  var fullAddress = address + ", " + city + ", " + state + ", USA";
  var cached = cache.get(fullAddress);
  if (cached) {
    return JSON.parse(cached);
  } else {
    try {
      var response = UrlFetchApp.fetch(
        "https://maps.googleapis.com/maps/api/geocode/json?address=" +
          encodeURIComponent(fullAddress) +
          "&key=" +
          apiKey
      );
      var json = JSON.parse(response.getContentText());
      if (json.status == "OK" && json.results.length > 0) {
        var lat = json.results[0].geometry.location.lat;
        var lng = json.results[0].geometry.location.lng;
        var result = [lat, lng];
        cache.put(fullAddress, JSON.stringify(result), 21600); // Cache for 6 hours
        return result;
      } else {
        return ["Not Found", "Not Found"];
      }
    } catch (e) {
      return ["Error", "Error"];
    }
  }
}

In the google sheet, and assuning that address is in Column A and city is in Column B, and state is in Column C, you can extract the latitude and longitude as such:

  • Latitude: =INDEX(GOOGLEMAPS_LATLONG(A1, B1, C1), 1)
  • Longitude: =INDEX(GOOGLEMAPS_LATLONG(A1, B1, C1), 2)