In the fall of 2015, the worst heatwave in 25 years struck Southern California. Los Angeles saw two back-to-back 100-degree days, which set an October record and plagued the Long Beach marathon. San Diego, meanwhile, cooked in monthly temperatures 7.7 degrees Fahrenheit warmer than usual.

But the real weird weather came at night. For more than a week, San Diego’s nighttime low barely fell below 75 degrees, even in the coolest hours before dawn. It remains the hottest string of October nights ever recorded in the city.

Nick Obradovich remembers the heat grimly. As a graduate student at the University of California San Diego, his window AC unit couldn’t keep his apartment cool, nor could he afford to keep it running most of the time. His bedroom got hotter and hotter as he tossed and turned through the night. As he lay awake, he wondered if other people were going through the same thing.

Yes—and they still are, he and his colleagues now argue. The first paper examining the link between climate change and human sleep, published Friday in Science Advances, finds that high nighttime temperatures drive more self-reported sleep problems. Elderly people, and people making less than $50,000 per year, seem especially affected by the trend.

The study draws on data from the largest survey of its kind: a 765,000-person telephone survey conducted between 2002 and 2011 by the Center for Disease Control and Prevention. The authors then compared those answers—which included a respondent’s location and income—to heat waves during the same period. “When you have anomalously warm nights in the summer, you have increases in reported sleep difficulties,” Obradovich says.

Anomalously warm nights are one of the earliest symptoms of human-caused climate change. For the past 10,000 years, the same daily cycle has played out: The sun’s heat streams into the atmosphere during the day, and then much of it radiates back into space at night. But greenhouse gases like carbon dioxide trap that heat and reflect it back into the Earth system, keeping ambient temperatures high even at night.

Obradovich argues that these warmer nights are worsening sleep at a physiological level. “We know from a broad literature in the laboratory context that our sleep is regulated pretty heavily by our body temperature—and especially by our core body temperature. The [ambient] temperature in a lab setting can affect someone’s sleep quality,” he says.

Previous public-health studies have found that heat waves raise mortality levels among older people. Obradovich suggests that one cause of this elevated mortality could be poorer sleep quality.

“It’s a brilliant use of secondary data,” says Jeanne Geiger-Brown, the dean of the school of health professions at Stevenson University and a long-time researcher of the epidemiology of sleep. She was not connected to this study. “The federal government collects data for a variety of things and this particular use of the Behavior Risk Factors Survey—and to link it with the climate data—is very, very innovative. I give them a lot of credit for that.”

Geiger-Brown cautioned that, “as is true of all studies that use secondary data, you can only work with the data you have.” The two most common causes of self-reported poor sleep quality are sleep disorders, like sleep apnea, and the lack of a comfortable, dark place to rest and the ability to spend seven hours there.

“Just because of nature of the data, elderly people are more likely to have sleep disorders. And on the converse side, they found people with lower incomes were more susceptible to having this [heatwave-caused] effect—but they often have to work two jobs to make a living wage,” and thus tend to lack sleep opportunity, Geiger-Brown said. In other words, low-income people and older folks are the groups of Americans most likely to have sleep problems, generally.

The data offers other benefits, though. It studies a much more diverse population than a clinical trial would normally allow, Geiger-Brown said. “It really is a representative sample of the United States, and you can’t get that in the clinical setting. That’s what makes this so powerful.”

The most confronting consequences of the research may not even apply in an American setting. While the best evidence for this kind of study comes from the U.S., the consequences of climate-addled sleep could be far worse in less-studied parts of the world: namely, those that get hotter at night or have fewer air-conditioning units. “It’s very possible that the effects we see in the U.S. represent some kind of lower bound for what we might observe in poorer countries that are hotter on average,” Obradovich says.

He recalled an earlier research trip, longer ago, in Western Africa. “In Ghana, it’s really hot and really humid, and there are no other options. You just suffer through the heat.”