Described as the most comprehensive analysis of its kind to date, and drawing from roughly 260 million standardized-test scores from close to 10,000 U.S. school districts, the study looked at data from seven school years, starting in the fall of 2008. Overall the analysis found that, while girls maintain their edge in reading regardless of their geographic location, they either tend to significantly outperform or significantly lag behind boys in math.

“We set out saying that some districts are going to have more stereotypical gender achievement gaps—larger math gaps favoring boys, larger reading gaps favoring girls—and others that are maybe less stereotypical,” said Erin Fahle, who co-authored the study and earns her Ph.D. in education policy from Stanford this month. “Instead what we found was that districts tend to advantage boys or advantage girls.”

At the other end of the affluence spectrum, a near-opposite phenomenon is playing out: In poor communities of color, namely those where families are predominantly black or Latino, girls on average outperformed boys in math by one-fifth of a grade level, in addition to significantly outperforming them in reading. The new study lends credence to claims that boys in low-income black or Hispanic districts deserve some of the closest attention as policymakers, educators, and parents strive to eliminate gender disparities. “We focus so much on female children’s opportunities in STEM, which is really important and has a large potential economic consequence,” Fahle said. “But we also have to realize that boys’ opportunities are constrained by gender, too.”

The researchers couldn’t draw definitive conclusions from the data as to what explains these dueling phenomena, but they came up with various hypotheses that they hope future studies will examine. One theory: Wealthy areas where men are typically the main or sole breadwinners may implicitly or even explicitly promote the message that math is for boys. Another factor could be that gender stereotypes are inadvertently bolstered in wealthy families when parents respond to, say, a son’s early interest in robots, or a girl’s early interest in dress-up by paying to send the former to an after-school science club or the latter to a theater class. As an example, Fahle cited a study that analyzed the conversations of a sample of families as they observed a science exhibit at a museum. While parents were equally likely to talk to their sons and daughters about the exhibit, they were three times more likely to explain the science to the boys.

“It may be easier for parents to reinforce stereotypical patterns in affluent places because they have more money to do so,” explained Reardon, the study’s lead author, in a statement. “In less affluent places parents can’t spend the same kind of money and, therefore, may not reinforce those patterns as much.”