Nancy Pelosi is elected speaker of the House of the 116th Congress on Jan. 3. (Melina Mara/The Washington Post)

There’s a critique that often comes up in the heat of political campaigns that goes something like this: “Out-of-state interests are bankrolling my opponent!”

It’s often true that much of a political candidate’s fundraising comes from outside the district. In a nationalized political environment, key races become a focus of attention from voters in both parties, with money pouring in from all 50 states. We were curious, though: Exactly how often do House candidates take in a substantial portion of their fundraising from outside the district?

This is harder to determine than it might seem. For example, campaigns don’t have to report every contribution they receive, only those from donors who’ve given $200 or more. Reported contributions do include an address, but that doesn’t by itself make the process trivial. Congressional districts have meandering boundaries that often make it tricky to identify if they contain a particular address.

To answer the question, we took bulk contribution data provided by the Federal Election Commission and matched it with an index that overlaid ZIP codes onto districts. We excluded organizational contributions and fundraising committees that were used in party primaries or that weren’t a candidate’s primary committee.

The result? About 870,000 contributions that were matched to hundreds of campaign committees. ZIP codes that were entirely within a congressional district or those that didn’t overlap at all were assigned as “in” or “out.” ZIP codes that partly overlapped with a congressional district fell into a middle category: “in or adjacent to” the district.

Our analysis found that about 73 percent of winning congressional campaigns took in a majority of their individual contributions from outside the district. About 62 percent of losing campaigns did.

On average, winning campaigns took in about 24 percent of their individual contributions from within the district (or about 37 percent from within or ZIP codes adjacent to the district). About 63 percent came from outside the district. Among losing campaigns, the numbers were generally similar.

(Philip Bump/The Washington Post)

Interestingly, the percentages for incumbents and non-incumbents broadly matched the percentages above. That makes some sense, of course: Incumbents tend to win their races.

(Philip Bump/The Washington Post)

Overlaying those two, though, things shake out a bit differently. Incumbent winners took in less money from outside the district than non-incumbent winners. Non-incumbent losers took in less outside money than incumbent losers.

(Philip Bump/The Washington Post)

The differences are even sharper when considering the type of district. Using Cook Political Report’s final race ratings from last November, we identified toss-up districts. In those contests, candidates received an average of more than 70 percent of individual contributions from outside the district.

(Philip Bump/The Washington Post)

These are the national fights we mentioned at the outset of this article.

Overlaying the results of the contests is again informative. An average of nearly 8 out of every 10 dollars that came in to winning candidates in toss-up seats came from outside the district. Overall, 81 percent of money raised across all of these contests came from outside the respective districts.

(Philip Bump/The Washington Post)

On average, Democrats took in more money from outside of their districts than did Republicans.

(Philip Bump/The Washington Post)

Again, that overlaps with other groupings identified above: Democrats won more toss-up seats and more seats overall.

It’s important to remember that this picture is incomplete, showing only higher-dollar donors to campaigns. That said, it seems as though in many cases comments about the extent of outside money being received are on the mark.

If you’re curious how different contests compared, we’ve included all 435 House districts below and any candidates for whom our data-matching process returned information.

Note: The data included are from FEC records, meaning that there may be glitches, including those stemming from redistricting.