This study was embedded within three subcohorts of the Rotterdam Study (RS), a prospective population-based cohort study in Rotterdam, the Netherlands. These subcohorts consist of unique participants and the subcohorts have follow-up measurements every few years (an overview of the Rotterdam Study is provided in Supplementary Figure 2). For the first cohort (RS-I-1), a total of 7983 out of 10275 invited men and women aged ≥ 55 year entered the study between 1990 and 1993. For this cohort, we used the third follow-up visit, in which 4797 still participated, as baseline in our current study because not all lifestyle factors were measured yet in the first visit. For the second cohort, which started in 2000–2001, this was 3011 out of 4504 people of ≥ 55 year, and for the third cohort, which started in 2006–2008, 3932 out of 6057 invited people of ≥ 45 year participated. The overall response figure for all three cycles at baseline was 72.0% .
From this group of 11726 participants, we excluded those who retracted informed consent (n = 36), without HF follow-up data (n = 6), without complete information on lifestyle (n = 5316), with a BMI < 18.5 kg/m2 (n = 70) and with prevalent HF (n = 185), resulting in a population for analysis of 6113 (Supplementary Figure 1). Baseline information was collected through home interviews or was measured at the study center visit as described elsewhere .
The Rotterdam Study has been approved by the Medical Ethics Committee of Erasmus MC (MEC 02.1015) and the Dutch Ministry of Health, Welfare and Sport (Population Screening Act WBO, 1071272159521-PG). All participants provided written informed consent.
Assessment of lifestyle factors
The lifestyle factors that were considered were measured at baseline and included physical activity, smoking, alcohol consumption, diet quality and weight status. To construct the lifestyle score, all lifestyle factors were categorized using cut-offs in line with previous research  and/or guidelines [19, 20].
Physical activity (PA) was assessed using a validated adapted version of the Zutphen Physical activity questionnaire in RS-I-3 and RS-II-1  and with the LASA questionnaire  in RS-III-1. Both questionnaires included questions on the frequency and duration of walking, cycling, sports, gardening and housework. Metabolic equivalent of task MET value was assigned to every activity according to the 2011 Compendium of Physical Activities  and METh/week in total PA were calculated. Subsequently, questionnaire-specific tertiles of PA were calculated.
Participants were interviewed about their smoking habits (cigarettes, cigars and/or pipes) during the home interview and were classified as never, former, or current smokers. Former smokers was defined as: stopped smoking before the examination round. Current smokers was defined as: participants who were smoking cigarettes/pipe or cigars at the examination round.
Information on consumption of alcohol beverages was assessed during the home interview, whereby the participants were questioned on the type of drinks and the amount (glasses/day) consumed. A Dutch standard glass contains 10 g of alcohol. Alcohol consumption was divided into three sex-specific categories : (1) Harmful/unhealthy alcohol intake (≥ 4 glasses/day in men, ≥ 3 in women), (2) Moderate alcohol intake (2–3 glasses/day in men and 1–2 in women), (3) low alcohol intake (< 2 glasses/day in men and < 1 in women).
Dietary intake was assessed using food frequency questionnaires (FFQ) . For RS-I-3 no FFQ was available and diet at RS-I-1 was used as a proxy. As a measure of overall diet quality, we used a score reflecting adherence to the Dutch Dietary Guidelines, as described in more detail elsewhere . The score was calculated as the sum of the number of items adhered to, with a theoretical range from 0 (no adherence) to 14 (full adherence). For the current study, this score was divided into tertiles, representing low (0–6), medium (>6–8) and high (>8–14) diet quality.
Anthropometric measurements were performed in the research center by trained staff. Height and weight were measured after removing heavy outerwear and shoes. BMI was calculated (kg/m2) . According to the WHO cut-off criteria, we categorized weight status in normal weight (18.5 ≤ BMI < 25), overweight (25 ≤ BMI < 30) and obese (BMI ≥ 30) . Participants with a BMI < 18.5 were not included in the study.
Combined lifestyle score
A total lifestyle score was calculated by adding up the above described five lifestyle factors (smoking, alcohol, PA, diet and weight status) into one score . The three levels of each of the five lifestyle factors were scored as unhealthy (score 0), moderate (score 1) and healthy (score 2) and summed resulting in a combined lifestyle score ranging between 0 and 10 points.
Assessment of outcome
The diagnosis of HF was made according to the European Society of Cardiology criteria, which entail a combination of HF symptoms and signs such as, breathlessness at rest or during exertion, pulmonary crepitation and ankle edema, confirmed by objective evidence of cardiac dysfunction by echocardiography or chest X-ray . Additionally, the diagnosis had to be made by a medical specialist which was confirmed based on screening of medical record . Two cardiovascular research physicians independently classify information on occurrence, certainty and date of onset of all data collected on potential events according to the definition of HF. Cases on which the research physicians disagree are discussed in order to reach consensus. Afterwards a medical specialist reviews potential events, in which the medical specialist’s judgement is considered decisive . Further details on (procedure of) diagnosis can be found in the paper of Leening et al. . We did not have additional information on NYHA class and systolic/diastolic HF available for this study. Follow-up for HF was completed until end 2016. For mortality, information about vital status and cause of death was obtained on a weekly basis from the central registry of the municipality in Rotterdam and through the digital linkage with general practitioners working in the study area. For participants living outside of the research area, the primary source was via GPs, complemented by records of the municipality of the place of residence of the participant. For this study we set our end date at end of 2016 and up to that date the life status follow-up was complete.
Assessment of covariates
Confounding variables and prevalence of the comorbidities were assessed at baseline (RS-I-3, RS-II-1, RS-III-1). Confounding variables that were taken into account were educational status, marital status, age, cohort, hypertension, C-reactive protein (CRP), total cholesterol, creatinine-based estimated glomerular filtration rate (eGFRcr), and statin use. Information on educational and marital status was obtained in the home interview. Hypertension was defined as a resting blood pressure > 140/90 mmHg or use of blood pressure lowering medication.
Fasting blood samples were collected in which we determined CRP, creatinine and glucose. eGFRcr was based on the serum creatinine using the CKD-EPI equation . Statin use was assessed during the home interview.
Additionally, prevalence of the following comorbidities were considered: chronic obstructive pulmonary disease (COPD), type 2 diabetes (T2D), stroke and myocardial infraction (MI), cancer (except for basal cell carcinoma and squamous cell carcinoma) . T2D was defined based on fasting glucose concentration of ≥ 7.0 mmol/l or use of blood glucose-lowering medication . COPD was assessed by spirometry . Information on cancer, stroke and MI was collected from general practitioners .
Life expectancy with and without heart failure was calculated using population-based multistate life tables in participants with healthy, moderate and unhealthy lifestyle score. For this purpose, the lifestyle score was categorized into unhealthy (0–3), moderate (4–6) and healthy (7–10). Three health states were included, “free of heart failure”, “heart failure” and “death”. The possible transitions were the following: (1) from free of HF to HF, (2) from free of HF to death and (3) from HF to death. Backflows were not allowed (e.g. from HF to free of HF) and only first event into a state was considered.
First, age and sex-specific rates were calculated for each transition by applying a parametric proportional hazard regression model with a Gompertz distribution. To assess the appropriateness of the Gompertz distribution, we visually inspected Cox-Snell residuals. Secondly, the prevalence of healthy, moderate and unhealthy lifestyle was calculated by sex and 10 years age groups, and for participants with and without HF separately. Following this, sex-specific hazard ratios (HRs) for death and HF for the lifestyle categories and for the continuous lifestyle score were calculated in three models. Model 1 was adjusted for age, cohort, educational status, and marital status; model 2 was additionally adjusted for CRP, total cholesterol, eGFRcr, hypertension and statin use, model 3 was additionally adjusted for prevalent comorbidities (cancer, MI, stroke, COPD, T2D).
Finally, three sets of transition rates were calculated for each lifestyle score category separately using the (1) overall sex-specific transition rates, (2) prevalence of lifestyle score by sex and absence or presence of heart failure and the (3) adjusted HRs (model 1) for heart failure and mortality. Similar calculations have been described previously [30, 31]. The multistate life table was started at age 45 years and was closed at age 100 years. Results for life expectancy were reported at age 45, 65 and 85 years.
Missing data for covariates (< 6.5%) were imputed using the mean of fivefold multiple imputation. Multiple imputation was performed using the Expectation Maximization methods (IBM SPSS, V25.0. Armonk, NY). Confidence intervals for all life expectancies and differences in LE were calculated using @RISK software (Anonymous 2000; MathSoft Inc, Cambridge, Mass), by Monte Carlo simulation. STATA (StataCorp, College Station) was used to calculate incidence rates and hazard ratios. Excel (2010) and @RISK (Palisade Corporation, New York, USA) were used to construct the multistate life tables and the corresponding confidence intervals, by performing Monte Carlo simulations (parametric bootstrapping 10,000 runs ).
As an additional analysis, to investigate if one of the individual lifestyle factors was driving any of the associations, HRs for death and HF for the continuous lifestyle score were repeated with lifestyle scores from which we excluded one of the individual lifestyle factors at a time (i.e., resulting scores consisting of only 4 out of 5 lifestyle factors). Furthermore, we performed a non-response analysis comparing descriptives of those included in the analysis and participants without complete information on lifestyle.