The residuals of crime

June 3, 2011

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

Real-estate search website Trulia has a new tool to help you in your choice of a new home: crime maps. With local police forces being much better about sharing data crime maps are nothing new, but Trulia takes it to the next level with a slick user interface for navigating US cities, a beautiful heat-map visualization of crime hot-spots and — most importantly — regularly updated data. 

There's one particularly neat aspect of the design that I want to focus on. The heat-map around our own neighbourhood in San Francisco reveals it to be less of a hot-spot than I'd expected (parts of Dogpatch are kinda rough and industrial). So it's particularly interesting to see the "More" and "Less" indicators showing the ways our locale differs from the city as a whole: 


Dogpatch (it's called "Central Waterfront" in Trulia for some reason) has more thefts than you'd expect of San Francisco as a whole, but fewer assaults. Not only does that match with my own intuitions, it's also a great example of pulling key, relevant data from a statistical model. (Incidentally, Trulia uses R for statistical modeling.) Sometimes, it's not the raw predictions from the model that are the most interesting thing — I already know what my neighbourhood is like. As in this case, it's often the deviations from the model (what statisticians call the residuals) that you care about the most. When things differ from what you expect after you've taking into account the effect of all the variables in your model, that's when it's time to take notice, and learn.

Trulia: Crime Maps

To leave a comment for the author, please follow the link and comment on their blog: Revolutions. offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...

If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Tags: ,

Comments are closed.

Search R-bloggers


Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)