A new exploratory paper links sleeping pills to dementia but while the press release uses the term risk frequently, it minimizes a giant confounder; older people sleep less and people who have not yet received a dementia diagnosis may go on sleeping medication to try and mitigate restlessness.

Another confounder is that they only find a higher correlation in white people. Science does not work that way, but epidemiology and statistics can do anything.

Data were drawn from senior citizens (average age 74) registered in the Health, Aging and Body Composition study who were followed, on average, for nine years. Of the few thousand people included, 58 percent were white, which needs to be controlled for since other epidemiological claims say that black people have a higher risk of Alzheimer’s, the most common dementia, than whites. It's a confounder, but black people often claim to want to be in studies less, they say on surveys they trust doctors less, and that is impossible to control for, but it's not a deal-breaker, since the people in the study wanted to be in it.

During their time in the study, about 20 percent of those followed developed dementia - that is double the norm so already a worry for how broadly these results apply - and people who were diagnosed overwhelmingly took sleep medication. Okay, except "a 79% higher chance of developing dementia compared to those who “never” or “rarely” used them" does not mean that 80% of people who are on sleeping pills got it, for media attention it is written so that absolute risk feels like relative risk. It was only 617 people and they only had to have reported taking sleep medication 5 times a month to be considered a heavy user of sleeping pills. It's not as baffling as any teen who experimented with a vaping pen over 30 days being "addicted to vaping" by the CDC but still seems like an arbitrary definition.  

In people of color there was no association at all and in wealthy black people the statistics even look like money prevents it. That is just too much. I get that we are in a world where biology has been pushed behind 'state of mind' in many ways, but black people not getting dementia from pills that cause it in white people, and creating a preventive affect if someone is wealthy, is so implausible it isn't even in the exploratory pile, it is just 'coin flips are prejudiced against landing on tails' epidemiology.

Which you can do also. Or prejudiced against heads. Or that meat causes and prevents cancer. Like red wine. And weedkillers like glyphosate and atrazine. 

Epidemiology has many valuable uses but it is just one idea for how science may want to approach a real problem. Too often, like in Harvard School of Public Health food frequency questionnaires to promote miracle vegetables or National Institute of Environmental Health Sciences use of food frequency questionnaires to endorse organic food over conventional, it is instead a way to get some attention. That is not how science works.