You might think that homes in wealthier neighborhoods—with newer and better-maintained houses—would be better at keeping out bugs and pests. But scientists are finding that affluent areas actually sport a larger diversity of critters, including spiders, ants, beetles, flies and other creepy crawlies.

"There's this mindset in America that only poor folk have pest problems—they’ve got all the bad guy bugs," says Vernard Lewis, an entomologist at the University of California at Berkeley. “The creatures are just out there. And depending on where you're at, what's going on outside is going to influence the inside."

A new paper published in the Royal Society's journal Biology Letters illustrates how interconnected humans are with their environment, regardless of fences and walls. The research expands on a previous census of arthropods found in 50 homes around Raleigh, North Carolina. That study, published in January, revealed an astounding array of indoor critters—most of which are hidden and harmless.

But the researchers were curious about what factors determined the diversity of these bugs. Other scientists have found that more affluent neighborhoods harbor a wider range of plants and animals, such as birds, lizards and bats. That made sense, because people in richer areas can afford more landscaping and plants, which provide more habitats for animals. Did this so-called luxury effect also exist for indoor bugs?

"It presented this paradox," says Misha Leong, an entomologist at the California Academy of Sciences in San Francisco and lead author of the new research. "You have this luxury effect known to happen outdoors and this public perception that low-income neighborhoods have major arthropod problems."

But that perception is based solely on our own prejudices, she says. Until now, researchers have largely neglected to study the prevalence of indoor arthropods. Most research only focused on bugs traditionally considered pests, like cockroaches and bed bugs, and none studied the effects of income.

Hard data didn't exist until the researchers began crawling around houses in Raleigh themselves to painstakingly document hundreds of bugs. Because of the sheer numbers of arthropod species, the researchers only counted taxonomic families, which themselves ranged in number from 25 to 125.

In the new study, Leong and her colleagues combined those Raleigh results with publicly available data such as the mean income of a census block, the square footage of the house and the amount of vegetation on the property—the three most influential factors that they found affected the diversity of arthropods. (Others included canopy cover, vegetation diversity and the age of the house.)

The most significant factor was the size of the house, a statistical analysis revealed. As you might expect, the bigger the house, the more corners, crevices, and habitats there are. But size wasn’t the only thing that mattered. Their analysis found that mean income was also a key factor.

"I had read a lot about the luxury effect beforehand, but really seeing it applied to our dataset, particularly because our dataset was indoors, was—wow," Leong says. According to the study, income played a major role in predicting arthropod diversity. The likely reason, she explains, is that wealth usually means more green space, which provides habitats for bugs that can then wander indoors.

The effect extends beyond your property line. When houses are surrounded by lots of greenery, the researchers found, they're all just as diverse. But when you compare houses with little or moderate amounts of vegetation, the wealthier ones still had greater diversity.

So if you, too, want to attract a menagerie of insects but don't have your own verdant yard, trends suggest that you’ll still be a bug magnet as long as you're in a richer area. That’s because you're probably closer to a park or a neighbor who does have a leafy garden. Such proximity is enough to boost your house's bug diversity, making you popular by association. "Choices made at the neighborhood scale by your neighbors or your local government can have an effect on what's going on in your kitchen floor," as Leong puts it.

There are certainly exceptions to this pattern. For example, you can't compare a high-income apartment in Manhattan with a low-income house in rural Mississippi, since the Mississippi home would be surrounded by plants, and thus bugs. The study was also limited to freestanding houses (as opposed to units in apartment buildings), which tended to be in middle and high-income neighborhoods.

The scientists have since taken their bug counting across the globe. They’ve done similar investigations in houses in the San Francisco Bay Area, the Peruvian Amazon and Sweden, and plan to add Australia, China, and Madagascar to the list. So far, despite the range of locales, the houses seem to be equally biodiverse, Leong says.

This underscores the fact that bugs are everywhere in your house, and it's okay. "Biodiversity is something that we need to stress more in America," Lewis says, adding that farmers like his own grandparents understood that critters live among us, and knew that there are no good or bad bugs. "As people moved into the city and got jobs, they lost some of that institutional memory," he says. "Maybe we need to relearn that, and not freak out whenever we see some creature."