Code for analysis in the Mode Analytics blog