Data came from the Early-ACTID trial [19, 20], a 12-month, multi-centre, parallel-group randomised controlled trial involving 593 adults diagnosed in the previous 5–8 months with type 2 diabetes. Recruitment took place from December 2005 to September 2008 within South-West England. Participants were randomised to either a usual care, dietary intervention or diet and physical activity intervention group. During the first 6 months of the study, glucose-lowering medications were not changed. Trial endpoints were HbA1c and blood pressure at 6 months (primary) and 12 months (secondary) post-intervention. The study was approved by the Bath Research Ethics Committee (05/Q2001/5), and all participants provided written informed consent.
Usual care consisted of standard dietary and exercise advice at 0 and 12 months, with an interim review by study doctors and nurses at 6 months, where no further advice was given. The diet intervention aimed to enable and maintain 5–10% weight loss through a non-prescriptive dietary intervention based on 2003 Diabetes UK nutrition guidelines  and UK Food Standards Agency’s ‘Balance of Good Health’ . Specifically, participants were encouraged to base meals on starchy carbohydrates and choose higher-fibre/wholegrain options, reduce added sugars, increase oily fish and reduce fatty and processed meat intakes and choose lower-GI and energy-density foods. Guidance also included maintaining a regular meal pattern alongside general portion-size control. Dietitians met with participants at randomisation and every 3–4 months, with study nurses reinforcing advice every 6-weeks. The diet and physical activity intervention consisted of the same dietary intervention as the diet-only group. Participants were however advised to do an additional ≥ 30 min walk on ≥ 5 days per week. Study nurses also discussed physical activity during the 6-weekly appointments. Total contact time was the same in both intervention groups.
Diet was self-reported using 4-day food diaries covering two weekdays and two weekend days. All foods and drinks (including alcohol) were reported with estimated portion sizes using household measures or package weights, noting brands and cooking methods where appropriate. Food diaries were coded according to the University of Bristol’s Centre for Exercise, Nutrition and Health Sciences food diary codebook. This codebook is based on the INTERMAP study , common foods in the first 6 years (2008–2014) of the UK National Diet and Nutrition Survey (NDNS) , portion sizes from the 2006 Final Technical Report to the Food Standards Agency on Typical Food Portion Sizes in Adults , and coding rules taken from the UK ALSPAC  and AIRWAVE  study codebooks.
Food diaries were coded by two researchers and quality-checked by two others in line with best practise for minimising coding errors . The Diet In Data Out nutritional analysis software  was used for analysing 0- and 6-month diaries, and DietPlan (v7; Forestfield Software Limited, UK) was used for 12-month diaries. Diet analyses used nutrient data published in the 2002 UK Composition of Foods Integrated Dataset (COFID)  to more closely match food composition at the time of the trial, or if missing, the updated 2015 COFID database .
Diet pattern derivation
Average daily percentage total energy intake (TEI) were calculated using updated Atwater factors  for starches and sugars combined, saturated fats (SFA), monounsaturated fats (MUFA), polyunsaturated fats (PUFA) and total fat intakes using: 100*energy from nutrient (kJ)/total energy (kJ). Average daily fibre-density was calculated using total fibre (g)/total energy (MJ). Average daily dietary energy-density (DED) was calculated using total food energy (kJ)/total food weight (g), excluding drinks to prevent inappropriately diluting estimates .
All dietary patterns were derived using RRR. Fibre-density (g/MJ) and percentage energy from starches and sugars, SFA, MUFA and PUFA (%TEI) were used as intermediate variables for deriving a dietary pattern based on evidence that individual macronutrients directly affect glycaemia [14,15,16] (mechanism 1; Fig. 1b). DED (kJ/g), total fat (%TEI) and fibre-density (g/MJ) were used as intermediate variables for deriving a dietary pattern hypothesised to indirectly associate glycaemic control via bodyweight (mechanism 2; Fig. 1c), replicating previous methods [17, 18, 33, 34]. For dietary pattern mechanism 1, food items were allocated to 65 groups based on culinary usage and to maximise differences in fat and carbohydrate quality (Additional file 1: Table S1). For dietary pattern mechanism 2, 47 food groupings based on previous studies were used  (Additional file 1: Table S1). Average intake of each food group was calculated in g/day at 0, 6 and 12 months for each participant.
RRR derives a dietary pattern score for each participant computed from their individual standardised food group intakes weighted by dietary pattern loadings derived at group-level. Pattern scores are increased when participants report eating more of food groups with higher (positive) pattern loadings or eating less of food groups with lower (negative) pattern loadings. RRR produces as many dietary patterns as intermediate variables used; hence, for dietary pattern mechanism 1 this was 5, and for dietary pattern mechanism 2, this was 3 patterns. To identify a single score for each pattern that captured the combination of food groups explaining most variation in specified nutrient intermediates, we only retained the first patterns for subsequent analyses. To confirm whether the pattern structures (i.e. the size or direction of food group loadings for pattern scores) changed over time, we repeated the RRR independently at 6 and 12 months and compared the first patterns derived at these timepoints with the first patterns at baseline using Tucker’s congruence coefficient (CC) . After confirming patterns were similar (CC > 0.85), food group pattern loadings at baseline were used to compute dietary pattern scores at 6 and 12 months, thus allowing changes in adherence to the same dietary pattern structure to be measured. We also assessed congruence between dietary pattern 2 and dietary patterns derived using identical methods in the UK NDNS , to assess stability of this pattern between populations.
Misreporting of energy intake
Dietary misreporting at baseline was assessed via an individualised method  using a ratio of reported energy intake to estimated energy requirement, calculated from standard equations  (Additional file 1: Supplementary information S1 [38, 39]). Assuming energy balance, energy intake is expected to be equal to estimated energy requirements. Early-ACTID was a weight-loss trial, so whilst energy balance may be assumed at baseline, it is an unreasonable assumption during the intervention. Therefore, baseline misreporting status was used to assign misreporting status at later timepoints, as misreporting has previously been seen to track within individuals . As few over-reporters were identified (n = 4), these were combined with plausible-reporters and a binary categorical variable (under-reporter and plausible-reporter) was used in analyses.
Diet, physical activity, anthropometry, medications, clinical and haematological measures including HbA1c were assessed at three timepoints (0, 6 and 12 months post-randomisation). HbA1c was measured in plasma using HPLC in a single laboratory. Oral hypoglycaemic agents (OHAs), namely metformin, sulphonylureas and glitazones, were recorded by trial clinicians as type and dose. Physical activity was assessed over 7 days via waist-worn, uni-axial accelerometers (Actigraph GT1M; Actigraph LLC, Pensacola, FL, USA), with data processing as detailed previously . Participants were additionally scored against the 2007 UK Index of Multiple Deprivation (IMD) based on their home postcode at baseline . Covariates used for analyses were 0-, 6-, and 12-month percentages of maximum OHA medication dose, average daily total physical activity, bodyweight and TEI, and baseline age, sex and dietary-misreporting status.
Variables were described with the use of mean (standard deviation (SD) or 95% confidence interval (95%CI)) if normally distributed or median (quartile 1, quartile 3) otherwise. Associations between participant characteristics and changes in dietary patterns and high pattern loading food groups were explored by describing the sample by quintile of dietary pattern score change. To help understand what a 1-SD change in dietary pattern score means, nutrient intake changes relating to a 1-SD increase in dietary pattern score were calculated using simple linear regression, with dietary pattern score as predictor and either DED, fibre-density or percentage energy from the relevant nutrient as outcomes.
The primary outcome of this study was change in HbA1c over 0–6 months (0–6 m), a period when no changes in medications were made and thus diet had the most potential to affect HbA1c. Changes in HbA1c during 6–12 months (6–12 m) or 0–12 months (0–12 m) were explored as secondary outcomes, adjusting for changes in medications during the latter half of the trial. Trial periods were thus modelled separately to distinguish effects attributable to lifestyle only to that of lifestyle and medications combined.
A series of multivariable linear regressions were used to assess whether dietary pattern changes during 0–6 m were associated with glycaemic control, as measured through change in HbA1c. Model 1 estimated the unadjusted association between each dietary pattern score change (exposure) and HbA1c change using end-of-period (6-month) HbA1c as the outcome, adjusting for start-of-period (baseline) HbA1c and dietary pattern score. Model 2 estimated the association independent of potential confounders by adding to model 1, age, sex, misreporting status and period-change in total physical activity. Model 3 estimated potential mediation by adding period-change in TEI and bodyweight to model 2. To assess the subsequent 6-month and longer-term association between dietary pattern change and HbA1c, we repeated models 1–3 for 6–12 m and 0–12 m periods. In these models, we additionally adjusted for OHA medication change within models 2 and 3. Units of dietary pattern change effect estimates within these models were for an equivalent 1-SD change in baseline dietary pattern score. We considered p < 0.05 being evidence of association.
We ran a series of sensitivity analyses to check our assumptions relating to missing data, linearity of associations, interactions by sex, model adjustment with trial arm and associations between bodyweight and HbA1c change (Additional file 1: Supplementary information S2).
Analyses were performed in Stata (v15; StataCorp LLC, College Station, TX, USA), with the RRR procedure incorporating SAS (v9; SAS Institute, NC, USA) (Additional file 1: Supplementary information S3).