People of different generations are equally lonely but for different reasons, a study suggests.
Living alone increases the risk of loneliness in older age whereas in midlife feeling isolated is more linked to personality traits, the research found.
The study found emotionally-resilient people - those more able to adapt in stressful situations - are less at risk of loneliness at any age, and outgoing middle-aged people are less likely to feel lonely.
For those over 70, living alone was associated with more loneliness, with the issue being more acute for men.
Psychologists at the University of Edinburgh examined data from more than 4000 people older than 45 for loneliness, personality traits, and living circumstances.
People were asked to rate how lonely they felt. Their personality traits were also tested using a framework called the Five-Factor Model.
Researchers used machine learning - which uses data to make predictions - to examine the data for relationships between personality traits such as emotional stability, and social variables such as living alone, as causes for loneliness.
Results were compared between people in midlife - from 45 to 69 years old - and those in their 70s. A major strength of the study is that two separate samples represented each age group, and the same effects were found across samples in each age group.
The researchers found similar levels of loneliness in both groups.
On average, people with a strong capacity to maintain emotional balance under stressful circumstances were 60 per cent less likely to be lonely, regardless of their age.
Middle-aged people who were more extroverted were, on average, 55 per cent less likely to be lonely. Social isolation was not significantly associated with loneliness in the 45 to 69 age group.
People over 70 who lived alone were more than four times more likely to feel lonely than those who did not live alone.
Researchers say the study helps understand the origins of loneliness in different generations.
Dr Drew Altschul, of the University of Edinburgh's School of Philosophy, Psychology and Language Sciences, said: "The use of machine learning in this study allows us to identify and replicate differences in what risk factors are linked to loneliness in middle and older age people. Loneliness is a growing public health issue, identifying the things that precede loneliness is difficult, however, contemporary machine learning algorithms are positioned to help identify these predictors."
The study is published in Psychological Medicine. Link to study: https:/
The study was funded with a Medical Research Council (MRC) data pathfinder grant and Age UK. It used data from the Lothian Birth Cohort of 1936, a group of individuals who were born in 1936 and took part in the Scottish Mental Survey of 1947, and Healthy Ageing in Scotland (HAGIS), a study of older people living in Scotland.