IN HIS 14 years policing the streets of Montgomery County, Maryland, Sergeant Robert Sheehan has witnessed deadly shootings and stopped big-money cannabis deals. But on a sunny afternoon it is the windows of a passing car that raise his suspicion. Maryland law dictates that car windows should be no more than 65% opaque. He stops the black Chevrolet, whose driver is female and black, and by using a special meter he proves that the car breaks that law. Debate on racial bias in policing tends to be dominated by the shootings of unarmed black men by police officers. Though terrible, such shootings are not common enough to allow the crunchers of big data sets to get to work. Routine traffic stops, on the other hand, occur about 50,000 times a day across America. They are the most common form of contact with the police: one in eight drivers was stopped in 2011.

Until recently these data have mostly been kept under lock and key. But a team of academics from Stanford University’s Open Policing project has spent two years amassing a trove of 130m traffic stops from 31 state police agencies. Their data, released this week, find that between 2011 and 2015 black drivers were stopped by the police twice as often as white drivers, suggesting that there is indeed something to the idea that “driving while black” is an offence.

Higher rates of stopping and searching are not sufficient to demonstrate that racial bias exists, though. The pool of drivers that the police might stop could be unrepresentative in all sorts of ways. Some ethnic groups might drive more than others, or perhaps there is some mysterious racial difference in driving style that leads to more police stops. To answer the question properly the late Gary Becker, a Nobel-prizewinning economist, devised a simple measure for racial bias in 1957. Becker argued that tests for racial discrimination should focus on the outcome alone: in this case whether police searches of vehicles yield contraband, such as drugs or illegal weapons. If black motorists were stopped more often, even though they were actually less likely to have something illegal in the glove compartment, that would provide solid proof of racial bias.

The Stanford data show that searches of white drivers yield contraband 32% of the time. By contrast, when the driver was black or Hispanic, the contraband hit rate was 26%. That suggests a significant amount of bias. Delve deeper, though, and the difference is caused by a small number of bad counties. Among the 496 counties for which the Stanford researchers have complete data, just 30 had a gap of more than 25 percentage points separating whites from minorities. Remove a hundred of the worst counties, and racial bias narrows from six to three percentage points. That tallies with other research on police bias. A recent working paper from graduate students at Princeton found that bias in leniency among Florida’s police officers could be explained by decisions made by one fifth of all officers.

A different way to perform Becker’s test is to look at whether drivers receive the same treatment from police when they commit the same motoring offence. An analysis by The Economist of 1m traffic stops in Montgomery County in Maryland since 2012 suggests that Hispanics are significantly more likely to receive tickets than whites or African-Americans. When stopped for running a traffic light, white and black females got a ticket 30% of the time. Hispanic men received tickets 40% of the time for the same offence. This finding tallies with data from North Carolina, where police stops recorded since 2000 show persistent bias against Hispanics.

Back in Maryland, Sergeant Sheehan smells cannabis in the blacked-out Chevrolet. A search yields a jar of it in the glove compartment. He gives a warning to the driver, then lets her young son honk the horn of his patrol car.