Skip to main content

Association between dietary magnesium intake and gallstones: the mediating role of atherogenic index of plasma



Dyslipidemia and abnormalities in cholesterol metabolism are commonly observed in individuals with gallstone disease. Previous research has demonstrated that dietary magnesium can influence lipid metabolism. The atherogenic index of plasma (AIP) has emerged as a novel lipid marker. This study aimed to examine the possible correlation between dietary magnesium intake and gallstones and the potential mediating role of AIP in US adults.


A total of 4,841 adults were included in this study from the National Health and Nutrition Examination Survey (NHANES) conducted from 2017 to 2020. A variety of statistical techniques such as logistic regression, subgroup analysis, smoothed curve fitting, and causal mediation analysis were utilized to analyze the information collected from the participants.


In the fully adjusted model, a statistically noteworthy inverse relationship was observed between dietary magnesium intake and the presence of gallstones, as indicated by an odds ratio (OR) of 0.58 and a 95% confidence interval (CI) of (0.42, 0.81). Causal intermediary analysis revealed that the association between magnesium intake and gallstones was partially mediated by AIP, with a mediation ratio of 3.2%.


According to this study, dietary magnesium intake had a significant linear negative association with the prevalence of gallstones, in which AIP played a mediating role. This discovery offers novel perspectives on the prevention and management of gallstones.


Gallstones represent a prevalent gastrointestinal ailment impacting 10-15% of the global populace, with varying incidence rates among nations [1]. In the United States, approximately 10-20% of adults currently harbor gallstones, a figure that is on the rise [2]. The annual cost of preventing and treating gallstone disease in the United States has been calculated to be approximately $62 billion, placing a significant financial burden on the healthcare economy [3]. Complications related to gallstones, including cholecystitis, acute suppurative cholangitis, and pancreatitis, manifest in approximately 20% to 40% of individuals with gallstones, with an annual occurrence rate ranging from 1% to 3% [1, 4]. In addition, gallstones increase the likelihood of gallbladder cancer and the prognosis for gallbladder cancer is poor [5, 6]. Therefore, valid and controlled clinical indicators are essential to predict or prevent the development of gallstones.

The atherogenic index of plasma (AIP) was first proposed by Dobiásová M and colleagues in 2001 and was initially used to monitor dyslipidemia and to assess the degree of atherosclerosis [7]. This index combines levels of triglycerides (TG) and high-density lipoprotein cholesterol (HDL-C), reflecting not only the ratio of pro-atherosclerotic to protective lipids in plasma but also the particle size and rate of esterification of HDL-C particle size and rate of esterification [8]. Evidence suggests that AIP is more specific than a single lipid marker in the diagnosis and detection of cardiovascular and dyslipidemia diseases [8, 9]. Consequently, AIP has emerged as a critical parameter within the field of lipidology, subject to ongoing research aimed at uncovering its broader clinical applications.

Magnesium, represented by the chemical symbol Mg, is naturally present in a regular diet and ranks as the body's fourth most plentiful mineral [10]. The decrease in dietary magnesium consumption in developed countries in recent years can be linked to the increasing occurrence of diets low in magnesium, which include processed and fast foods. As a result, a considerable portion of the American population does not meet the recommended average amount of magnesium intake [11]. Inadequate dietary magnesium intake has been linked to the development of multi-system diseases, including cognitive impairment, type 2 diabetes, depression, and metabolic syndrome [12,13,14]. Additionally, magnesium modulates systemic inflammation, modifies dyslipidemia, and mitigates the likelihood of hypertension and cardiovascular disease [15]. Nevertheless, few studies have reported a correlation between the consumption of magnesium-rich foods and the occurrence of gallstones. The precise mechanism responsible for this correlation remains uncertain, as magnesium influences lipid levels.

Thus, the novelty of this study resides in its unique investigation of data from a public database to validate the relationship between dietary magnesium and gallstones, as well as the moderating influence of AIP, within a substantial sample population. The primary objective was to determine if there exists a disparity in magnesium consumption between individuals with and without gallstones to propose fresh recommendations for clinical gallstone treatment. Additionally, the secondary goal was to analyze whether dietary magnesium mediated the intended association through the lipid parameter AIP.

Methodology of the study

Study design and subject inclusion and exclusion

The survey data utilized in this study is derived from the U.S. National Health and Nutrition Examination Survey (NHANES) conducted biennially between 2017 and 2020. NHANES offers a comprehensive evaluation and analysis of the overall nutrition and health condition of the American populace, overseen by the National Center for Health Statistics (NCHS). The NHANES employs a dynamic, multi-stage, and probability-based complex sampling design through household interviews at respondents' residences, physical examinations at mobile health screening centers, and specialized tests in laboratories, thus ensuring the accuracy and representativeness of the data [16, 17]. Approval for the survey was obtained from the Ethics Committee of the Centers for Disease Control and Prevention (CDC), with all participants providing informed consent. Comprehensive information regarding the dataset, documentation, and protocols can be accessed at no cost on the NHANES website [18].

Initially, this study excluded individuals with incomplete gallstone information on the Medical Health Questionnaire (n = 6,350). Subsequently, participants with missing data on lipid markers, liver enzymes, and dietary information were excluded. Furthermore, 23 patients who had previously undergone bariatric surgery were eliminated from the analysis. After taking into account pharmacological considerations, individuals using medications that elevate the likelihood of gallstones and impact lipid metabolism (such as glucagon-like peptide-1 receptor agonists, lipid-lowering drugs, and peroxisome proliferator-activated receptor-gamma-affecting drugs) were excluded from the study. Ultimately, a total of 4,841 subjects were selected for inclusion in this analysis. The detailed procedure of subject screening is illustrated in Figure 1, offering a comprehensive account of the process.

Fig. 1
figure 1

Flowchart of participant selection from NHANES 2017-2020

Definition of gallstones

In a survey conducted by trained professional interviewers, respondents were asked the question: "Has a doctor or other health professional ever diagnosed you with gallstones?" The findings of the survey revealed that individuals who responded affirmatively were classified as having gallstones, while those who responded negatively were deemed to be free of gallstone disease. This simple and easy method has been employed in prior research studies [19, 20].

Definition of AIP

HDL-C and TG data were assayed by the University of Minnesota laboratory under strict quality control and supervision. AIP was calculated by applying the formula: AIP = Log [TG (mmol/L) / HDL-C (mmol/L)] [21]. In the present study, AIP was recognized as a mediating variable that held particular significance.

Dietary magnesium intake

A multichannel approach was used to collect data on magnesium intake from 24-hour dietary recalls. The respondent-driven approach gathers precise data on every food and drink consumed by an individual within 24 hours, from midnight to midnight. Each participant was asked to participate in two 24-hour total nutritional intake recall interviews. The initial recall involved an in-person interview with an investigator at a mobile screening facility, while the subsequent recall took place via telephone within a span of 3 to 10 days [22]. Considering that some participants regularly consumed magnesium-containing supplements, their magnesium intake from dietary supplements was added to their total magnesium intake. In cases where an individual completed two 24-hour dietary records, the average magnesium intake from both records was utilized. Otherwise, the data from the initial 24-hour dietary record was employed.

Ascertainment of covariates

To thoroughly examine the possible link between magnesium consumption and gallstones, this study took into account a wide range of covariates such as demographic information, diet details, physical measurements, laboratory tests, and questionnaire responses. NHANES gathered 24-hour dietary data from participants between 2017 and March 2020 with the help of trained interviewers. Dietary intake was obtained from two 24-hour dietary records and averaged twice [23, 24]. The physical examination module incorporated measurements of subjects' blood pressure and body mass index (BMI), in addition to other relevant parameters. Laboratory tests were conducted on lipid and biochemical parameters obtained from participants during the survey period. Liver enzymes, specifically alanine aminotransferase (ALT), aspartate aminotransferase (AST), and glutamyl transferase (GGT), were included as covariates to provide additional insight into the liver health of the subjects. Hypertension was diagnosed when the subject had a systolic blood pressure ≥140 mmHg and a diastolic blood pressure ≥90 mmHg at the mean of three measurements of body circulatory arterial pressure taken at rest or was told or self-reported by a healthcare professional to be hypertensive and/or was taking antihypertensive medication [25]. Diabetes mellitus meets the following criteria: fasting blood glucose level ≥ 7.0 mmol/L, or glycosylated hemoglobin≥ 6.5%, has been informed by a doctor or admitted to having diabetes mellitus, and/or is using medication or insulin to control blood glucose [26]. The diagnosis of fatty liver is determined through the use of vibration-controlled transient elastography, a non-invasive and painless procedure that measures controlled attenuation parameters (CAP). CAP ≥274 dB/m indicates a fatty liver state and CAP ≥302 dB/m is defined as severe fatty liver [27, 28]. Based on the self-reported questionnaire, smoking behaviors were classified into three categories: never-smokers, former smokers, and current smokers. Based on previous studies, alcohol consumption was categorized into four levels: heavy drinking (≥4 drinks/day for men, ≥3 drinks/day for women, or ≥5 days of drinking in a month), moderate drinking (≥3 drinks/day for men, ≥2 drinks/day for women, or ≥2 days of drinking in a month), mild drinking (≤2 drinks/day for men, ≤1 drink/day for women, and ≥12 drinks in a year), and never-drinking (total number of drinks in a year <12, and dietary alcohol content of 0%) [29].

Statistical analysis

Continuous variables collected from participants were tested for normality according to the characteristics of the data, and data obeying a normal distribution were expressed as mean ± standard deviation (SD), while data not obeying a normal distribution were expressed as median and interquartile range (IQR). Qualitative variables were expressed as relative numbers or percentages. To avoid multicollinearity, variance inflation factor (VIF) and tolerance were used to assess the covariates, and the VIF of all covariates included in this study was less than 5, indicating the absence of severe multicollinearity [30]. Due to the skewed distribution of dietary magnesium intake, data were transformed using natural logarithms before analyses and analyzed as continuous variables (per 1-SD increment) in multivariate models and mediation analyses. Differences between subjects grouped by quartiles of magnesium intake were compared in multivariable logistic regression, using quartile 1 (Q1) as the reference group. Four logistic models were developed for the analyses: Model 1 was not adjusted for any confounding variables and was a Univariate analysis. Model 2 was adjusted for the main demographic variables (sex, age, and ethnicity). Model 3 adds smoking, alcohol consumption, marital status, education, ratio of household income to poverty (PIR), BMI, hypertension, fatty liver, diabetes, lipids, and liver enzymes to Model 2. Considering the confounding effect of dietary factors on gallstones, Model 4 further incorporated micronutrients such as carbohydrates, proteins, fats, water, calcium, iron, and zinc [31]. In addition, subgroup analyses were conducted to examine the presence of heterogeneity and interactions in specific groups of the population. To visualize more closely the linear or non-linear correlation between gallstones and magnesium intake, curves were fitted using restricted cubic spline (RCS). Finally, mediation analyses were performed using the mediation package, and confidence intervals for the mediating effect were assessed using the Bootstrap method to determine the proportion of the mediating effect accounted for by AIP. Using these statistical methods, the possible causal relationship between magnesium intake and gallstones can be examined more broadly. All statistical analyses were based on R software (version 4.22) and EmpowerStats (version 4.0). Graphs were plotted using the ggplot2 package and image beautification was done using the ggprism package. Statistical significance was defined as a P value below 0.05.


Clinical baseline features of the subjects

According to their gallstone status, Table 1 summarizes the clinical baseline features of the subjects. The analysis revealed a statistically significant disparity in gender distribution, with a greater representation of females in the gallstone group (P < 0.001). Furthermore, the gallstone group exhibited a slightly higher median age (52 years versus 43 years, P < 0.001). Significant disparities were noted in biochemical and dietary parameters, including triglyceride levels and magnesium intake (p < 0.001), indicating a potential correlation between metabolism, diet, and the development of gallstones. Moreover, the P-values for the levels of alanine aminotransferase, glutamine aminotransferase, and glutamyl transpeptidase were not significant, suggesting that liver function was comparable between the two groups of subjects.

Table 1 Baseline characteristics of the gallstones group versus the no-gallstones group.

Table 2 demonstrates the classification of subjects into quartiles based on dietary magnesium intake. It can be seen from the table that participants in the fourth quartile (6.44%) had a significantly lower incidence of gallstones compared to the first quartile (10.50%).

Table 2 Baseline characteristics of the study population based on dietary magnesium intake

Logistic regression analysis

The results of the logistic regression analyses for the four models are summarized in Table 3. Model 1, unadjusted for covariates, revealed a negative correlation between magnesium intake and gallstones, with an odds ratio of 0.66 (95% CI: 0.54-0.81; P < 0.0001). The odds ratio of Model 2, after controlling for the primary demographic covariates, closely aligns with those of Model 1. Model 3 expanded upon Model 2 by including additional variables such as education level, BMI, smoking habits, marital status, PIR, alcohol consumption, underlying diseases (hypertension, diabetes, fatty liver), and biochemical indicators (TG, HDL-C, total cholesterol, ALT, AST, and GGT). Despite these adjustments, the inverse relationship between magnesium intake and gallstones remained statistically significant (OR = 0.73; 95% CI: 0.58-0.91; P = 0.0048). Interestingly, this negative correlation became even more pronounced in Model 4 after controlling for all confounders (OR = 0.58; P = 0.0015). This indicates that each unit increase in dietary magnesium intake (converted to natural logarithms) was associated with a 42% reduction in the incidence of gallstones. Further dividing magnesium intake into quartiles, the negative association between magnesium and gallstones remained. In model 4, the incidence of gallstones was 40% lower in the population in the highest dietary magnesium intake group (Q4) compared with the lowest intake group (Q1).

Table 3 Odds ratios and 95% confidence intervals for gallstones according to dietary magnesium intake

AIP and gallstones are correlated according to multivariate logistic regression provided in Table 4. According to the initial model, AIP levels were significantly and positively associated with gallstones (OR = 1.61; 95% CI: 1.17-2.20; P = 0.0032). Notably, the stable positive correlation in Model 2 was particularly evident when sex, age, and race were considered (OR = 2.27; P < 0.0001). Model 3 remained stable after continuing to include the variables of smoking, alcohol consumption, education level, marital status, PIR, total blood cholesterol, hypertension, fatty liver, diabetes, and liver enzymes. Subsequently, Model 4 incorporated additional dietary variables such as protein, carbohydrate, fat, water, calcium, iron, and zinc, and the notable positive association between AIP levels and gallstone prevalence persisted (OR = 1.57; 95% CI: 1.05-2.35; P = 0.0283).

Table 4 Multiple logistic regression of the association between AIP and gallstones

Subgroup analysis

A subgroup analysis was conducted on Model 4 to investigate potential variations in the relationship between gallstones and dietary magnesium intake among different populations. The findings are presented in Figure 2. It is noteworthy that the inverse correlation between magnesium intake and the incidence of gallstones was notably significant in subgroups consisting of females, individuals under the age of 60, individuals with hypertension, individuals without diabetes mellitus, individuals without fatty liver disease, and individuals who were smokers (all P values < 0.05). However, the P-value for interaction > 0.05 indicates that there is no significant interaction across groups.

Fig. 2
figure 2

Subgroup analysis for the association between dietary magnesium intake and gallstones

Restricted cubic spline curve fitting

Figure 3 depicts the relationship between magnesium intake and gallstones using a restricted cubic spline curve (RCS), and the density of distribution of participants according to magnesium intake. Subfigures A to D depicts the dose-response relationship between magnesium intake and gallstones after adjusting for different covariates, respectively. As magnesium intake increased, the incidence of gallstones gradually decreased. Overall, there was a linear negative correlation between magnesium intake and gallstones, which was particularly evident in subfigure C (Nonlinear P = 0.901).

Fig. 3
figure 3

RCS curve fit between magnesium intake and gallstones. Notes: Solid lines represent smooth curve fits between variables. Shaded bands represent 95 per cent confidence intervals from the fit. Subfigure A: no adjustment for covariates. Subfigure B: adjusted for sex, age, and race. Subfigure C: adjusted for sex, age, race, education level, marital status, PIR, BMI, hypertension, diabetes mellitus, fatty liver, smoking, alcohol consumption, TG, HDL-C, TC, ALT, AST, and GGT. Subfigure D: adjusted for sex, age, race, education level, marital status, PIR, BMI, hypertension, diabetes mellitus, fatty liver, smoking, alcohol consumption, TG, HDL-C, TC, ALT, AST, GGT, protein intake, carbohydrate intake, fat intake, water intake, calcium intake, iron intake, and zinc intake

The intermediary role of AIP

Causal mediation analysis was conducted to explore the potential mediating role of AIP in the relationship between dietary magnesium intake and the development of gallstones. Figure 4 depicts the mediation model and pathway, where magnesium intake is treated as the independent variable, AIP as the mediator, and gallstones as the dependent variable. The findings indicated that dietary magnesium had a notable indirect impact on the prevalence of gallstones via AIP, exhibiting an indirect effect size of 0.003 (95% CI: 0.001, 0.005; P < 0.001), indicating that AIP served as a partial mediator in the association between magnesium and gallstones. Furthermore, even after adjusting for AIP, the relationship between dietary magnesium intake and gallstones remained statistically significant (P < 0.001), demonstrating a significant direct effect. This suggests that there are both direct and indirect effects of AIP on dietary magnesium intake and gallstone occurrence, with approximately 3.2% being mediated by AIP. The results of the mediation analyses, including direct effects, indirect effects, total effects, and mediation ratios, are presented in Table 5.

Fig. 4
figure 4

Mediated analysis model path diagram. Notes: Dietary magnesium intake was defined as the independent variable; gallstones as the dependent variable; and AIP as the mediating variable. Path a represents the regression coefficient of the association between dietary magnesium intake and AIP. Path b represents the regression coefficient of the association between AIP and gallstones. Path c represents the simple total effect of dietary magnesium intake on gallstones. Path c' represents the direct effect of dietary magnesium intake on gallstones when controlling for AIP

Table 5 Mediation analysis of AIP in the association between magnesium intake and gallstones


The present study provides new insights and findings on the mediating role of AIP in the association between dietary magnesium intake and gallstones. By examining a sample of 4,841 adults, a strong association was found between the consumption of magnesium-rich foods and a lower incidence of gallstones, which could potentially be attributed to the role of magnesium in improving blood lipid levels. It is worth noting that this negative correlation association remains stable after gradually adjusting for confounding covariates from Model 1 to Model 4. Subgroup analyses showed that the effect of magnesium intake on gallstones was more pronounced in women, hypertensive patients, non-diabetic patients, patients without fatty liver disease, and smokers. A linear negative correlation was found between dietary magnesium intake and the occurrence of gallstones by using RCS curve fitting. Overall, adequate magnesium intake reduces the incidence of gallstones to some extent, and this negative correlation is partly mediated by AIP.

In recent years, more and more scholars have begun to focus on the biological and lipid markers associated with gallstones, and have gradually reported the potential associations between gallstones and a variety of factors such as metabolism and environment. Li et al. [32] conducted a cross-sectional study that revealed a positive correlation between elevated cobalt blood levels and increased prevalence of gallstones, particularly among female individuals, those aged 60 and above, individuals with hypertension, and individuals with diabetes. Ke and colleagues' study [33] revealed a significant correlation between weight-adjusted waist circumference index (WWI) and heightened susceptibility to gallstones among adults in the United States. Upon thorough adjustment for potential confounding variables, it was determined that a one-unit rise in WWI corresponded to a 34% rise in the likelihood of developing gallstones. These findings indicate that WWI may offer greater predictive utility in clinical settings compared to traditional measures of obesity and metabolic health. Chen et al. [34] conducted a fundamental study demonstrating the critical role of proprotein convertase subtilisin/kexin type 9 (PCSK 9) in the pathogenesis of gallstones. PCSK 9, a serine protease, plays a crucial role in regulating cholesterol metabolism and its dysregulation has been associated with the development and progression of gallstones. As the levels of PCSK9 increase in the liver of individuals with gallstones, there is a corresponding increase in cholesterol levels, exhibiting a negative correlation with bile acid levels[35, 36]. Inhibitors of PCSK 9 offer a promising therapeutic strategy for promoting cholesterol conversion to bile acids, thereby presenting a novel target for the clinical management of gallstones. Moreover, a recent systematic review indicates that PCSK9, beyond its role in lipid metabolism, is intricately linked to various diseases including atherosclerosis, central nervous system disorders., sepsis, and chronic renal failure [37]. The above findings highlight the rationale for incorporating multiple indicators when assessing gallstone risk and provide a basis for elucidating the intricate etiology of gallstones. However, the current scholarly literature lacks a thorough exploration of the potential link between dietary magnesium and gallstones, and it remains uncertain whether magnesium mitigates gallstone risk through modulation of AIP (a new biomarker for lipid metabolism disorders and inflammation).

This study is an original use of a public database to examine the relationship between gallstones and dietary magnesium intake and to explore the potential moderating role of AIP. In previous epidemiological studies, a variety of systemic diseases have been studied in depth about AIP. In a large prospective cohort study, Zhang et al. [38] observed a 30% rise in the likelihood of myocardial infarction with each incremental unit increase in AIP. This indicates that prolonged elevation of AIP levels may heighten the likelihood of myocardial infarction within the general populace. Through a cross-sectional examination of 7,017 Chinese subjects, Xu et al. [39] identified a significant correlation between AIP and hyperuricemia. Even after excluding individuals taking long-term lipid-lowering medications, the findings remained consistent in sensitivity analyses. AIP exhibited superior discriminatory capability compared to other lipid markers in the prediction of hyperuricemia. Lin et al. [40] demonstrated that AIP served as a robust independent risk factor for NAFLD among patients with type 2 diabetes. In addition, they assessed the diagnostic ability of AIP for NAFLD using a subject operating characteristic curve with a specificity and sensitivity of 90.1% and 65%, respectively. In addition to being associated with atherosclerosis, AIP, as a novel lipid marker, has also been associated with a variety of systemic diseases.

There is evidence of a link between dietary magnesium intake and lipid metabolism. In both animal and clinical investigations, diets lacking in magnesium have been found to increase levels of triglycerides in the bloodstream while simultaneously decreasing levels of HDL-C [41,42,43,44,45]. HDL-C is a factor that provides protection against cardiovascular disease and is significantly and inversely associated with the extent of arterial lumen stenosis [46, 47]. HDL-C facilitates the transportation of cholesterol to surrounding tissues, where it is converted to bile acids or directly from the bile through the intestines to the biliary system, thereby reducing the risk of gallstones [48]. Jin and colleagues performed a retrospective analysis on a cohort of 12,284 participants surveyed between 2001 and 2013, utilizing data from the NHANES database. The findings indicated a positive correlation between magnesium intake and HDL-C levels among female individuals. In contrast, magnesium intake was negatively related to TG levels in both men and women [49]. AIP is a quantitative metric utilized for evaluating lipid metabolism through the integration of triglycerides and HDL cholesterol. This index provides valuable information about the ratio of triglycerides to HDL cholesterol and the size of lipoprotein particles. Nonetheless, the precise mechanism through which dietary magnesium intake influences AIP levels and the mediating role of AIP in heightening susceptibility to gallstones remain uncertain and can be elucidated through various potential biological mechanisms. Firstly, magnesium regulates the activation of genes associated with lipid degradation, such as peroxisome proliferator-activated receptors (PPARs), and a deficiency in dietary magnesium promotes the generation of oxygen-free radicals, resulting in an elevation in the secretion of mucus glycoproteins in the gallbladder [45, 50, 51]. Secondly, magnesium regulates the activity of lipoprotein lipase (LPL), a key enzyme involved in the hydrolysis of triglycerides from circulating lipoproteins, thereby regulating blood triglyceride levels. Studies have shown that magnesium improves lipoprotein clearance, thereby increasing the clearance of triglyceride-rich lipoproteins and lowering plasma triglycerides, which further affects AIP levels [52]. According to Andreotti et al. [53], there was a significant correlation between elevated TG levels, decreased HDL-C levels, and an elevated susceptibility to gallstones. Finally, magnesium plays a significant role as a primary coenzyme in numerous enzymatic processes and serves as a crucial facilitator of insulin's impact on cells [53, 54]. Insufficient magnesium disrupts the enzymatic processes responsible for generating adenosine triphosphate and the required tyrosine kinase activity for insulin function. Additionally, it modifies the enzymatic reactions related to glucose metabolism, resulting in the development of insulin resistance [55,56,57]. Yin et al. illustrated a noteworthy, non-linear, positive correlation between insulin resistance and AIP. Reduced insulin sensitivity and elevated concentrations are the main features of insulin resistance, which may increase AIP levels as well as cholesterol saturation in bile, thereby promoting gallstone formation [58, 59].

The current study offers compelling evidence supporting a relationship between dietary magnesium intake and gallstones, as well as establishing a connection with the lipid metabolism marker AIP. Given that TG and HDL-C can be derived from standard blood biochemical markers, the calculation of AIP is both cost-effective and easily implemented in clinical settings. Furthermore, the direct calculation of AIP through a formula circumvents the need for intricate physical examinations and laboratory procedures, thereby enhancing its utility in the early detection of gallstone risk. This suggests to clinical providers that promoting a sensible diet should be a priority for patients with persistently high AIP. Appropriate supplementation with magnesium-rich foods or magnesium supplements is a proven method of preventing gallstones.

Strengths and limitations of the study

This study demonstrates multiple strengths. Firstly, it is the inaugural cross-sectional study to examine how magnesium intake correlates with gallstone risk, incorporating lipid parameters for causal mediation analyses, thus offering novel perspectives on gallstone prevention and treatment. Secondly, the data utilized in this study came from a comprehensive database containing a large population sample, thus enhancing the representativeness of the findings. Lastly, the statistical adjustment of covariates in the model was conducted rigorously, resulting in more robust and persuasive conclusions. This study has some limitations, of course. Firstly, the diagnosis of gallstones was based only on responses to a medical health questionnaire and lacked a more precise imaging diagnosis. Secondly, dietary data was obtained through a 24-hour food interview, which may not accurately reflect long-term dietary habits and could be influenced by recall bias. Third, serum magnesium information was not collected from participants in the NHANES survey conducted between 2017 and March 2020, and whether dietary magnesium intake may in turn affect gallstone formation by altering serum magnesium levels needs to be explored in future more comprehensive prospective cohort studies.


According to this study, dietary magnesium intake had a significant linear negative association with the prevalence of gallstones, in which AIP played a mediating role. This finding now provides valuable recommendations for the prevention and treatment of gallstones, enlightening healthcare professionals that rational supplementation of magnesium-containing foods may reduce the risk of gallstones risk by modulating lipid metabolism.

Availability of data and materials

No datasets were generated or analysed during the current study.



National Health and Nutrition Examination Survey


Body mass index


The National Center for Health Statistics


Centers for Disease Control and Prevention


Confidence interval


Standard deviation


Controlled attenuation parameters


Variance inflation factor


Median and interquartile range


Odds ratio


Ratio of household income to poverty


Atherogenic index of plasma


Alanine aminotransferase


General equivalency diploma




Aspartate aminotransferase


Gamma glutamyl transferase


Total cholesterol


High-density lipoprotein cholesterol


proprotein convertase subtilisin/kexin type 9


  1. Pisano M, Allievi N, Gurusamy K, Borzellino G, Cimbanassi S, Boerna D, Coccolini F, Tufo A, Di Martino M, Leung J, et al. 2020 World Society of Emergency Surgery updated guidelines for the diagnosis and treatment of acute calculus cholecystitis. World J Emerg Surg. 2020;15(1):61.

    Article  PubMed  PubMed Central  Google Scholar 

  2. Sheng B, Zhao Q, Ma M, Zhang J. An inverse association of weight and the occurrence of asymptomatic gallbladder stone disease in hypercholesterolemia patients: a case-control study. Lipids Health Dis. 2020;19(1):228.

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  3. Grigor'eva IN, Romanova TI. Gallstone Disease and Microbiome. Microorganisms. 2020;8(6):35.

  4. Zdanowicz K, Daniluk J, Lebensztejn DM, Daniluk U. The Etiology of Cholelithiasis in Children and Adolescents-A Literature Review. Int J Mol Sci. 2022;23(21):13376.

  5. Randi G, Franceschi S, La Vecchia C. Gallbladder cancer worldwide: geographical distribution and risk factors. Int J Cancer. 2006;118(7):1591–602.

    Article  CAS  PubMed  Google Scholar 

  6. Yoo EH, Lee SY. The prevalence and risk factors for gallstone disease. Clin Chem Lab Med. 2009;47(7):795–807.

    Article  CAS  PubMed  Google Scholar 

  7. Fernández-Macías JC, Ochoa-Martínez AC, Varela-Silva JA, Pérez-Maldonado IN. Atherogenic Index of Plasma: Novel Predictive Biomarker for Cardiovascular Illnesses. Arch Med Res. 2019;50(5):285–94.

    Article  PubMed  Google Scholar 

  8. Dobiásová M, Frohlich J. The plasma parameter log (TG/HDL-C) as an atherogenic index: correlation with lipoprotein particle size and esterification rate in apoB-lipoprotein-depleted plasma (FER(HDL)). Clin Biochem. 2001;34(7):583–8.

    Article  PubMed  Google Scholar 

  9. Cai G, Shi G, Xue S, Lu W. The atherogenic index of plasma is a strong and independent predictor for coronary artery disease in the Chinese Han population. Medicine (Baltimore). 2017;96(37):e8058.

    Article  PubMed  Google Scholar 

  10. Garrison SR, Korownyk CS, Kolber MR, Allan GM, Musini VM, Sekhon RK, Dugré N. Magnesium for skeletal muscle cramps. Cochrane Database Syst Rev. 2020;9(9):Cd009402.

    PubMed  Google Scholar 

  11. Sakaguchi Y, Hamano T, Isaka Y. Effects of magnesium on the phosphate toxicity in chronic kidney disease: time for intervention studies. Nutrients. 2017;9(2):112.

  12. Chou MH, Yang YK, Wang JD, Lin CY, Lin SH. Elevated C-reactive protein levels modify the effect of magnesium on depressive symptoms: a population-based study. Nutrients. 2023;15(7):1560.

  13. Huang J, Hu L, Yang J. Dietary magnesium intake ameliorates the association between household pesticide exposure and type 2 diabetes: data from NHANES, 2007–2018. Front Nutr. 2022;9:903493.

    Article  PubMed  PubMed Central  Google Scholar 

  14. Tao MH, Liu J, Cervantes D. Association between magnesium intake and cognition in US older adults: National Health and Nutrition Examination Survey (NHANES) 2011 to 2014. Alzheimers Dement (N Y). 2022;8(1):e12250.

    Article  PubMed  Google Scholar 

  15. Jiao Y, Li W, Wang L, Jiang H, Wang S, Jia X, Wang Z, Wang H, Zhang B, Ding G. Relationship between Dietary Magnesium Intake and Metabolic Syndrome. Nutrients. 2022;14(10):2013.

  16. Curtin LR, Mohadjer LK, Dohrmann SM, Kruszon-Moran D, Mirel LB, Carroll MD, Hirsch R, Burt VL, Johnson CL. National Health and Nutrition Examination Survey: sample design, 2007–2010. Vital Health Stat 2. 2013;160:1–23.

    Google Scholar 

  17. Johnson CL, Dohrmann SM, Burt VL, Mohadjer LK. National health and nutrition examination survey: sample design, 2011–2014. Vital Health Stat 2. 2014;162:1–33.

    Google Scholar 

  18. Skrivankova VW, Richmond RC, Woolf BAR, Yarmolinsky J, Davies NM, Swanson SA, VanderWeele TJ, Higgins JPT, Timpson NJ, Dimou N, et al. Strengthening the reporting of observational studies in epidemiology using mendelian randomization: the STROBE-MR statement. JAMA. 2021;326(16):1614–21.

    Article  PubMed  Google Scholar 

  19. Meng C, Liu K. Higher levels of systemic immune-inflammatory index are associated with the prevalence of gallstones in people under 50 years of age in the United States: a cross-sectional analysis based on NHANES. Front Med (Lausanne). 2023;10:1320735.

    Article  PubMed  Google Scholar 

  20. Wang J, Sun YX, Xiang S, Yang C, Li XJ, Zhang MQ, Li YJ, Li XX, Qiu ZK. The association between blood heavy metals and gallstones: a cross-sectional study. Sci Total Environ. 2023;904:166735.

    Article  CAS  PubMed  Google Scholar 

  21. Niroumand S, Khajedaluee M, Khadem-Rezaiyan M, Abrishami M, Juya M, Khodaee G, Dadgarmoghaddam M. Atherogenic Index of Plasma (AIP): A marker of cardiovascular disease. Med J Islam Repub Iran. 2015;29:240.

    PubMed  PubMed Central  Google Scholar 

  22. Li XY, Liu H, Zhang LY, Yang XT. The association of healthy eating index with periodontitis in National Health and Nutrition Examination Study 2011–2012. Front Nutr. 2022;9:999620.

    Article  PubMed  PubMed Central  Google Scholar 

  23. Huang X, Zhao L, Li Z, Gu X, Li M, Xiang J. Association of niacin intake with constipation in adult: result from the National Health and Nutrition Examination. Eur J Med Res. 2023;28(1):377.

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  24. Zhao X, Wang L, Quan L. Association between dietary phosphorus intake and chronic constipation in adults: evidence from the National Health and Nutrition Examination Survey. BMC Gastroenterol. 2023;23(1):24.

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  25. Grundy SM, Stone NJ, Bailey AL, Beam C, Birtcher KK, Blumenthal RS, Braun LT, de Ferranti S, Faiella-Tommasino J, Forman DE, et al. 2018 AHA/ACC/AACVPR/AAPA/ABC/ACPM/ADA/AGS/APhA/ASPC/NLA/PCNA Guideline on the Management of Blood Cholesterol: A Report of the American College of Cardiology/American Heart Association Task Force on Clinical Practice Guidelines. Circulation. 2019;139(25):e1082–143.

    PubMed  Google Scholar 

  26. Neves JS, Leitão L, Magriço R, Bigotte Vieira M, Viegas Dias C, Oliveira A, Carvalho D, Claggett B. Caffeine Consumption and Mortality in Diabetes: An Analysis of NHANES 1999–2010. Front Endocrinol (Lausanne). 2018;9:547.

    Article  PubMed  Google Scholar 

  27. Tang M, Liu M, Zhang Y, Xie R. Association of family income to poverty ratio and vibration-controlled transient elastography quantified degree of hepatic steatosis in U.S. adolescents. Front Endocrinol (Lausanne). 2023;14:1160625.

    Article  PubMed  Google Scholar 

  28. Xie R, Xiao M, Li L, Ma N, Liu M, Huang X, Liu Q, Zhang Y. Association between SII and hepatic steatosis and liver fibrosis: a population-based study. Front Immunol. 2022;13:925690.

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  29. Rattan P, Penrice DD, Ahn JC, Ferrer A, Patnaik M, Shah VH, Kamath PS, Mangaonkar AA, Simonetto DA. Inverse association of telomere length with liver disease and mortality in the US population. Hepatol Commun. 2022;6(2):399–410.

    Article  CAS  PubMed  Google Scholar 

  30. Liu M, Zhang Z, Zhou C, Ye Z, He P, Zhang Y, Li H, Liu C, Qin X. Predicted fat mass and lean mass in relation to all-cause and cause-specific mortality. J Cachexia Sarcopenia Muscle. 2022;13(2):1064–75.

    Article  PubMed  PubMed Central  Google Scholar 

  31. van Erpecum KJ. Biliary lipids, water and cholesterol gallstones. Biol Cell. 2005;97(11):815–22.

    Article  PubMed  Google Scholar 

  32. Li Y, Han H, You K, Ma C, Fan X. Investigating the association between blood cobalt and gallstones: a cross-sectional study utilizing NHANES data. Front Public Health. 2024;12:1363815.

    Article  PubMed  PubMed Central  Google Scholar 

  33. Ke B, Sun Y, Dai X, Gui Y, Chen S. Relationship between weight-adjusted waist circumference index and prevalence of gallstones in U.S. adults: a study based on the NHANES 2017–2020. Front Endocrinol (Lausanne). 2023;14:1276465.

    Article  PubMed  Google Scholar 

  34. Chen Z, Shao W, Li Y, Zhang X, Geng Y, Ma X, Tao B, Ma Y, Yi C, Zhang B, et al. Inhibition of PCSK9 prevents and alleviates cholesterol gallstones through PPARα-mediated CYP7A1 activation. Metabolism. 2024;152:155774.

    Article  CAS  PubMed  Google Scholar 

  35. Abifadel M, Varret M, Rabès JP, Allard D, Ouguerram K, Devillers M, Cruaud C, Benjannet S, Wickham L, Erlich D, et al. Mutations in PCSK9 cause autosomal dominant hypercholesterolemia. Nat Genet. 2003;34(2):154–6.

    Article  CAS  PubMed  Google Scholar 

  36. Mbikay M, Mayne J, Chrétien M. Proprotein convertases subtilisin/kexin type 9, an enzyme turned escort protein: hepatic and extra hepatic functions. J Diabetes. 2013;5(4):391–405.

    Article  CAS  PubMed  Google Scholar 

  37. Cesaro A, Bianconi V, Gragnano F, Moscarella E, Fimiani F, Monda E, Scudiero O, Limongelli G, Pirro M, Calabrò P. Beyond cholesterol metabolism: the pleiotropic effects of proprotein convertase subtilisin/kexin type 9 (PCSK9). Genetics, mutations, expression, and perspective for long-term inhibition. Biofactors. 2020;46(3):367–80.

    Article  CAS  PubMed  Google Scholar 

  38. Zhang Y, Wu S, Tian X, Xu Q, Xia X, Zhang X, Li J, Chen S, Liu F, Wang A. Elevated atherogenic index of plasma increased the risk of myocardial infarction in a general population. Ann Epidemiol. 2024;90:1–8.

    Article  CAS  PubMed  Google Scholar 

  39. Xu F, Ma C, Wang S, Li Q, Zhang Z, He M. Higher atherogenic index of plasma is associated with hyperuricemia: a national longitudinal study. Int J Endocrinol. 2024;2024:4002839.

    Article  PubMed  PubMed Central  Google Scholar 

  40. Lin J, Li H, Wan Q. A Cross-Sectional Study of the Correlation Between the Atherogenic Index of Plasma and Nonalcoholic Fatty Liver Disease in Patients with Type 2 Diabetes. Diabetes Metab Syndr Obes. 2022;15:2227–34.

    Article  PubMed  PubMed Central  Google Scholar 

  41. Delva P, Pastori C, Degan M, Montesi G, Lechi A. Intralymphocyte free magnesium and plasma triglycerides. Life Sci. 1998;62(24):2231–40.

    Article  CAS  PubMed  Google Scholar 

  42. Guerrero-Romero F, Rodríguez-Morán M. Hypomagnesemia is linked to low serum HDL-cholesterol irrespective of serum glucose values. J Diabetes Complications. 2000;14(5):272–6.

    Article  CAS  PubMed  Google Scholar 

  43. Gueux E, Cubizolles C, Bussière L, Mazur A, Rayssiguier Y. Oxidative modification of triglyceride-rich lipoproteins in hypertriglyceridemic rats following magnesium deficiency. Lipids. 1993;28(6):573–5.

    Article  CAS  PubMed  Google Scholar 

  44. Gueux E, Mazur A, Cardot P, Rayssiguier Y. Magnesium deficiency affects plasma lipoprotein composition in rats. J Nutr. 1991;121(8):1222–7.

    Article  CAS  PubMed  Google Scholar 

  45. Nozue T, Kobayashi A, Uemasu F, Takagi Y, Sako A, Endoh H. Magnesium status, serum HDL cholesterol, and apolipoprotein A-1 levels. J Pediatr Gastroenterol Nutr. 1995;20(3):316–8.

    CAS  PubMed  Google Scholar 

  46. Khatana C, Saini NK, Chakrabarti S, Saini V, Sharma A, Saini RV, Saini AK. Mechanistic insights into the oxidized low-density lipoprotein-induced atherosclerosis. Oxid Med Cell Longev. 2020;2020:5245308.

    Article  PubMed  PubMed Central  Google Scholar 

  47. Pownall HJ, Rosales C, Gillard BK, Gotto AM Jr. High-density lipoproteins, reverse cholesterol transport and atherogenesis. Nat Rev Cardiol. 2021;18(10):712–23.

    Article  CAS  PubMed  Google Scholar 

  48. Yuan X, Chen H, Zeng K, Xiao J, Liu J, Lin G, Zhang J, Lu T, Cai J, Yao J, et al. Causal associations between changes in lipid profiles and risk of gallstone disease: a two-sample Mendelian randomization study. Ann Transl Med. 2022;10(15):818.

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  49. Jin H, Nicodemus-Johnson J. Gender and age stratified analyses of nutrient and dietary pattern associations with circulating lipid levels identify novel gender and age-specific correlations. Nutrients. 2018;10(11):1760.

  50. Hale WB, Turner B, LaMont JT. Oxygen radicals stimulate guinea pig gallbladder glycoprotein secretion in vitro. Am J Physiol. 1987;253(5 Pt 1):G627-630.

    CAS  PubMed  Google Scholar 

  51. Tsai CJ, Leitzmann MF, Willett WC, Giovannucci EL. Long-term effect of magnesium consumption on the risk of symptomatic gallstone disease among men. Am J Gastroenterol. 2008;103(2):375–82.

    Article  CAS  PubMed  Google Scholar 

  52. Inoue I. Lipid metabolism and magnesium. Clin Calcium. 2005;15(11):65–76.

    PubMed  Google Scholar 

  53. Andreotti G, Chen J, Gao YT, Rashid A, Chang SC, Shen MC, Wang BS, Han TQ, Zhang BH, Danforth KN, et al. Serum lipid levels and the risk of biliary tract cancers and biliary stones: a population-based study in China. Int J Cancer. 2008;122(10):2322–9.

    Article  CAS  PubMed  PubMed Central  Google Scholar 

  54. Delva P, Degan M, Pastori C, Faccini G, Lechi A. Glucose-induced alterations of intracellular ionized magnesium in human lymphocytes. Life Sci. 2002;71(18):2119–35.

    Article  CAS  PubMed  Google Scholar 

  55. Chaudhary DP, Boparai RK, Sharma R, Bansal DD. Studies on the development of an insulin resistant rat model by chronic feeding of low magnesium high sucrose diet. Magnes Res. 2004;17(4):293–300.

    CAS  PubMed  Google Scholar 

  56. Fung TT, Manson JE, Solomon CG, Liu S, Willett WC, Hu FB. The association between magnesium intake and fasting insulin concentration in healthy middle-aged women. J Am Coll Nutr. 2003;22(6):533–8.

    Article  CAS  PubMed  Google Scholar 

  57. Song Y, Manson JE, Buring JE, Liu S. Dietary magnesium intake in relation to plasma insulin levels and risk of type 2 diabetes in women. Diabetes Care. 2004;27(1):59–65.

    Article  PubMed  Google Scholar 

  58. Dubrac S, Parquet M, Blouquit Y, Gripois D, Blouquit MF, Souidi M, Lutton C. Insulin injections enhance cholesterol gallstone incidence by changing the biliary cholesterol saturation index and apo A-I concentration in hamsters fed a lithogenic diet. J Hepatol. 2001;35(5):550–7.

    Article  CAS  PubMed  Google Scholar 

  59. Yin B, Wu Z, Xia Y, Xiao S, Chen L, Li Y. Non-linear association of atherogenic index of plasma with insulin resistance and type 2 diabetes: a cross-sectional study. Cardiovasc Diabetol. 2023;22(1):157.

    Article  CAS  PubMed  PubMed Central  Google Scholar 

Download references


The authors thank all their colleagues in the Department of General Surgery. We thank the Editeg editorial team ( for language editing certificates.



Author information

Authors and Affiliations



WYD, CY, YKW: Data collection, Investigation, Software, Design, Original manuscript. YFL, CS, YL: Conception, Graphing, Review, Data analysis. ZQT, WS: Review, Materials. WYD: Wrote the paper. All authors reviewed and agreed to the final manuscript for publication.

Corresponding authors

Correspondence to Yuan Liu or Wei Shen.

Ethics declarations

Ethics approval and consent to participate

This study used publicly available data from public databases and therefore did not require ethical approval.

Competing interests

The authors declare no competing interests.

Additional information

Publisher’s Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article's Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article's Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit The Creative Commons Public Domain Dedication waiver ( applies to the data made available in this article, unless otherwise stated in a credit line to the data.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Du, W., Yan, C., Wang, Y. et al. Association between dietary magnesium intake and gallstones: the mediating role of atherogenic index of plasma. Lipids Health Dis 23, 82 (2024).

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: