## Introduction

Cognitive impairment, which primarily occurs with advanced age1, affects women to a larger extent than men2. Given the multifactorial aetiology of this syndrome, longer life expectancy of women can only partially explain this gap. Increasing evidence suggests that the roots of cognitive impairment may lie in childhood socioeconomic conditions. In previous studies, growing up in a crowded household and less cognitively stimulating environment have been consistently associated with lower levels of cognitive performance in late life and increased risk of dementia3,4. However, there is less consensus on whether childhood socioeconomic position (SEP) additionally influences the rate of cognitive decline5.

A growing body of literature indicates that experiencing socioeconomic adversity in childhood has stronger consequences on the health of women than men. For example, the effects of childhood poverty on obesity and cardiovascular diseases are disproportionately stronger for women6,7. It is unclear whether these sex differences exist also for cognitive health. While mechanisms underlying sex differences related to socioeconomic adversity are likely a complex combination of biopsychosocial variables experienced across the life course, the direction and nature of the relationships of SEP, sex and health have yet to be fully understood.

Scientists have long sought understanding of the nature of discrepancies found in sex and cognition8. While early research observed sex differences across a range of cognitive measures, modern science challenges the appropriateness of conclusions of globally intrinsic sex differences in cognition9,10. Theoretical challenges against concrete sex differences in cognition align with principles from sociocultural theory; which posits that a society’s cultural structure around sex related restrictions and opportunities drive cognitive differences of men and women11. This theory implies that when socio-cultural variables are equal across sexes, the cognitive abilities of men and women have more parity than previously thought8.

SEP affects our overall physical and mental functioning, and is associated with health-related risk and protective factors including educational achievement. Cultural expectations of men’s and women’s roles interact with behaviour through social, psychological, and biological processes through encouragement of stereotypical sex-related behaviours as well as hormonal, reward, and cardiovascular mechanisms, which all contribute to differences in men’s and women’s behaviour development across the life course11. Childhood SEP can impact a range of risk factors over the life-course including, psychological and physical health, and health-predicting behaviours and influences, and psychological health differences between sexes are predictable in large by inequalities in respective societies12. As a result, women have fewer resources available throughout their lives that would provide them with opportunities for building and maintaining resilience13.

In addition, previous findings show that exposure to early-life stressors such as socioeconomic hardship leads to a dysregulation of stress response14. Considering that exposure to elevated stress hormone levels causes thinning of several cortical areas to a greater extent in females than males15,16,17, it is plausible to hypothesize that experiencing childhood socioeconomic disadvantage could have a larger effect on the cognition of women than men. Reducing the effects of childhood socioeconomic disadvantage through targeted preventative strategies could therefore contribute to narrowing sex disparities related to the burden of lower cognitive functioning. In a diverse population of older adults residing in 21 different countries, the present study aimed to explore sex differences in (1) the association of childhood SEP and the level of cognitive performance, (2) mediators in this association and (3) the relationship between childhood SEP and the rate of cognitive decline.

## Results

### Cross-sectional analysis

Women scored higher in cognitive tests (0.03 ± 0.85) than men (− 0.04 ± 0.80; < 0.001, Cohen’s d =  − 0.092), but there was no difference in their childhood SEP (Table 1). Higher childhood SEP was associated with a higher level of cognitive performance in all models in the whole sample (Supplementary Table S1). There was an interaction between childhood SEP and sex (p < 0.001) in all models (Table 2). When stratified by sex and adjusted for age, higher childhood SEP was significantly associated with a higher level of cognitive performance in both sexes, but to a larger extent in women (B = 0.238; 95% confidence interval (CI) 0.203–0.271) than in men (B = 0.208; 95% CI 0.180–0.235; Table 2, Model 1).

When adjusted also for education, the model attenuated by 40.3% in women and 39.9% in men but the association of childhood SEP with cognitive performance remained statistically significant in both sexes (women: B = 0.142; 95% CI 0.110–0.175 vs. men: B = 0.125; 95% CI 0.097–0.152; Table 2, Model 2). Adjusting for depressive symptoms and all sociodemographic characteristics additionally reduced the coefficients by 9.9% in women and 8.8% in men (Table 2, Model 3). When all sociodemographic and health-related covariates were entered, the coefficients attenuated further by approximately 4.6% in women and 4.4% in men (Table 2, Model 4). The differences between the coefficients in men and women were statistically significant in all models. The strongest predictor of cognitive performance in both sexes was education and the second strongest was age. Childhood SEP was the third strongest predictor in women and the fourth in men (Supplementary Table S2).

### Mediation analysis

The mediation model tested the mediating effect of education, depressive symptoms and a “physical state” latent factor in the association of childhood SEP with the level of cognitive performance. The model had an acceptable fit against the data in both sexes (men: χ2(24) = 4457.627, root mean square error of approximation = 0.070 [90% CI 0.068–0.072], comparative fit index = 0.956, Tucker–Lewis index = 0.918; women: χ2(24) = 3327.370, root mean square error of approximation = 0.055 [90% CI 0.053–0.056], comparative fit index = 0.979, Tucker–Lewis index = 0.961). The model accounted for 40.1% of women’s and 34.6% of men’s variance in the level of cognitive performance (Fig. 1). Education was responsible for mediating 29.5% in men and 30.7% in women of the model’s total effect between childhood SEP and the level of cognitive performance. The effect was significantly stronger in women with a small effect size (d = 0.051, p < 0.001). Of the model’s total effect, “physical state” mediated 14.56% in men and 14.87% in women. The association was significantly stronger in women, however, with a very small effect size (d = 0.018, p < 0.01).

The mediating effects of depressive symptoms between childhood SEP and the level of cognitive performance were negative in both sexes and equally small, with virtually no difference (− 0.002 in both men and women). Education via the “physical state” was responsible for 8.43% of the model’s total effect in men and significantly stronger with 8.54% in women (d = 0.026, p < 0.001). Education via depressive symptoms had negative, though small, effects on cognition virtually equal across sex (-0.001 in both sexes). Childhood SEP had proportionally a stronger direct effect on the level of cognitive performance in men (48.28%) than in women (46.84%), however, the absolute effect was larger in women (0.148) than in men (0.126, d = 0.044, p < 0.001, see Supplementary Table S3 and Fig. S1 for unstandardized coefficients).

In sensitivity analysis, when physical inactivity and alcohol use were used instead of the “physical state” latent factor, the results showed that physical inactivity was a considerably weaker mediator than the “physical state” latent factor. Alcohol use mediated only a negligible amount of the overall effect of childhood SEP on the level of cognitive performance (Supplementary Figs. S2 and S3).

### Longitudinal analysis

Using the linear mixed-effect model adjusted for baseline age, we found a significant interaction between sex and childhood SEP in the association to the rate of decline in all three cognitive measures (p from likelihood ratio test < 0.001). Stratified by sex and using the binary variables childhood socioeconomic advantage and disadvantage, childhood socioeconomic disadvantage was related to a higher rate of decline in delayed recall in both sexes, but to a greater extent in women (women: B =  − 0.023; 95% CI  − 0.035; -0.011 vs. men: B =  − 0.018; 95% CI  − 0.032;  − 0.005, Table 3). Childhood socioeconomic disadvantage was not associated with a decline in immediate recall nor in verbal fluency in either sex. Childhood socioeconomic advantage was not related to the rate of decline in any of the measures in either sex (Table 4).

### Sensitivity analysis

Using an alternative measure of childhood SEP, we found a significant difference in the association of being in disadvantaged and the most disadvantaged childhood SEP with the level of cognitive performance between men and women in all four models. Stratifying by sex and using the most advantaged group as a reference category, there was a strong socioeconomic gradient across all four entries (disadvantaged, middle, advantaged, and most advantaged) in the level of cognitive performance in Model 1 in both women and men (Supplementary Table S4). These associations largely attenuated after adjustment for education; and being men in the advantaged group was no longer associated with lower level of cognitive performance in comparison to the most advantaged. After controlling for other socioeconomic and health- related characteristics, these associations attenuated, but did not lose their statistical significance.

## Discussion

This multi-centre population-based cohort study, capitalizing on a sample of more than 80,000 well-characterized individuals residing in 20 European countries and Israel, suggests that experiencing socioeconomic hardship in childhood could have a greater effect on cognitive health of women than of men. The sex difference in the relationship between childhood SEP and the level of cognitive performance was not explained by other socioeconomic and health related risk factors. Education was the strongest mediator of the association of childhood SEP with the level of cognitive performance. However, sex differences in the effects of childhood SEP on the rate of cognitive decline are less clear as we found only an association between childhood socioeconomic disadvantage and the rate of cognitive decline in delayed recall. These findings are of interest in the context of identifying modifiable early-life predictors of later-life cognitive performance, bringing improved understandings of discrepancies related to SEP, education and cognitive health across sexes. We suggest that preventing childhood socioeconomic adversity and improving educational opportunities could help to decrease the disproportionate burden of later-life lowered cognitive functioning in women.

This study is in line with literature suggesting that childhood socioeconomic adversity has stronger consequences on the health of women compared to men18,19. There is a substantial body of evidence surrounding sex discrepancies in the origin of cardiovascular disease, with several studies reporting stronger associations of childhood SEP with obesity, hypertension and risk of myocardial infarction in women than in men6,20,21,22. The implications of poor childhood SEP on later-life cognitive functioning and differences across sexes have previously been examined in two studies based on samples from the United Kingdom and the Unites States19,23,24. In a British birth cohort, Hurst and colleagues examined the influence of childhood SEP on nine markers of physical and cognitive performance23. They found a statistically significant sex difference in the association of childhood SEP with reaction time only, reporting a small interaction in magnitude, which indicated a slightly stronger association for men than for women23. In an American cohort, Lyu found that the association of childhood SEP with the level of memory was stronger for men than for women24.

Our findings challenge results from these previous studies23,24, suggesting that the consequences of childhood SEP related to cognitive performance are stronger for women than for men. Higher survival amongst women has been used as a dominant reason for a higher burden of cognitive disorders in women25. We propose that the heightened consequences of childhood socioeconomic adversity on women’s cognitive health also contributes to sex disparities. The modifying effect of sex on the relation between childhood socioeconomic adversity and poor cognitive outcome in later life might be explained by underlying biological pathways of sex-specific response to early life stressors. Low childhood SEP is an adverse experience that leads to hypothalamic–pituitary–adrenal axis dysregulation14. Exposure to the elevated corticotropin releasing hormone during early-life periods is a predictor of thinning of selective cortical regions related to cognition, and this association seems to be stronger in females15,16,17. As a consequence, women exposed to socioeconomic hardship might have lower cognitive reserve than men, increasing their risk of diminished cognitive functioning.

From the mediators tested in the present study, education had clearly the greatest mediating effect in the association of childhood SEP with the level of cognitive performance. It is well known that socioeconomic resources of the household are strong predictors of educational attainment of children26. The impact of childhood socioeconomic resources on education may differ by sex and regional context—in the less meritocratic European countries, children from less advantaged background may have been less likely to receive high educational attainment than children from more advantaged backgrounds and men may have gotten a greater access to education than women. Therefore, it is plausible that the mediating effect of education may differ by sex. This study suggests that education mitigates the later life cognitive risks related to early life conditions to almost the same degree for women and for men, with only a small difference, yet with statistical significance, which might be largely driven by the great sample size. Previous literature indicates that women gain a larger benefit from education than men in counteracting adverse childhood SEP27, which has been previously studied in the context of depression28. The theory of resource substitution proposed by Ross & Mirowsky proposes an explanation for this sex discrepancy13. The theory implies that access to multiple resources reduces the consequences of deficits of any particular resource. In comparison to men, women generally have less power, authority, independence, and earnings, so education can substitute the lack of these resources13. Therefore, education may provide stronger protection toward the cognitive health of women with lower childhood SEP as it substitutes for a deficit of alternative resources, which men are less dependent on. Given the greater burden of cognitive disorders in women, our results suggest that education can have in total a greater effect on cognitive health of women in the population, however, its strength as a mediator is limited for both women, and narrowly more for men.

Findings related to sex differences in the effect of childhood SEP on the rate of cognitive decline are less clear as we found the association between childhood socioeconomic disadvantage and the rate of cognitive decline only in one of the three cognitive measures. Nevertheless, our study suggests that the consequences of childhood socioeconomic disadvantage extend beyond disproportionately lower levels of cognitive performance for women, affecting trajectories of cognition, again more strongly for women than men, but only for delayed recall. This contributes new findings to the mixed literature concerning the effects of childhood SEP on the rate of cognitive decline. The majority of studies from the USA and Europe report no association between childhood SEP and the rate of cognitive decline4,29,30,31,32,33,34. However, some authors suggest that higher childhood SEP is associated with lower rates of cognitive decline35, while others report that childhood socioeconomic adversities are associated with lower rates of decline in some cognitive functions5,36. Sex differences, however, were rarely assessed24,37. Lyu and colleagues assessed cognition measured by word recall tests in individuals aged 65 or over from the Health and Retirement Study and found that being well-off during childhood was associated with steeper cognitive decline in men but not women24. Zaninotto and colleagues studied individuals aged 50 + years from the English Longitudinal Study of Ageing and found poor childhood SEP was associated with lower rates of decline in memory as well as cognitive functions only in women37. Considering the robustness of our sample, we conclude that exposure to childhood socioeconomic disadvantage, particularly in women, may weaken one’s ability to use pre-existing cognitive processes or compensatory mechanisms in coping with cumulating neuropathology in order to slow down cognitive decline.

While the effect sizes of the association of childhood SEP with cognition are small and the statistically significant results may be driven by the great sample size, the magnitude of the impact of low SEP on later life cognitive outcomes is notable on the population level. These findings are meaningful in the context of Europe which is facing challenges related to demographic shifts including increased lifespans38, and an increasing burden of chronic noncommunicable diseases, including dementia39. The total costs of informal care for dementia in Europe was 33 billion € in 2008, and the demographic forecast of costs is estimated to increase in Europe by about 43% between 2008 and 2030 to over 250 billion €40. Prevention policies for cognitive decline are vastly neglected, considering health systems across the OECD spend less than 3% of funds on prevention strategies41. A shift towards balancing primary, secondary and tertiary prevention of cognitive decline has the potential to not only reduce the risk for cognitive decline of an ageing population but could produce monumental decreases in the rate, burden and cost of care for older adults across Europe. Interventions preventing and targeting individuals with low childhood SEP and improving education could greatly mitigate the risks of social inequalities and improve the prognosis of later life cognitive health, particularly for women, who are the most affected by it.

Several limitations need to be mentioned. Data related to the childhood SEP were collected retrospectively, which is susceptible to recall bias. However, good internal and external consistency of SHARELIFE data has been demonstrated42. Moreover, results from the sensitivity analysis, in which we used alternative measure of SEP, support our main results. Additionally, there is a potential for selection bias. Growing up in socioeconomic hardship is linked to a higher cardiovascular mortality in later life43, therefore healthier people might be overrepresented in the study. This could lead to an underestimation of the associations that we found. Another limitation of the study is residual confounding and mediation. Other potential genetic, clinical and social risk factors, such as presence of APOE-ε4 allele, high blood pressure, high cholesterol levels or social isolation, were not included in the dataset and therefore are unaccounted for. In addition, we lack a high-quality measure of innate cognitive abilities, which is another important source of unmeasured confounding. Finally, it has been reported that women outperform men in verbal tasks, while men score higher in visuospatial tests44. Given that all three cognitive measures included in our study tested verbal abilities, our findings might be restricted to this cognitive domain only. Despite these limitations, to the best of our knowledge, this study is the largest longitudinal, population-based study with uniform data from the majority of European countries assessing sex differences in the role of childhood SEP in cognitive ageing.

This study adds to the evidence surrounding the link between childhood socioeconomic conditions and adult development and health, a complicated research challenge38. These findings are important in the context of identifying strategies to improve cognitive functioning of older populations, in particular addressing the disproportionately higher burden of cognitive impairment in women2. Unearthing the negative implications of low SEP on cognitive performance as more harmful to women than men provides a foundation for further research. Future studies should investigate the surrounding mechanisms driving these differences specifically focusing on educational and socioeconomical interventions for women with low childhood SEP. In poverty reduction initiatives, targeting especially young people and women could reduce the risk of later life problems. In education, providing additional support to low-income families and ensuring girls with low SEP are prioritized could improve individual prospects for ageing outcomes. Through targeting childhood SEP, prevention of cognitive decline in later life could be shifted to an early age potentially also increasing the impact on other risk factors across the life span. The emphasis on improving access to and achievement in education, particularly for girls and women, may be a worthwhile investment in reducing the burden of disability related to cognitive disorders of the ageing populations of Europe.

## Methods

### Source of data

Analysis is based on data from Survey of Health, Ageing and Retirement in Europe (SHARE), a multidisciplinary, cross-national study that collects information about health, social network and economic conditions of the ageing populations in 20 European countries and Israel. Data are collected using computer-assisted personal interviewing (CAPI), as previously described in detail45. The first wave of data collection was conducted in 2004 and was followed by five subsequent waves in 2006/2007 (wave 2), 2008/2009 (wave 3), 2011/2012 (wave 4), 2013 (wave 5), 2015 (wave 6) and 2017 (wave 7). Eligible participants were the oldest members of the household (aged at least 50 + years old) and their partners (if they had any), irrespective of age.

Only community-dwelling individuals were selected at baseline, but follow-up interviews were conducted in institutions, if a participant was admitted to one. New individuals were enrolled with the same sampling method in order to maintain the original age structure and because of attrition due to death and loss between waves. SHARE has been repeatedly reviewed and approved by the Ethics Committee of the University of Mannheim and the research was performed in accordance with relevant guidelines and regulations. All participants signed written informed consent and have been informed about the storage and use of data and their right to withdraw informed consent. All data were pseudo-anonymized. In addition, our study was approved by the Ethics Committee of the National Institute of Mental Health, Czech Republic.

### Childhood SEP

Wave 3 of SHARE was devoted to collecting information about participants’ life histories (SHARELIFE). In order to improve recollection process, a Life History Calendar was used for data collection46. To mitigate the risk of recall bias, a validation study of retrospectively recalled data in SHARELIFE has been previously carried out42. A shorter version of SHARELIFE was delivered in waves 5 and 7 to participants who had not completed this questionnaire in wave 3. Childhood SEP was operationalized through a composite variable of two household characteristics representing key components of wealth47,48. The composite variable “childhood SEP” includes two common indicators of household characteristics, which have been frequently used as they capture material circumstances related to SEP48,49: overcrowding, which in particular indicates socioeconomic hardship, and the number of books at home, capturing the intellectual aspects of SEP47,48,50.

First, participants were asked to recall two indicators of their household characteristics at the age of 10 years: (1) how many rooms their household occupied in their accommodation; (2) and how many members occupied their household. Second, they were asked how many books were in the place they lived: none or very few (0–10 books)/enough to fill one shelf (11–25 books)/enough to fill one bookcase (26–100 books)/enough to fill two bookcases (101–200 books)/enough to fill two or more bookcases (more than 200 books). The composite variable “childhood SEP” was created in two steps. First, we divided the number of rooms by the number of household members and created a “household ratio”, where higher values indicate a less crowded household. Then, we coded the variable “number of books” into a scale (from 0 to 4). Next, both variables “household ratio” and “number of books” were converted into z-scores. The average from these is the composite childhood SEP, where a lower value indicates a more disadvantaged SEP.

To assess the effects of childhood SEP on the rate of cognitive decline, we additionally created two binary variables specific for each country, corresponding to the most extreme distributions of childhood SEP—“childhood socioeconomic disadvantage” and “childhood socioeconomic advantage”. Childhood socioeconomic disadvantage was operationalized by fulfilling two conditions: (1) not reaching the household ratio above the 5th percentile in each country and (2) being in the most adverse category of number of books. Similarly, childhood socioeconomic advantage was defined by being above the 95th percentile of the household ratio in each country as well as being in the best or the second category of number of books, depending on the distribution in each country.

### Cognition

Assessment of cognition was conducted in six waves (wave 1, 2, 4, 5, 6 and 7) using three measures: verbal fluency, immediate recall and delayed recall. For cross-sectional analysis, data on cognition comes from the wave when all three cognitive measures were available for the first time, i.e. the wave differs for each participant. For longitudinal analysis, all available data on cognition was used. Verbal fluency score was derived from the animal fluency test51 and indicates the sum of acceptable animals that the participants could name within one minute. Immediate and delayed recall were extracted from the adapted 10-word delay recall test52. Immediate recall score (ranging from 0 to10) was measured as the number of recalled words after the interviewer read a list of 10 words. At the end of the cognitive testing session, interviewers asked participants to recall any of the words from the previous list, representing delayed recall score (ranging from 0 to10).

The association of SEP with the level of cognitive performance was similar for all three cognitive measures. Therefore, for the cross-sectional analysis, we transformed the three cognitive measures into z-scores and used their average as the composite measure of the level of cognitive performance. However, the association of childhood socioeconomic advantage/disadvantage with the rate of cognitive decline differed for each cognitive measure, therefore, we analysed them separately in the longitudinal analysis. Familiarity with the process of measuring cognitive functions and the test-specific content might be a cause of practice effect, leading to an underestimation of the rate of cognitive decline53. Thus, we adjusted the longitudinal analysis for practice effect. To select the best indicator of practice effect, we compared three sets of models adjusting for practice effect defined as (1) wave 1 set as indicator (2) number of prior tests and (3) root square of the number of prior tests54. The number of prior tests was the best fit and is therefore used in all models.

### Covariates

Covariates were identified based on previous evidence on the association of sociodemographic and health-related factors with childhood SEP and cognition4,55. Covariate data were derived from the same wave when cognition was measured or, if not available, then from the closest wave. Sociodemographic characteristics were age (years), sex (women vs. men), years of education, household net worth (standardized difference between household gross financial assets and financial liabilities), current working status (working vs. not working), cohabitation status (living with a partner vs. alone) and number of children and grandchildren.

Health-related characteristics were depressive symptoms (measured by EURO-D scale56), number of limitations in instrumental activities of daily living, cardiovascular disease (defined as ever diagnosed or treated for coronary heart disease, stroke, diabetes, high blood pressure or high blood cholesterol), number of chronic diseases, body mass index, physical inactivity (never vigorous nor moderate physical activity vs. physical activity), smoking (ever smoked daily vs. never smoked daily), alcohol use (drinking more than 2 glasses of alcohol almost every day vs. drinking less) and maximal grip strength. In addition, principal components analysis was used to explore whether five measures of physical health (i.e., number of chronic diseases, cardiovascular disease, number of limitations in instrumental activities of daily living, physical inactivity, and maximal grip strength) could measure an overall composite variable “physical state”. The established factor was utilized as a mediating latent factor in the structural equation model, for details see Supplementary Table S5.

### Analytical sample

From the 110,516 individuals who participated in the 3rd, 5th or 7th wave, we excluded those with missing data on childhood SEP (n = 3880) and cognitive functions (n = 19,523) as well as individuals younger than 50 years (n = 3054), leaving 84,059 persons in the final analytical sample used for the cross-sectional analysis (55% women; on average 64 years old). The study participants were from 4 European regions (Western Europe n = 33,294; Central and Eastern Europe n = 21,848; Southern Europe n = 16,966 and Scandinavia n = 9594) and Israel (n = 2357). Individuals with missing data on covariates (n = 2897) were kept in the sample for the descriptive analyses. For the longitudinal analysis, we included individuals with available measures on cognition in at least 2 waves (n = 74,279; 55% women). At baseline, they were on average 64 years old and were followed-up for the median of 2 130 days (approximately almost 6 years). Selection of the analytical sample is described in detail on Supplementary Fig. S4.

### Statistical analysis

The analysis was performed in several steps. First, we estimated whether the association of childhood SEP with the level of cognitive performance differs by sex (cross-sectional analysis). Second, we tested whether education, depressive symptoms and “physical state” mediate the association of childhood SEP with the level of cognitive performance differently for men and women (mediation analysis). Third, we studied whether men and women differ in the association of childhood socioeconomic advantage or disadvantage with the rate of cognitive decline (longitudinal analysis).

#### Cross-sectional analysis

Descriptive data of the analytical sample is presented as frequency (n [%]), mean ± standard deviation, or median and interquartile range. The sample size is large enough to assume normality57, therefore, differences in measurements between men and women were tested using independent samples t-test for continuous variables and χ2 test for binary variables. Because individuals (level 1) in our data were nested in countries (level 2), multilevel linear regression was applied to estimate beta coefficients with 95% confidence intervals (CIs) for the associations of childhood SEP with the level of cognitive performance. To examine whether there are cross-country differences in cognitive performance, an intercept-only model with a random intercept for country was compared with the null-model, using a likelihood ratio test. The formula for a regression equation for a random intercept-only model is as follows:

$${\text{Y}}_{{{\text{ij}}}} = \, \beta_{0} + {\text{ u}}_{{0{\text{j}}}} + {\text{ e}}_{{{\text{ij}}}}$$

In this formula u0j is the between-country variance and eij is the within-country variance. The intra-class correlation coefficient was used to estimate the percentage of the total variance that can be attributed to differences between countries. Next, a random slope for SEP on country level was added to examine whether there are cross-country differences in the association of SEP with the level of cognitive performance, using a likelihood ratio test. The regression equation for a random intercept and a random slope model can be written as followed:

$${\text{Y}}_{{{\text{ij}}}} = \, \beta_{0} + \, \beta_{{1}} {\text{X}}_{{{\text{ij}}}} + {\text{ u}}_{{0{\text{j}}}} + {\text{ u}}_{{{\text{1j}}}} {\text{X}}_{{{\text{ij}}}} + {\text{ e}}_{{{\text{ij}}}}$$

Four sets of models are presented, step-wise adjusting for covariates. As the association of childhood SEP with the level of cognitive performance was consistent across all three cognitive measures (verbal fluency, immediate recall and delayed recall; data not presented in tables), results are presented only for the composite cognitive score.

Model 1 was adjusted for age and sex; Model 2 also for education; Model 3 also for depressive symptoms and sociodemographic characteristics (household net worth, cohabitation status, number of children, number of grandchildren and current working status); and Model 4 additionally for health-related characteristics (body mass index, number of limitations in instrumental activities of daily living, maximal grip strength, physical inactivity, number of chronic diseases, smoking status, cardiovascular disease and alcohol use).

Variance inflation factor (VIF) was calculated using simple linear regression model with all factors included in Model 4 to investigate the presence of multicollinearity (mean VIF = 1.53). Finally, to explore whether the association of childhood SEP with the level of cognitive performance differs by sex, an interaction term was included between sex and childhood SEP in all models. Likelihood ratio test assessed the interaction effect. As the interaction was significant in all models (p from < 0.001), all analyses were performed stratified by sex.

#### Mediation analysis

The strongest predictors of the level of cognitive performance were entered into a structural equation model with multiple mediations. Childhood SEP predicted the level of cognitive performance, mediated by years of education, depressive symptoms, and the latent “physical state” factor. “Physical state” was included into the model as an underlying latent factor predicting the five observed measures of physical health. Age predicted depressive symptoms, “physical state”, and cognitive performance and correlated with childhood SEP and years of education (Fig. 1). Men and women were tested separately, and their corresponding coefficients were compared using t-test. Because of cardiovascular disease and physical inactivity being binary outcome variables, Weighted Least Square Mean and Variance estimator was used. Model fit against the data was accepted if the root mean square error of approximation was lower than 0.08; and if the comparative fit index and Tucker–Lewis index were higher than 0.9058.

#### Longitudinal analysis

Linear mixed-effects models with unstructured covariance were used to study the relation of childhood SEP to the rate of cognitive decline. The basic three-level model was constructed as follows:

$${\text{Y}}_{{{\text{ijk}}}} = \, \beta_{0} + \, \beta_{{1}} {\text{X}}_{{{\text{ij}}.}} \left( {{\text{time}}_{{{\text{ij}}}} } \right) \, + {\text{ u}}_{{{\text{i}}..}} + {\text{ u}}_{{0{\text{ij}}.}} \, + {\text{ u}}_{{{\text{1j}}}} {\text{X}}_{{{\text{ij}}.}} \left( {{\text{time}}_{{{\text{ij}}}} } \right) \, + {\text{ e}}_{{{\text{ijk}}}}$$

As the association of childhood SEP with the rate of cognitive decline is different for various cognitive measures5, the three cognitive measures (verbal fluency, immediate recall and delayed recall) were analysed separately. They were entered into the models in their original form, not as standardized scores. The models included time (in years since baseline centred around grand mean), time squared (in years), childhood SEP and their interaction term (childhood SEP × time), adjusting for baseline age, sex and practice effect. To explore whether the association of childhood SEP on cognitive decline differs by sex, an interaction term was included between time, childhood SEP and sex (childhood SEP × time × sex) in the model. As there was a significant interaction with sex for all the three cognitive measures (p from likelihood ratio test < 0.001 for all three measures), all analyses were performed stratified by sex.

To enable interpretation of the effect of childhood SEP, binary variables (childhood socioeconomic disadvantage and childhood socioeconomic advantage) were used. The models then included time, childhood socioeconomic advantage/disadvantage and their interaction term (childhood socioeconomic advantage/disadvantage × time), adjusting for baseline age. Participants, time in years and countries were set as random intercepts, the time squared as random slope at participant level and also as fixed effect, childhood socioeconomic advantage/disadvantage as random slope at country level and also fixed effect, and baseline age as fixed effect in Model 1. In a step-wise approach, other covariates were added as fixed effects: education in Model 2; depressive symptoms and sociodemographic characteristics (household net worth, cohabitation status, number of children, number of grandchildren and current working status) in Model 3; health-related characteristics (body mass index, limitations in instrumental activities of daily living, maximal grip strength, physical inactivity, number of chronic diseases, smoking status, cardiovascular disease, alcohol use) in Model 4.

#### Sensitivity analysis

To test the robustness of our findings, we performed a sensitivity analysis using an alternative independent variable characterizing childhood SEP, as used in previous research59. The alternative childhood SEP was the sum score of four binary indicators of socioeconomic conditions at the age of 10: (1) the main breadwinner’s occupational position (low skilled), (2) number of books at home (less than 10), (3) overcrowding (more than 1 person per 1 room), and (4) poor housing quality (lacking all of the following features: fixed bath, cold running water supply, hot running water supply, inside toilet, and central heating). As all these measures were collected only in wave 3, the sensitivity analysis was performed only on a subsample of 25 574 individuals. Methods of multiple linear regression were used to build 4 models adjusting for covariates.

In the end, the multiple mediation model was run using the “physical inactivity” and the “alcohol use” variables instead of the “physical state” latent factor to see if more specific behavioural recommendations could be made based on the mediation model. Analyses were conducted using STATA software, version 16.1 and Mplus Ver. 8.