“Don’t Worry, Be Happy” is not just a song made famous by Bobby McFerrin. It turns out it also may be good advice for those who want avoid dementia.

Investigators from the Yale School of Public Health found that people with a more positive outlook on aging were approximately 40% less likely to develop dementia compared with those with negative perceptions.

Researchers surveyed more than 4,500 people who were aged 72, on average. When the research kicked off, none of the participants had a dementia diagnosis.

“This makes a case for implementing a public health campaign against ageism and negative age beliefs,” said lead author Becca Levy, Ph.D. Full findings appear in the journal PLOS One. The study was funded by the National Institute on Aging.