Which New Yorkers are not licensing their dogs?

Posted on Oct 22, 2018

The Data

All dog owners in New York City are required by law to license their dogs. Through NYC Open Data, the Department of Mental Health and Hygiene provides a data set of active Dog Licenses from 2016 to 2017. This data set provides 14 features on 122K observations of registered dogs. Some features include:

  • User-provided dog name (unless specified otherwise)
  • Animal gender
  • Month and year dog was born
  • Dog breed
  • Owner Borough
  • Owner zip code

Analysis

I represented this data set with a interactive geographic visualization that shows the density of dogs per zip code. This was achieved by using a leaflet widget to represent zip codes as polygons on a map of New York running on a Shiny app. The polygons accompanied with census data was retrieved from NYC Open Data in the form of a shape file. The color of the polygons represent the relative population density of the dogs in that zip code, light yellow being the least densely populated zip codes and dark red being the most densely populated. The widget allows for the user to interact with the map by clicking on the zip codes to receive information about that area population of dogs. For each zip code, it shows the total number of dogs, the population, the most common breed, and the most common dog name.

From the heat map style representation the user can quickly tell approximately how densely populated each of New York’s zip code is with dogs. The map also shows the population density of dogs per capita. This changes the distribution of colors to be more uniform as most zip codes have about average dogs per capita, while some zip codes with a smaller population size over have a relatively high number of dogs. Notice Battery Park and the Financial District in darker colors below:

The same information of the previous two maps can also be presented in a histogram where each bar is the frequency of dogs for each zip code colored by borough and the dark points represent the number of dogs per capita (100K people).

The web app also allows the user to select a breed to represent a population density map relative to a particular breed. A word cloud will also be generated with the most frequent names for that breed. Yet another area of the web app involves statistical information on the diversity of breeds by borough. See the top ten dog breed for Brooklyn below.

Findings

With the data provided, I was able to run a simulation to find the zip codes with the most under registered dogs for their population size. I ran a sample simulation the same size as the number of registered dogs in the data set relative to a probability distribution derived from each zip code’s population size. Iterating this sample simulation ten thousand times produced an expected value for the population of dogs in each zip code and the Shiny app was able to represent this information graphically. The zip codes with a larger number of registered dogs than the expected value are represented in light yellow, while the zip codes with far fewer registered dogs than the expected value are in dark red. You can tell that Brooklyn, Queens and the Bronx likely have higher density of unregistered dogs than Manhattan and Staten Island. I am confident this statistical method could be used by NYC Department of Mental Health and Hygiene to find which zip codes are the least likely to register their dogs.

About Author

Leave a Comment

Your email address will not be published. Required fields are marked *

No comments found.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags