Speed Cameras: Revenue or Public Safety? We'll get you up to speed in a Flash!

Posted on Jan 14, 2015

Goals and Introduction

Are speed cameras a tool increase safety? Or a revenue grab by local governments plugging budget deficits? With the implementation of a speed camera program in NYC and inspired by the excellent work at “I Quant NY” I decided to parse through the data and look for the answer. Two questions pervade this issue and are the focus of this analysis:

1. Are the speed cameras distributed in order to maximize public safety or revenue?

2. Have the speed cameras demonstrated any relationship with pedestrian/vehicle collision reduction?

The legislation allowing speed cameras purports to protect school-aged children by reducing pedestrian/vehicle collisions. The legislation requires cameras to operate within 1/4 mile of a school building and only during “school hours”. Consistent with this goal we would expect cameras to be distributed in areas of unusually high school density to protect the maximum amount of school children per camera. Another distribution strategy consistent with public safety would be to have the cameras distributed in areas known to have a higher than average vehicle/pedestrian collision rate. If speed camera deployment deviates from these distributions we will conclude public safety was not the primary goal of the speed camera program. Then the central premise that speed cameras increase public safety will be examined. We can compare the collision rate after the cameras were installed with the same period 1 year before camera installation. Conflicting conclusions are reported in the literature and many studies examine only speed reduction and many overlook the fundamental measure of safety, the collision rate. The speed camera data were only published from 1/16/2014 – 6/20/2014 at the time of this analysis so collision data will be compared with the prior year over the same period of time, 1/16/2013 - 6/20/2013. Only pedestrian/vehicle collisions will be analyzed as is consistent with the stated legislative goal of protecting school children and their assumption that speed cameras are an effective tool for reducing these collisions.

Data sets

School.Loc Dataset:

Speed.Cam Dataset:

Accidents Dataset:

The first set of code demonstrates how NYC school locations were geocoded with the ggmap package. Due to a large number of duplicate intersections the Speed Camera data set needed to be condensed manually. Unwanted directionality (i.e. NB, SB, EB, WB) and overlapping ranges of intersections where tickets were issued (the ticket locations are coded as the street on which the ticket was issued and a range of intersecting streets) made recoding the data manually necessary. Over 80 locations were condensed to 56 intersections. Afterward the locations were geocoded in a similar fashion.

School.Loc$Address = paste(School.Loc$Address,", New York, NY", sep="", collapse = NULL)
School.LonLat = geocode(School.Loc$Address)
School.Loc = cbind(School.Loc, School.LonLat)
                            Address       lon      lat
1       309 47 STREET, New York, NY -73.98793 40.76086
2 655 PARKSIDE AVENUE, New York, NY -73.95146 40.65639
3 50 JEFFERSON AVENUE, New York, NY -73.95520 40.68229
4  820 HANCOCK STREET, New York, NY -73.92321 40.68560
5    43 SNYDER AVENUE, New York, NY -73.95605 40.64900
6  858 JAMAICA AVENUE, New York, NY -73.87311 40.68967

Revenue or Safety: The Camera Distribution in NYC

The locations of the cameras were plotted with the size of the bubble representing the log of the number of tickets the camera at that location issued. As shown, Brooklyn and Queens have the highest number of cameras and the highest grossing cameras are in these boroughs on long 6 or 8-lane roadways with timed traffic lights (e.g. Queens and Northern Blvds).

cam.mapnycmap = get_map('New York City')
cam.map = ggmap(nycmap, extent='device', legend = 'topleft')+geom_point(aes(x=lon, y=lat, color = 'red', size = log(count)), data=Cam)+scale_color_discrete('Cameras')


To understand if these speed cameras were distributed to increase school children's safety the camera map was overlayed with the locations of NYC grade, middle, and high schools (represented as black dots). As shown, the highest density of schools is in Manhattan and the Bronx, two of the boroughs with fewer speed cameras. Clearly the cameras were not distributed to maximize the safety of school children.

SchoolMapschool.map = ggmap(nycmap, extent='device')+geom_point(aes(x=lon, y=lat, color = 'red', size = log(count)), data=Cam)+
geom_point(aes(x=lon,y=lat, size = 0.2), data= School.Loc)+theme(legend.position='none')

Perhaps the speed cameras were deployed to increase the safety of ALL pedestrians. To explore this hypothesis the camera map was overlayed with the density of pedestrian/vehicle collisions in NYC in 2013, the year prior to camera installation. Vehicle/pedestrian collisions occur most frequently in Manhattan, a borough with fewer cameras. This suggests that the largest potential impact would be made by placing the majority, if not all, of the speed cameras in Manhattan, not the outer boroughs. In fact, Brooklyn and Queens have a similar number of pedestrian/vehicle collisions as Manhattan (see below) but Brooklyn and Queens are 3 and 4X larger indicating that if speed cameras reduce pedestrian/vehicle collisions Brooklyn and Queens would require 3 and 4X more cameras than Manhattan to reduce accidents by the same number.


g = plot(ggmap(nycmap)+geom_point(aes(x=lon, y=lat, size = log(count), color = 'red'), data= Cam)+

theme(axis.text.x=element_blank(), axis.text.y=element_blank(), axis.title.x=element_blank(),axis.title.y=element_blank(),legend.position='none')+

stat_density2d(aes(x=Lon, y=Lat, fill = ..level.., alpha=..level..), geom='polygon', data=Accidents.lastyear))+scale_fill_gradient(limits=c(1:60))

After discovering that camera placement is not designed to maximize the safety of either school-aged children or pedestrians a revenue focus was considered. By NYS law,

speed camera placement is only allowed within 1/4 mile from any school building. The placement of a camera outside that radius may indicate city officials are attempting to maximize revenue by issuing more tickets and betting residents will not contest the ticket's legality. To investigate, the most profitable camera was selected and its

distance to the nearest 3 schools was computed.


filter(Cam, count>10000)
                            Address count       lon      lat
1 Queens Blvd & 58th St, Queens, NY 11528 -73.90751 40.74186
maxtix.map = get_map(location = c(lon = -73.90751, lat = 40.74186), zoom = 15)
ggmap(maxtix.map)+geom_point(aes(x=lon, y = lat, size = log(count), color='red'), data = Cam)+geom_point(aes(x=lon, y =lat, size = 2), data = School.Loc)+
theme(legend.position='none', axis.text.x=element_blank(), axis.text.y=element_blank(), axis.title.x=element_blank(),axis.title.y=element_blank())
maxtix.schools = filter(School.Loc, lat < 40.750 & lat >40.730 & lon < -73.895 & lon > -73.922)
                              Address       lon      lat
1 54-25 SKILLMAN AVENUE, New York, NY -73.90914 40.74553
2       46-02 47 AVENUE, New York, NY -73.91867 40.74084
3         67-25 51 ROAD, New York, NY -73.89721 40.73449
> mapdist(from = c(lon = -73.90751, lat = 40.74186), to = maxtix.schools$Address)
                                       from                                  to    m    km     miles seconds  minutes      hours
1 46-1 58th Street, Woodside, NY 11377, USA 54-25 SKILLMAN AVENUE, New York, NY  690 0.690 0.4287660     106 1.766667 0.02944444
2 46-1 58th Street, Woodside, NY 11377, USA       46-02 47 AVENUE, New York, NY 1223 1.223 0.7599722     166 2.766667 0.04611111
3 46-1 58th Street, Woodside, NY 11377, USA         67-25 51 ROAD, New York, NY 1792 1.792 1.1135488     235 3.916667 0.06527778

Note the camera's location, situated on an 8-lane roadway with timed traffic lights just two blocks from the nearest exit on the Brooklyn-Queens Expressway. Visually, the camera location looks close to the school on 55th St & Skillman Ave. However, the computed distance is > 1/10 of a mile outside the legally allowed distance. This is a clear sign of a revenue strategy. After examining the distribution of speed cameras safety was clearly NOT the primary goal of this program. Revenue concerns seemed to have outweighed maximizing pedestrian safety. However, if cameras DO prevent pedestrian/vehicle collision they may still be useful, even though they are deployed in sub-optimal intersections. This is the focus of the next section.

Efficacy of Speed Cameras in Pedestrian/Vehicle Collisions

First we will examine the effect of the speed camera program city-wide and then proceed to analyze the differential effect the speed camera program has had on each borough. The data shows ~10% reduction in traffic accidents city-wide after camera installation in the period from Jan 16 - Jun 20 2014 over the same time period in 2013. Traffic accident data is only available on NYC Open Data as far back as Aug 2012. Pedestrian/vehicle collsions over 5 month intervals were summed from Aug 2012 - Jun 2014 and visualized in a line plot (Dec 2013 was not included due to interval size). The trend is apparent, pedestrian/vehicle collisions were decreasing before the installation of the speed cameras and continue to decline at the same rate after installation. Fatal accidents also declined during the same 5 month period, from 57 in 2013 to 39 in 2014. This is not surprising given the decline in accidents overall.


ggplot(x,aes(x=Date,y=Accidents))+geom_line()+geom_point()+ylab('Pedestrian Vehicle Accidents') +theme_bw()+xlab('')


If speed cameras are associated with reduced pedestrian/vehicle collisions we would expect the frequency of collisions around a camera to decrease much more rapidly than in

areas without cameras. Each camera should "carve out" a spot from the accident density if they significantly reduce the rate of accidents. The pedestrian/vehicle accident

density from 2013 (left) is shown next to the density after camera installation in 2014 (right). The shape of density profile is almost exactly the same, strong evidence

that cameras do not influence the frequency of pedestrian/vehicle collisions.


Camera Impact by Borough

While there isn't any association of cameras with pedestrian accident frequency city-wide perhaps the boroughs with the most cameras have experienced a reduction in accidents that is "masked" in aggregate by increases in accidents in boroughs with fewer speed cameras. The following script summed the number of cameras in each borough and the number of tickets from all cameras in each borough. I then created a contingency table by merging the data with accident numbers from the Accidents data frame. The contingency table of tabulations is shown below.

camandtixsum = function(x){ y = data.frame() for (i in 1:length(x)){ y[i,1] = length(grep(x[i], Cam$Address)) y[i,2] = sum(Cam$count[grep(x[i], Cam$Address)]) } y = cbind(y, x) return(y) } byBorough = camsum(c("Brooklyn","Staten Island","Queens","New York","Bronx"))
byBorough Borough Cameras Tickets Peds.Killed2014 Peds.Injured2014 Peds.Killed2013 Peds.Injured2013 1 STATEN ISLAND 8 7505 2 112 1 153 2 BRONX 7 5216 3 646 9 728 3 MANHATTAN 8 10479 6 1140 12 1238 4 QUEENS 13 35985 10 866 16 934 5 BROOKLYN 18 25628 15 1405 13 1561

Using these data the impact of the cameras on each borough was visualized. The first plot shows the change in the number of pedestrians killed in vehicle collisions by

borough prior to and after camera installation. The size of each bubble in 2014 represents the number of tickets residents received. The number of cameras and tickets

appear to have no relationship with the number of fatal accidents. The Bronx had the largest %decline in fatal accidents but has the fewest cameras and tickets. Brooklyn

residents received the the second highest number of tickets and have the most cameras of any borough but was the only borough to see its numbers increase in 2014. Pearson's X-squared test provided additional evidence that cameras are not associated with the rate of fatal collisions (X-squared = 4.4056, df = 4, p = 0.3539).


ggplot(mBorough[mBorough$variable == 'Injured',], aes(x=Borough, y=value))+ylab("Number of Pedestrians Injured")+geom_point(aes(color=factor(Year), size = Tickets))+
geom_line(aes(group=Year, color=Year))+ theme(axis.text.x = element_text(angle = 50))+scale_color_discrete(name='Year')

A similar analysis was conducted with collisions that were not fatal, each borough shows a decline consistent with the 10% overall decline already noted as compared to

2013. However, the accident rates decline similarly for each borough. If the speed cameras did prevent collisions we would expect to see a much more dramatic decline in

Brooklyn and Queens, the two boroughs with the most speed cameras and highest number of tickets issued. Again, Pearson's X-squared test was not significant (X-squared = 3.1445, df = 4, p = 0.5339).



In the first 6 months of operation the speed camera program has justified the transfer of 4.2 million in wealth from NYC citizens to local government coffers. The program appears to be revenue focused as the camera locations fail to conform to distributions that would optimize pedestrian safety. Additionally, it appears that at least one camera operates outside the boundaries allowed by law further corroborating this conclusion. Furthermore, this study has found no evidence that speed cameras reduce collisions as suggested by the government entities and speed camera vendors. Months after the speed camera program debuted NYC lowered its speed limit by an additional 5MPH. This has also been interpreted as a revenue maximizing strategy which may result to a transfer of wealth in excess of $12M from citizens in 2015.

About Author

Related Articles

Leave a Comment

تحميل افلام October 15, 2017
Hi,I log on to your blog named "Speed Cameras: Revenue or Public Safety? We'll get you up to speed in a Flash! - NYC Data Science Academy BlogNYC Data Science Academy Blog" on a regular basis.Your writing style is witty, keep up the good work! And you can look our website about تحميل افلام.
Dave Leonard March 10, 2015
Fantastic analysis! Heard your interview on The Data Skeptic podcast. You should contact Stephen Dubner at the Freakonomics Podcast at WNYC and share this with him! I think this would be a great podcast for his show as well!
James Casatelli February 26, 2015
You should send this to all the news outlets in NYC.

View Posts by Categories

Our Recent Popular Posts

View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python python machine learning python scrapy python web scraping python webscraping Python Workshop R R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp