People are living longer than ever. According to a 2015 World Health Organization report, Japanese live the longest, with an average life expectancy of 84, while Americans can expect to live to 77. At the same time, it is an obvious fact that some people live much longer than other people. There is inequality in mortality.

What explains this inequality? Epidemiological research confirms what intuition suggests: lifestyle matters. A 2012 study published in Preventive Medicine followed over 8,000 people over a 5-year period. Risk of death by any cause was 56% lower for non-smokers, 47% lower for people who exercised, and 26% lower for those who had a healthy diet. Italian researchers analyzed the diets of inhabitants of the Monti Sicani region of Sicily, where there is a remarkably high prevalence of people who live to be 100. Along with being physically active and having close contact with relatives, the centenarians surveyed were found to adhere to a traditional Mediterranean diet.

A more surprising discovery is that there is a strong link between mortality and IQ: higher intelligence means, on average, a longer life. This relationship has been extensively documented by Ian Deary and his colleagues at the University of Edinburgh using data from the Scottish Mental Surveys. In 1932, the Scottish government administered an IQ test to nearly all 11-year old children attending school on a single day. More than sixty years later, focusing on the city of Aberdeen, Deary and colleague Lawrence Whalley set out to identify who from the cohort was still alive, at age 76. The results were striking: a 15-point IQ advantage translated into a 21% greater chance of survival. For example, a person with an IQ of 115 was 21% more likely to be alive at age 76 than a person with an IQ of 100 (the average for the general population).

The link between IQ and mortality has now been replicated in upwards of 20 longitudinal studies from around the world, and has given rise to the field of cognitive epidemiology, which focuses on understanding the relationship between cognitive functioning and health. One major finding from this new field is that socioeconomic factors do not completely explain the IQ-mortality relationship. In one study, focusing on the Central Belt region of Scotland, researchers linked IQ scores for over 900 of the participants from the 1932 study to those participants’ responses on a national health survey conducted in the early 1970s. The researchers found that statistically controlling for economic class and a measure of “deprivation” reflecting unemployment, overcrowding, and other adverse living conditions accounted for only about 30% of the IQ-mortality correlation.

This evidence suggests that genes may contribute to the link between IQ and living a long life. The results of a new study by Rosalind Arden and colleagues in the International Journal of Epidemiology provide the first evidence for this hypothesis. Arden and colleagues identified three twin studies (one from the U.S., one from Denmark, and one from Sweden) in which both IQ and mortality were recorded. (Twin studies disentangle the effects of environmental and genetic factors on an outcome such as intelligence or lifespan by comparing identical twins, who share 100% of their genes, and fraternal twins, who on average share only 50% of their genes.) They then performed statistical analyses to estimate the contribution of genetic factors to the IQ-lifespan relationship. The results were clear and consistent: genes accounted for most of the relationship.

Exactly what could explain the genetic link between IQ and mortality remains unclear. One possibility is that a higher IQ contributes to optimal health behaviors, such as exercising, wearing a seatbelt, and not smoking. Consistent with this hypothesis, in the Scottish data, there was no relationship between IQ and smoking behavior in the 1930s and 1940s, when the health risks of smoking were unknown, but after that, people with higher IQs were more likely to quit smoking. Alternatively, it could be that some of the same genetic factors contribute to variation in both IQ and in the propensity to engage in these sorts of behaviors.

Another possibility is that IQ is an index of bodily integrity, and particularly the efficiency of the nervous system. To test this hypothesis, in one study, researchers looked at the relationships among IQ, mortality, and performance on a reaction time test designed to measure the brain’s information processing efficiency. (In the reaction time test, the people pressed one of four keys on a response box depending on which of four digits appeared on a screen.) The researchers found that, once a person’s score on the reaction time test was taken into account, there was no longer any correlation between IQ and mortality. Reaction time explained the relationship between IQ and mortality.

These and other findings from cognitive epidemiology have potentially profound implications for public health. Along with factors such as family history of disease, IQ could be used proactively to assess people’s risk for developing health problems and early death. At the same time, this potential use of intelligence tests raises ethical questions. As intelligence researchers are quick to point out, IQ doesn’t reflect one thing—it reflects many things. This includes not only what you might think of as “native” intelligence—brain regions like the prefrontal cortex—but a myriad of “non-ability” factors. For example, there is evidence that a person’s beliefs about their ability to do well on an intelligence test, which may be tied to their ethnicity or gender, can impact how well that person actually does on the test. In turn, being labeled “low IQ” or “high IQ” may impact a person’s sense of self-worth.

One approach to dealing with this issue is to develop intelligence tests that minimize the impact of non-ability factors on IQ. Another is to educate the public and policymakers about the meaning of an IQ score. IQ predicts outcomes such as job performance, academic achievement, and, as it happens, mortality, better than any psychological factor that we know of. At the same time, IQ isn’t destiny—it is one factor among many that predict these outcomes. Things like personality, interests, and motivation matter, too.

Ultimately, to capitalize on evidence from cognitive epidemiology, society would have to decide that the benefits of using IQ to predict health outcomes outweigh the costs. If it does, intelligence testing may one day be used to reduce health inequalities, and help people live longer lives than ever.