For years, public health experts have argued that where people live matters crucially to their health and life span, but it’s factors such as genetics or access to health insurance that typically get more attention.

Health systems and governments have embarked on massive projects to decode people’s DNA, in the hopes that the information will lead to a new era of tailored treatments and personalized prevention.

It’s the next chapter in the nature-nurture debate: To keep people healthy, is it better to focus on ZIP codes or genetic codes?

A study in Nature Genetics examined 56,000 pairs of twins from a database of 45 million people insured through Aetna found — as might be expected — a mixed picture. Of 560 diseases and conditions studied, 40 percent had some genetic contribution, while a quarter were influenced by shared environment.

Cognitive conditions such as attention-deficit/hyperactivity disorder had the strongest genetic influence, while eye disorders and respiratory diseases such as sinusitis or hyperventilation were more influenced by the environment.

The relative influence of ZIP code or genetic code “is incredibly nuanced. It depends on what disease you’re interested in,” said Chirag Patel, a data scientist at Harvard Medical School who oversaw the work that was led by Chirag Lakhani, a postdoctoral researcher.

The study design was clever, constructing a massive twins study out of an insurance database, but it had a clear limitation — researchers did not have information on which twins were identical, sharing 100 percent of their DNA, and which were fraternal, sharing only 50 percent of their DNA. They had to infer which were identical.

Their results were broadly in line with the findings of decades of twin studies, although the new study found that, on average, the diseases were a little less influenced by genes and a little more influenced by environment. The unsatisfying answer to the debate may simply be that both genes and environment matter, and the contributions of each vary depending on the disease.

“It’s nature via nurture; it’s a clear interaction,” said Tim Spector, a professor of genetic epidemiology at King’s College London.

Spector noted that even though some diseases have a strong genetic component, researchers have found that people with identical DNA often die at different ages and of different diseases. “I think that’s what people need to realize — you have this overall genetic soup that predisposes you to things, but life will throw things at you that sometimes you can’t measure, that will give a different end result,” he said.

On average across all the conditions examined, diseases were 31 percent heritable and 9 percent determined by shared environment. That leaves the majority of the difference unexplained, which could be individual differences between twins’ experiences, randomness or data that is erroneous or incomplete.

Melody Goodman, a biostatistician at New York University’s College of Public Health, said the study was a great use of the data set, but because it represented a commercially insured population, it was unlikely to fully capture one of the biggest determinants of health: poverty. “Even if we can fix all these genetic things,” she said, “it won’t take away the impact of poverty on people’s health.”