During the Republican Convention, Democrats took every available moment of air time to count the women’s vote. “Republicans are anti-women,” they chanted.

And they frequently brought up this oft-repeated nugget: For doing essentially the same jobs, men get paid more than women. That claim is often combined with the complaint that whites get paid more than blacks and non-Hispanics get paid more than Hispanics. But are these assertions true?

Let’s take the Labor Department finding that women make 77% of what men make. To hear the backers of the Paycheck Fairness Act (PFA) tell it, this is prima facie evidence of rampant discrimination. The PFA, which died in the Senate this summer, would have piled a new set of regulations on top of a slew of previous acts outlawing discrimination. Mika Brzezinski on Morning Joe was appalled when the PFA failed to pass. “I think all you have to do is pay women as much as their male counterparts and you’re fine...why would someone have a problem with this?” she said. No one on the show that morning could give her an answer.

But there is an answer, and it’s a good one. The reason economists have trouble with the idea of rampant pay discrimination is that it defies common sense. Let’s say I own a company and I am employing only men. Is it really true that I could fire all the men, replace them with women and lower my cost of labor by 23%? If I could do that why wouldn’t I? If I were stupid enough not to do it, wouldn’t a competitor of mine do it and drive me out of business?

In other words, if workers received substantially different pay for doing the same job, an employer would have to be leaving a lot of money on the table by not hiring the lower-paid employees. (Remember, most people who believe in pay discrimination also believe most CEOs are selfish, money-grubbing sorts as well.) And it can’t just be one employer. In order for pay differentials to persist in entire industries, every employer in the market must be willing to discriminate—including the firms run by women!

June O’Neill, an economist who used to direct the Congressional Budget Office, has spent quite a lot of time looking at the data. In a brief analysis for the National Center for Policy Analysis and in an upcoming study for the American Enterprise Institute she finds that what appears like discrimination on the surface is often the result of other factors that the PFA proponents are inclined to overlook.

Take the difference in pay for black and white men. That difference narrows to just 4% after adjusting for years of schooling and it reduces to zero when you factor in test scores on the Armed Forces Qualification Test (AFQT), which is basically an intelligence test. In other words, adjusting for just two factors that cause people to be different, the pay gap between black and white men disappears entirely. Among women, the gap actually reverses after adjusting for education and AFQT scores. That is, black women get paid more than white women.

Among Hispanic and white men, the pay gap narrows to 8% after adjusting for years of schooling and disappears altogether with the addition of AFQT scores. Among the women these two variables cause the pay gap to reverse. As in the case of race, Hispanic women are actually paid somewhat more than white women.

What about men as a group versus women as a group? In addition to years of schooling and test scores, men and women differ in the amount of work they do. Men are more likely to work full-time; and among full time workers, men work 8%-10% more hours than women. Also, men typically accumulate more continuous work experience and therefore acquire higher productivity in the labor market. In fact, the gender gap shrinks to between 8% and 0% when adjustments are made for work experience, career breaks and part-time work. As professor O’Neill writes:

The most important source of the gender wage gap is that women assume greater responsibility for childrearing than men. That influences women’s extent and continuity of work, which affects women’s skills and therefore wages. In addition, women often seek flexible work schedules, less stressful work environments, and other conditions compatible with meeting the demands of family responsibilities. Those come at a price—namely, lower wages.

And here’s one more telling statistic from Professor O’Neill. Among middle-aged adults who have never been married and who have no children, women actually earn 8 percent more than men, although the pay gap is not statistically significant.