text:
## Introduction

Gastrointestinal (GI) diseases are highly prevalent in western countries. They use substantial health care resources, have a heavy societal economic burden1,2, and impact the quality of life of those affected. GI disorders include peptic ulcer disease (PUD), gastro-esophageal reflux disease (GORD), irritable bowel syndrome (IBS), and inflammatory bowel disease (IBD), and some of these disorders are commonly reported as correlated with each other3. PUD, a common GI disorder, involves breaks (ulcers) in the inner lining of the digestive tract, usually located in the stomach or proximal duodenum. In GORD, the stomach contents leak back from the stomach into the esophagus4. IBS is a chronic functional disorder of the GI system. Patients with IBS often manifest abdominal pain and altered bowel habit, with either predominantly diarrhea, constipation, or both. IBD includes Crohn’s disease (CD) and ulcerative colitis (UC), which are chronic immune dysregulation disorders causing inflammation of the GI tract.

PUD is a complex disorder, for which Helicobacter (H.) pylori infection and the use of non-steroidal anti-inflammatory drugs (NSAIDs) are the main risk factors5. The development of infection-relevant PUD is recognized to be a multistep process, with contributions from both H. pylori infection and subsequent inflammation and damage of mucosa5. Eradicating H. pylori is effective for infection-relevant PUD treatment5. However, understanding the host factors influencing H. pylori infection and subsequent response could contribute to earlier risk identification and/or prevention, especially given the increasing antimicrobial resistance worldwide5. Moreover, clinical presentation of PUD that is not associated with H. pylori infection, nor with the use of NSAIDs, are now also imposing substantial diagnostic and therapeutic challenges5,6. Lifetime prevalence of PUD in the general population has been estimated to be about 5–10%5. GORD is a multifactorial disorder and is more common in individuals with obesity and hiatal hernia7. Lifetime risk estimates of GORD have a wide range (9–26%), with a sample size-weighted mean of 15%8. An increase in the prevalence of GORD since 1995 has been reported8. IBS, a common disorder with a population lifetime risk of 11% globally9, is also likely a multifactorial disease, where hypervigilance of the central nervous system, immune activation of the intestinal mucosa, microbiome, prior infections, and diet are all suspected to play a role10. IBD is associated with many lifestyle risk factors, particularly smoking11, and lifetime risk for IBD is around 0.3% in most countries of Europe12. The genetic contributions to PUD, GORD, IBS and IBD have been well-recognized13,14,15,16, and well-powered genome-wide association studies (GWASs) have identified >200 approximately independent susceptibility loci associated with IBD17. These loci implicate pathways such as autophagy and the IL-17/IL-23 axis and provide insights into IBD pathogenesis17. IBD has been extensively studied through the GWAS paradigm17 but to a lesser extent for PUD18, GORD19,20, and IBS21,22,23. Notably, the only GWAS to date for duodenal ulcer was in a Japanese ancestry cohort18.

Our primary focus was to identify genetic susceptibility factors for PUD by conducting a GWAS using data from the UK Biobank (UKB). Given the relationship between PUD and GORD (both acid-related disorders), the comorbidity of GORD and IBS3 and the much increased sample sizes afforded by the UKB, we also present GWAS results for GORD and IBS and investigate the shared genetic architecture between them. Inflammation of the gut is a key characteristic of IBD but not IBS24, and hence differences between IBD and IBS from a genetic perspective are expected. Here, we take the opportunity to evaluate formally the genetic relationship between IBD and the more common disorders PUD, GORD, and IBS. Given increasing evidence for the importance of bidirectional signaling between the brain and the gut25,26,27,28, possibly contributing to observational associations between depression and PUD29, GORD30, IBS31, and IBD32, we explore the potential causal relationships between major depression (MD) and the four disorders using Mendelian randomization (MR).

Here, we identify eight independent and significant single nucleotide polymorphisms (SNPs) for PUD and the results highlight the role of host genetic susceptibility to infection, acid secretion, and gastric motility. We also identify a total of 11 independent and significant SNPs previously unreported for GORD and IBS. We show genetic similarity across PUD, GORD, and IBS and between these GI diseases with psychiatric disorders. Post-GWAS analyses find a link between PUD, GORD, and IBS with the nervous system. We find a significant relationship between PUD, GORD, IBS, and major depression through observational and MR analyses. Taken together, our results expand our understanding of the role of genetics in gastrointestinal diseases and add insights into relationships between these gastrointestinal diseases and their relationships with MD.

## Results

The workflow for our study is given in Supplementary Fig. 1.

### Prevalence and comorbidity

Based on disease-diagnosis (self-reported, hospital admission, primary care, and death register records) in the UKB, four case–control digestion disorder datasets were identified (Table 1), with prevalences for PUD, GORD, IBS and IBD of 3.7%, 12.0%, 6.5%, and 1.5%, respectively (Table 1). We note that the UKB prevalence rates are higher for IBD than the 0.3% aforementioned lifetime risk12. This may reflect ascertainment biases or misdiagnosis within the UKB. Disease statistics (Table 1) and comorbidity analyses (Fig. 1) help describe the UKB phenotypes. The male/female odds ratio for being a PUD case is 1.66 while for IBS it is 0.42 (Table 1), consistent with PUD being more common in men and IBS more common in women. To allow readers to interpret the phenotype data that underpin our analyses, we describe in detail the disorder co-occurrences present in UKB participant records (Fig. 1 and Supplementary Note 1), which may reflect, in part, the natural course of the symptom presentations and/or misdiagnosis. For example, it is well recognized that IBD patients may have symptoms that provide a PUD or GORD diagnosis prior to, or as part of, the endoscopies that generate an IBD diagnosis and/or monitor the disease progress. Moreover, GORD can occur as a consequence of treatment of H. pylori for PUD as H. pylori infection can reduce gastric acidity33. Here, while rates of PUD and IBD in those with GORD were significantly lower than the rate of GORD cases in the UKB as a whole, those with PUD or IBD were significantly more likely to also have GORD. For each of the PUD, GORD, IBS, and IBD (defined as the index disease), competitive comorbidity analyses tested, among the other three diseases, which disease is more prone to be comorbid with the index disease. We found that PUD is more prone to be comorbid with GORD while IBS is more likely to be comorbid with IBD (Fig. 1c).

### Full-sibling risk and heritability estimation

Using SNP-based estimates of coefficients of genetic relationship between individuals in the UKB, we estimated the full-sibling relative risk for each of the PUD, GORD, IBS, and IBD and the heritability of liability, with the assumption that the increased risk in relatives only reflect shared genetic factors (Table 1 and Fig. 1d). The estimated heritabilities for PUD, GORD, IBS, and IBD were 0.28 (95% CI: 0.18–0.37), 0.28 (95% CI: 0.23–0.33), 0.12 (95% CI: 0.05–0.19), and 0.49 (95% CI: 0.36–0.64), respectively, all significantly different from zero.

### GWAS

Genome-wide association analyses were conducted for five digestion phenotypes, the four disease-diagnosis traits (PUD, GORD, IBS, and IBD, see “Methods” section) and one trait that combined the disease-diagnosis and taking of corresponding medications and treatments (Supplementary Tables 1, 2). In clinical practice, medications for PUD also have a therapeutic effect on GORD, hence we generated the PG+M phenotype—a combination of disease-diagnosis of GORD and/or PUD and/or corresponding medications and treatments. We tested for association between 8,546,065 DNA variants and each of the five digestion phenotypes (PUD, GORD, PG+M, IBS, and IBD) in 456,327 UKB participants. A total of 66 within-trait (61 across-trait) independent variants were genome-wide significant (P < 5.0E−8) for the five digestion phenotypes analysed, of which 8 were associated with PUD, 6 with GORD, 19 with PG+M, 2 with IBS, and 31 with IBD. Two PUD-associated SNPs have been previously linked to PUD but in a Japanese cohort18. For GORD, a recent GWAS study20 which used an earlier release of UKB data plus meta-analysis with other studies reported 25 genome-wide significant SNPs. Conditional analyses of our GORD and PG+M association results on SNPs previously reported as genome-wide significantly associated gastroesophageal reflux20 using GCTA-COJO34,35 found that three SNPs remain significant for GORD and six SNPs remain significant for PG+M. Given the aim of our study, Tables 23 list the 19 previously unreported genome-wide significant SNPs for PUD, GORD, PG+M, and IBS. SNPs associated with IBD are in Supplementary Table 3; we note that 28 of the 31 SNPs have been previously linked with inflammatory bowel diseases (despite concerns of the high prevalence of IBD in the UKB). The three GORD-associated SNPs and 13 PG+M-associated SNPs that have been reported20 are listed in Supplementary Table 4. The GERA cohort data36,37 were available as a replication sample for PUD (1004 cases, 60,843 controls) and IBS (3359 cases and 58,488 controls), albeit with limited power (~20% for each SNP, Supplementary Table 5). Six of the eight genome-wide significant SNPs for UKB PUD exist and one for UKB IBS in GERA and all have very similar effect size estimates as those in UKB, but only rs681343 was formally significant (P = 5.0E−4 < 0.05/8, a replication rate consistent with the power calculations) (Supplementary Table 5).

Many of the PUD SNPs associations are previously unreported even when checking published results for any digestive diseases (Table 2). There are eight PUD-associated SNPs, which by physical distance (<22 kb) could implicate MUC1, MUC6, FUT2, PSCA, ABO, CDX2, GAST, and CCKBR, as annotated in Fig. 2. Pathway analysis using the GENE2FUNC of the FUMA pipeline38 showed that these genes are highly overexpressed in human stomach tissue. Detail on these PUD results are found in the discussion section. For IBS, a previous study of UKB data (earlier phenotype release) reported rs10512344 as the only SNP genome-wide significantly associated (P = 3.6E−8) with self-report IBS, and in females only23. The P value for this SNP in our analyses is 5.0E−05 (P = 4.4E−07 in females, i.e., less associated than in the published study despite sample overlap). Given that they used a self-report phenotype while we used a combination of three resources, we regenerated three subgroup phenotypes (self-report only, hospital admission only, and primary care only) for IBS and repeated GWAS analyses for the three phenotypes and the results were used for further analyses (Supplementary Note 2). We also conducted similar subgroup phenotypes GWAS for GORD and PUD. Figure 2 shows Manhattan plots for PUD. Figure 3 shows Manhattan plots for GORD, PG+M, and IBS and Supplementary Fig. 2 shows Manhattan plots for IBD. Quantile–Quantile (Q–Q) plots of all the variants analysed in UKB are provided in Supplementary Fig. 3 for the five phenotypes. Regional visualization plots of the 66 independent variants are in Supplementary Figs. 48. Detailed pleiotropy results derived from the GWAS Catalog39 are provided in Supplementary Data 1. The 54 GTEx tissue specific enrichment results for eight genes in Fig. 2 are in Supplementary Data 2. In sensitivity analysis GWAS, phenotypes for each of PUD, GORD, IBS, and IBD were regenerated by excluding individuals with more than one GI diagnosis among these four disorders from the corresponding original phenotype cases (Supplementary Note 3).

### SNP-based heritabilities and genetic correlations

We estimated the proportion of variance in trait liability attributable to genome-wide common SNPs (i.e., SNP-based heritability, $$h_{{\rm{SNP}}}^2$$) using Linkage Disequilibrium Score regression (LDSC)40. $$h_{{\rm{SNP}}}^2$$ estimates on the liability scale were: PUD 0.06 (SE = 0.007), GORD 0.08 (SE = 0.004), PG+M 0.09 (SE = 0.003), IBS 0.06 (SE = 0.005), and IBD 0.11 (SE = 0.016) (Fig. 4a and Supplementary Table 6), all significantly different from zero. The SNP-based genetic correlation (rg) between PUD and GORD is 0.65 (SE = 0.05, P = 4.9E−36, phenotypic correlation (rp) = 0.11), similar to the rg estimate for GORD and IBS (0.65, SE = 0.05, P = 1.1E−46, rp = 0.10). The rg between PUD and IBS is 0.49 (SE = 0.08, P = 2.0E-10, rp = 0.03) (Supplementary Table 7), while the rg between IBD and each of PUD, GORD, PG+M, and IBS are not statistically significantly different from zero after Bonferroni correction (Fig. 4b). In sensitivity analyses, all individuals with more than one GI diagnosis were excluded (Supplementary Fig. 9a); the $$h_{{\rm{SNP}}}^2$$ estimates were lower but still significantly different from zero (Supplementary Table 6 and Supplementary Fig. 9b), while the rg between PUD, GORD, and IBS remain significant (all rg > 0.25) and none showed statistically significant rg with IBD (Supplementary Table 7 and Supplementary Fig. 9c1). Detailed results of sensitivity analyses are discussed in Supplementary Note 3 with the corresponding data presented in Supplementary Tables 67 and Supplementary Fig. 9. We also investigated $$h_{{\rm{SNP}}}^2$$ and rg for the three subgroup phenotypes (mentioned above) of each of PUD, GORD, and IBS, and found them to show significant $$h_{{\rm{SNP}}}^2$$ and high genetic correlation (see Supplementary Fig. 10 and Supplementary Tables 89).

The rg between each of the five digestion phenotypes and the 258 traits from LD Hub41 plus nine psychiatric42,43,44,45,46,47,48 and neurological traits49,50 (Supplementary Table 10 and Supplementary Data 3, respectively) included 26, 37, 53, 16, and 3 significant correlations for PUD, GORD, PG+M, IBS, and IBD, respectively, after Bonferroni correction (P < 3.7E−5). Figure 4b, c show the rg between each of the five phenotypes and statistically significant correlations from the 267 traits. We summarize these results briefly. First, we observed significant positive rg between four digestion phenotypes (PUD, GORD, PG+M, and IBS) and depressive symptoms51, major depression (MD)48, attention deficit hyperactivity disorder (ADHD)42, neuroticism51, and insomnia52,53. However, there was no statistically significant rg between IBD and these traits. Second, PUD, GORD, and PG+M have significant positive rg with body mass index (BMI)54, body fat-related traits55 and coronary artery disease56. GORD and PG+M are also genetically correlated with type 2 diabetes57 in a positive direction. Third, the common variant genetic architecture of PUD, GORD, PG+M, and IBS are positively correlated with educational attainment-related traits58. In sensitivity analyses, all individuals with more than one GI diagnosis were excluded and the results are similar as above. Detailed results of sensitivity analysis are discussed in Supplementary Note 3 with the corresponding data presented in Supplementary Table 11, Supplementary Fig. 9, and Supplementary Data 4.

### Links to gene expression, eQTLs, and mQTLs

We used partitioned SNP-based heritability analyses to determine if any genomic annotations showed enrichment of $$h_{{\rm{SNP}}}^2$$ relative to the null hypothesis that SNP-based heritability is partitioned proportional to the number of SNPs in an annotated set (see “Methods” section). After Bonferroni correction, GORD, PG+M, and IBS showed significant enrichment of $$h_{{\rm{SNP}}}^2$$ in conserved regions and $$h_{{\rm{SNP}}}^2$$ enrichment for IBD was in the super enhancer category (Supplementary Fig. 11 and Supplementary Table 12). In analyses based on SNP annotations derived from cell-type histone-mark data (Fig. 5a and Supplementary Table 13), IBD showed significant $$h_{{\rm{SNP}}}^2$$ enrichment in immune and gastrointestinal cell-type groups, while GORD, PG+M, and IBS showed enrichment in the CNS cell-type. Based on cell-type specific SNP annotations59 derived from gene expression data of 205 different tissues (53 from GTEx60 and 152 from Franke lab61), PG+M showed significantly enriched association with genes expressed in the hippocampus, frontal cortex (Brodmann Area, BA9) and anterior cingulate cortex (BA24) of the brain and IBD showed enriched associations in leukocytes (Fig. 5b and Supplementary Table 14). Given these significant results for GORD, PG+M, and IBS we conducted the same analyses using the fine-scale GTEx brain gene expression data which includes data from 13 brain regions (albeit smaller sample size)60. GWAS associations for PG+M were consistently enriched in the frontal cortex (BA9) (Fig. 5c and Supplementary Table 15). We conducted sensitivity analyses to investigate if these results are mediated by educational attainment (EA)62, BMI55, and smoking-related traits63. The results remain significant after conditioning the PG+M GWAS results on the GWAS results of EA, BMI and smoking using mtCOJO37 (Supplementary Tables 1315). We also investigated whether associations between SNPs and the five digestion phenotypes were consistent with mediation through gene expression using the Summary data-based Mendelian randomization method, SMR64. SMR combines genome-wide significant SNP-gene expression associations (i.e., eQTLs) with the SNP-trait association results. Significant SMR associations provide the best statistical evidence given available data that the trait associated SNP could be a causal SNP through its action on gene expression. A total of five unique genes for which expression is significantly associated with three digestion phenotypes, including two genes for PUD (PSCA and FUT2), one gene for PG+M (SUOX), and one gene for IBD (RP11-129J12.2 and RPS23P10), were identified (Supplementary Table 16). The statistical framework of SMR64 can be applied to mQTL (genome-wide significant SNP-methylation association) data to identify putative methylation-trait association. Hence, we repeated SMR analyses for PUD using blood mQTL data from McRae et al.65. Among the mQTL SMR results (Supplementary Table 17), three DNA methylation probes (cg01656853, cg08873673, and cg04660111), located in promoter region of FUT2, are associated with PUD (Supplementary Fig. 12). From Roadmap epigenomics annotation66, there is a digestive tissue specific active enhancer for FUT2, as shown in Supplementary Fig. 12.

### Gene-based and gene-set enrichment analyses

While individual SNP associations can implicate relevance of specific genes, given gene-specific genetic architectures putative roles of genes can also be identified by gene-based tests that combine the SNP-associations into genic annotations. We used MAGMA67 software to identify genes significantly (P < 2.7E−6) associated with each of the five digestion phenotypes, identifying: 29 for PUD, 112 for GORD, 157 for PG+M, 14 for IBS, and 97 for IBD (Supplementary Data 5). For gene-set enrichment analysis applied to gene-based summary statistics identified 11 gene ontology (GO) sets as significant for PG+M and six for IBD. The top enriched gene set for PG+M is “GO: POSTSYNAPSE” while that for IBD is “GO MHC CLASS II PROTEIN COMPLEX” (Supplementary Table 18).

### Comorbidity and MR with depression

Given observational associations between depression and PUD29, GORD30, IBS31, and IBD32, we used the eight UKB depression phenotypes identified by Cai et al.68, together with our four digestion diagnoses, to test whether each of the 32 depression-digestion phenotypes pairs show significant lifetime comorbidity relationships. Cai et al.68 argued that some of the clinically derived depression phenotypes were more specific to major depressive disorder than self-report depression, and that biological interpretation should focus on analyses using clinically derived phenotypes. We were interested to know if the relationship between depression and common GI disorders depended on these different depression definitions. All eight depression phenotypes showed statistically significant comorbidity relationship with each of PUD, GORD, and IBS (Supplementary Tables 19, 20 and Fig. 6a). For IBD, the highest statistically significant ORs were for the more severe depression definitions of electronic medical record depression (ICD10Dep), DSM-V clinical guideline-defined major depressive disorder and recurrence (abbreviation: LifetimeMDD and MDDRecur) (Fig. 6a). Given the comorbidities of the digestion phenotypes with depression, we tested for statistical evidence of a putative causal association between MD and each of the five digestion phenotypes using Generalized Summary-data-based MR (GSMR)37; we also tested for reverse causality (Supplementary Table 21 and Supplementary Figs. 13, 14). For the relationship between MD and IBD, GSMR estimates were not statistically significant either in forward direction (the effect of MD on IBD) or the reverse direction (the effect of IBD on MD), despite being well-powered to identify associations. We found a unidirectional effect between MD and PUD, 1.20-fold risk for PUD per standard deviation (SD) in liability to MD. The reverse direction (PUD as exposure and MD as outcome) had a small point estimate and is not statistically significant, but we note that we relaxed the association significance threshold to obtain more PUD genetic instruments (8 SNPs to 13 SNPs). When we repeated the analyses (PUD as exposure and MD as outcome) using the eight genome-wide significant SNPs, the result remained statistically non-significant, suggesting that MD is putatively causal for PUD. This analysis should be revisited when GWAS sample size for PUD increases identifying more genome-wide significant SNP instruments. The effect of MD on GORD and IBS showed statistically significant estimates of 1.23-fold and 1.48-fold respectively increase per SD in liability to MD (Fig. 6b). The point estimates for the reverse causality analyses were smaller (but statistically significant), and again these analyses should be revisited in when more genome-wide significant SNPs are identified (Fig. 6b and Supplementary Table 21). We observed bidirectional statistically significant results between MD and PG+M, i.e., 1.27-fold increased risk for PG+M per SD) in liability to MD (P = 2.5E−15), and 1.26-fold increased risk for MD per SD in liability to PG+M (P = 2.7E−09). No SNPs were identified as outliers by the HEIDI test. The pattern of results was the same when other MR methods were applied, which, as expected, showed less significant results (see Supplementary Note 4, Supplementary Table 22, and Supplementary Fig. 15). The bidirectional MR statistical significance between MD and PG+M could be consistent with reverse causality or pleiotropy. To exclude potential known confounders we repeated analyses with GWAS summary statistics conditioned on GWAS summary statistics of on EA, BMI, and smoking-related traits from mtCOJO analysis. The results remain significant in both directions (Supplementary Table 23). We used the latent causal variable (LCV) method69, which is designed to better separate pleiotropy from causality. As expected, the genetic causality proportion is not significant for PG+M and MD because of the strong bidirectional significance (Supplementary Note 4 and Supplementary Table 24). As sensitivity analyses, we repeated the analyses after removing the depression cases from both cases and controls from the five GI disorder phenotypes (Supplementary Note 5 and Supplementary Tables 2527). In summary, the statistically non-significant GSMR results in this study neither support a causal relationship from MD to IBD nor from IBD to MD. The results for PG+M do not support a unidirectional causal relationship given the significant bidirectional GSMR results. The MR results between MD and PUD, support a putative causal role of MD in PUD, but should be revisited when more SNP instruments are available.

### Out-of-sample polygenic score prediction

To further investigate the relationship between MD and PG+M, we used MD GWAS summary statistics (European ancestry, excluding the UKB cohort)48 to generate MD polygenic scores and used these to predict PG+M risk in the UKB. We found that participants in the UKB with a high polygenic score for MD had a higher risk for PG+M-related disorders. The top decile of individuals ranked on polygenic risk prediction for MD had an OR of 1.33 (95% CI: 1.29–1.38) for PG+M risk compared to the bottom decile (Fig. 6c and Supplementary Table 28). We also selected genome-wide significant SNPs associated with PG+M in the UKB to calculate polygenic scores and predict depression and psychiatric disorder risk in GERA cohort36, as shown in Fig. 6d respectively. Further, we selected genome-wide significant SNPs associated with PUD, IBS in the UKB to calculate polygenic scores and predict peptic ulcer and IBS risk in GERA cohort36. The top decile of individuals ranked on polygenic score for PUD had an OR of 1.80 (95% CI: 1.38–2.36) for PUD risk compared to the bottom decile and that for IBS had an OR 1.42 (95% CI: 1.21–1.67) for IBS risk compared to bottom decile (Supplementary Fig. 16).

## Discussion

This study describes an analysis of PUD and its relationship with other digestion disorders using a single study cohort. We used both the phenotypes and genotypes of up to 456,327 individuals to study the genetic contributions to PUD, GORD, IBS, and IBD and the connection between these disorders with major depression. Our results provide insights into the genetic basis of, and inter-relation between, these gastrointestinal disorders and also their relation to depression.

GWAS of PUD identified eight independent associated loci and 6 of 8 have potential links to H. pylori infection, highlighting the role of host genetic susceptibility (Fig. 2). Only two SNPs (rs2294008 and rs505922) have been previously reported as associated with peptic ulcers, both from a Japanese cohort study18 of duodenal ulcers. The authors provided evidence for their role in with duodenal ulcer development after H. pylori infection18. In our PUD-associated SNPs, rs2976388, located in PSCA gene, is in high LD (r2 = 0.94 in Europeans) with rs2294008, while rs687621, an intronic SNP located in the blood-group ABO gene, is in high LD (r2 = 0.98 in Europeans) with rs505922 (Fig. 2). These two loci are reported here in Europeans with the same direction of effect. From published gene expression data, we found that allele A of SNP rs2976388 is associated with increased PSCA expression (beQTL = 0.73, PeQTL = 8.8E−41), and through SMR analysis, the increased expression of PSCA decreased risk for PUD (bSMR = −0.12, PSMR = 3.0E−11). Decreased PSCA expression has been reported following H. pylori infection70, indicating negative regulation of PSCA expression by H. pylori infection. Other data sets recorded for H. pylori infection status are needed to explore this proposed relationship. A previous study71 has shown that individuals with blood group O have a higher risk of peptic ulcers compared to those with other blood groups which offers a possible explanation that this observation may result from different susceptibilities and immunologic responses to H. pylori infection. The A allele of rs687621 is associated with PUD (OR = 1.08, Table 2), and this allele is in high LD (r2 = 0.86 in Europeans and r2 = 0.89 in Japanese) with the rs8176719 deletion allele which generates a premature stop codon that leads to the O blood group72. We note that rs505922 has similar LD (r2 = 0.87) with rs8176719 in Europeans, but is in slightly higher LD with rs8176719 in Japanese (r2 = 0.92). This finding deserves further investigation of the association between blood group and peptic ulcer. Of the six previously unreported PUD-associated SNPs, it is notable that rs681343 is statistically significant in both UKB discovery and GERA replication GWAS (a replication rate consistent with power, see Supplementary Table 5). This SNP is located in the FUT2 gene which has been implicated in susceptibility to H. pylori infection in humans73 and mice gastric tissue74. The FUT2 fucosyltransferase allows expression of blood group antigens on the gastrointestinal mucosa and in bodily secretions. European individuals who are homozygous (AA) at rs601338 (non-secretor phenotype) are unable to secrete blood group antigens into bodily fluids, or express them on mucosal surfaces given the allele AA encodes a stop codon that inactivates the FUT2 enzyme75. Moreover, rs601338 is also associated with different infections (either resistance or susceptibility)75 and rs681343 associated with PUD in our analyses is in high LD with rs601338 in Europeans (r2 = 0.996), with the T allele of rs681343 paired with the A allele of rs601338.

Another two of the PUD-associated SNPs are in located in genes encoding mucin peptides, located on different chromosomes: rs147048677 (P = 9.0E−12) is a synonymous variant in the MUC1 gene. A mouse model study76 has shown that Muc1 limits H. pylori colonization of gastric mucosa. rs78459074 (P = 2.6E−10) is an intronic variant in the MUC6 gene. We note that, MUC6, MUC2, and MUC5AC are sequentially co-located on chromosome 11 (Supplementary Fig. 4). The expression of MUC6 and MUC5AC have been linked to H. pylori infection77,78. For the other three PUD-associated SNPs, rs9581957 is 22 kb away from the CDX2 gene (Supplementary Fig. 4). In nonneoplastic cell lines H. pylori infection led to prompt and robust expression of Cdx279. rs10500661 (P = 4.1E−14) is located in ~7 kb upstream of CCKBR (cholecystokinin B receptor) and this gene encodes a G-protein coupled receptor for both gastrin and cholecystokinin, regulatory peptides of the brain and gastrointestinal tract80. This gene, as shown in the GTEx60 portal (https://gtexportal.org/home/gene/CCKBR), is highly expressed in the brain frontal cortex (Brodmann area (BA) 9) and stomach. Moreover, this gene is a therapeutic-effect target gene for a peptic ulcer drug proglumide (ATC code: A02BX06), which inhibits gastrointestinal motility and reduces gastric acid secretions. In addition to these findings, itriglumide, an antagonist for the CCKBR-encoded protein, has been investigated as a potential treatment for anxiety and panic disorders81. rs34074411 is located approximately 2 kb upstream of the GAST gene which encodes gastrin, a hormone whose main function is to stimulate secretion of hydrochloric acid by the gastric mucosa. It is unusual to be able to link 6 out of 8 GWAS associated loci for a trait to a putative mechanism, but here the results highlight the role of host genetic variability to bacterial infection. Given the high genetic correlation between PUD and GORD (0.65, SE = 0.05), we also conducted mtCOJO analyses for PUD conditioning on GORD GWAS summary statistics. All the SNPs mentioned above still showed statistical significance (Supplementary Table 29), suggesting that most of those PUD-associated SNPs are specific to PUD, and may provide important disorder specific profiles for use in clinical trials.

We identified 6, 19, and 2 independent significant associations for GORD, PG+M, and IBS, respectively. Some genes around these loci have biological support for their mechanistic involvement and are worthy of note. For PG+M, two of the significantly associated SNPs, 19:18793695 and rs13097265, have been previously linked to Barrett’s esophagus and esophageal adenocarcinoma82 (Supplementary Table 4). rs13097265 is located ~60 kb from the FOXP1 gene, and recently a mouse study83 has shown that Foxp1 protein is expressed in all layers of the murine GI tract (including the myenteric plexus, which is part of the enteric nervous system and regulates gut peristalsis and transit). Altered motility and achalasia has been observed in Foxp1+/− mice. Heartburn and regurgitation, the main GORD symptoms, commonly occur during the early stages of achalasia and are consequently poor indicators of esophageal motility disorder. It remains controversial whether GORD and achalasia coexist or whether one disease transforms into the other83. Interestingly, rs10891491 associated with GORD (P = 4.1E−08) and rs7947502 associated with IBS (P = 2.5E−08) are in LD (r2: 0.15) (Table 3). rs10891491 and rs7947502 are intronic variants of NCAM1, suggesting this genic region may show pleiotropic effect for these two disorders. NCAM1 encoded protein is involved in development of the nervous system, including the enteric nervous system84. These GWAS results deserve further investigation to understand the role of genetic variants in the etiology of PUD, GORD, and IBS, especially since many of the genes putatively implicated by SNP associations have biological mechanism support for these disorders.

We provide direct genetic evidence for the difference between IBD and the other digestion phenotypes; although not unexpected, our analyses quantify these differences as illustrated by high genetic correlations among PUD, GORD, and IBS, which all show low genetic correlations with IBD (Fig. 4b). Both PUD and GORD are acid-related diseases; their high genetic correlation (rg = 0.65, s.e. = 0.052) motivated the combination of GORD and PUD with medication-taking cases. Additional evidence for genetic differences between IBD and the other digestion phenotypes was provided by the partitioned SNP-based heritability analyses, which showed enrichment of PG+M-associated SNPs in genes expressed in the brain regions (hippocampus, BA9 and BA24) while those for IBD are enriched in blood and immune related tissues (Supplementary Table 14). SNP-based heritability for PG+M is still enriched in BA9 region when we used fine-scaled GTEx brain gene expression data (Supplementary Table 15), and also after controlling for the effect of EA, BMI, and smoking (Supplementary Tables 1315). Gene set enrichment analysis showed PG+M-associated SNPs are enriched in neuron-related gene sets. We note that a limitation of our brain enrichment analysis is our conclusions are limited by the availability of tissue specific gene expression data. The GTEx database does not report gene expression data for multiple cortical regions, so specificity to BA9 or frontal cortex (over and above other cortical regions) is not established. Given the non-availability of gene expression data from other human tissues, such as sympathetic, parasympathetic (vagus nerve)26, and enteric nervous system25,27, we cannot conduct key hypothesis-based enrichment analyses. However, despite these limitations, our findings indicate that a genetic contribution to PG+M may highlight the potential link between the nervous system and esophagus, stomach and duodenum28,85, although there is likely not just one causal tissue or cell type59. Historically, vagotomy was used commonly to manage peptic ulcer diseases, as vagal stimulation promotes acid secretion86 (now successfully treated by H2 receptor agonists), indicating the clinical importance of the link between the nervous system and gastrointestinal tract.

We observed significant increased risk of the four digestion disorders with depression (under multiple definitions of clinical and self-report) (Fig. 6a). The association between mental health and GORD has been addressed through observational studies30,87. For example87, a bidirectional association between GORD and depression was reported with risk factor roles for depression on GORD and for GORD on depression. Here, we conducted MR to investigate if this statistical approach provides evidence of a causal relationship between major depression and GI disorder phenotypes. Since, the number of genome-wide significant SNP instruments for GORD and PUD is too few to draw strong conclusions, we focus on the combined PG+M phenotype that identified a higher number genome-wide significant SNPs for use as the MR instruments. We found an OR of 1.27 (P = 2.5E−15) for PG+M per SD in liability to MD, which has direction and effect size estimates consistent with those previously reported between MD and drugs for GORD and PUD (OR: 1.23, P = 4.0E−6)88. However, the reverse MR analysis (the effect of PG+M on MD) is also significant (OR: 1.26, P = 2.7E−9). The bidirectional statistically significant results from GSMR usually include two interpretations, one is that there is the bidirectional causality and the other one is horizontal pleiotropy, including an indirect relationship through an intermediate endophenotype or confounder69,89. Hence, our conclusions must include these interpretations, although we note that the MR Egger intercept test suggests no horizontal pleiotropy (Supplementary Table 22), and the results were similar after mtCOJO conditional analyses, which take into account correlated traits such as educational attainment, BMI, and smoking. In terms of bidirectional causality, there are several possible explanations. Patients with psychological comorbidity often perceive low intensity esophageal stimulation as being painful due to hypervigilance to these intra-esophageal events85. Psychological factors can decrease the pressure of the lower esophageal sphincter and change esophageal motility90. The reflux symptom itself could result in depression through potentially disabling effects on occupational or social function, or if patients are constantly feeling upset about their condition90. Use of medications could conceivably mediate bidirectional associations between depression and PG+M. Tricyclic antidepressants can lead to a decrease in lower esophageal sphincter pressure, and thus and increase in the number of reflux episodes (anticholinergic effect)91. Recently, a study shows that use of proton-pump inhibitors (PPI) for acid-related disorders are associated with the subsequent risk of major depression disorder92. Further studies are needed to clarify this association. We note a recent population based study of 83.9 million person-years93 found that a diagnosis of mood disorder was associated with increased risk (hazard ratio 1.57) of subsequent peptic ulcer disease/gastritis. While a causal relationship cannot be confirmed between major depression and digestion related disorders (or vice versa), consideration of clinical implications of a possible relationship is justified. When treating patients with MD, awareness of the digestion symptoms for PUD/GORD could help to decide if further interventions are needed. Also, these results may provide clues for screening psychological factors in PUD/GORD patients. A previous study94 shows that GORD patients who are also comorbid with psychological distress have more severe symptoms at baseline and more residual symptoms after PPI treatment. In those patients, treatment for the underlying psychological distress might improve the PPI response. A notable negative result was the absence of evidence for any causal relationship between IBD and major depression (an OR of 1.08 (P = 0.4) when major depression was the exposure trait and IBD as outcome and 1.01 (P = 0.11) for the reverse direction). A causal relationship might be expected from observational studies and mechanistic theory linking inflammation with depression95, suggesting that observed phenotypic associations may be driven by residual confounding, and having potential implications for future research into the role of inflammation in the pathogenesis of depression.

Despite these interesting findings, our study has several limitations. First, the phenotypes of PUD, GORD, and IBS were combinations of self-reported illness, primary care, hospital admission record, and/or medication use. There is a potential influence regarding accuracy of self-report and misdiagnosis, however, the correlation in effect sizes from case-ness defined by hospital admission, primary care, or self-report data support the use of self-report data, Supplementary Fig. 10e). Given the existent co-reporting of some diagnoses, we conducted sensitivity analyses in which individuals recorded with more than one diagnosis were excluded, but these analyses did not impact our conclusions (Supplementary Tables 67, and 11). Formal diagnosis of PUD requires an endoscopy or a upper gastrointestinal barium test, moreover non-ulcer dyspepsia (NUD), not considered here, can be misdiagnosed as PUD. This could influence the downstream MR analyses with depression. Future large datasets of formal-diagnosed PUD are needed to further explore the MR analyses with major depression. Importantly, we note that the GWAS results from IBD derived from the UKB were highly consistent with results from published GWAS, despite a higher prevalence in the UKB than expected in a random population sample. We specifically focus on the broad definition of our phenotypes, and hence heterogeneity in the phenotypes has not been explored. Second, our study is conducted in the UKB cohort, which although a large population study, has recognized volunteer bias96. Third, we do not have replication data sets for GORD and PG+M genome-wide significant SNPs. Fourth, we do not have the H. pylori infection status and microbiome data for all the UKB participants, thus additional analyses on these factors cannot be further explored.

In summary, we identified 35 independent SNPs associated with different digestion disorders, of which 19 SNPs are previously unreported, including eight SNPs at or near MUC1, MUC6, FUT2, PSCA, ABO, CDX2, GAST, and CCKBR genes associated with peptic ulcer disease. Previously established roles of these genes in H. pylori infection, response to counteract infection-related damage and gastric secretion support their involvement. Post-GWAS analyses highlighted the link between the nervous system and the gastrointestinal tract. In addition, MR analyses imply a bi-directional relationship (the risk of GORD, PUD, and taking corresponding medications in liability to major depression and vice versa), which may reflect bidirectional causality, or pleiotropic effects between them. Taken together, our findings demonstrate the role of genetic variants in the etiology of common digestion disorders and the link between depression and PUD/GORD.

## Methods

### UK Biobank genotyping and quality control

The United Kingdom Biobank (UKB) cohort is a population-based volunteer longitudinal cohort of ~500,000 individuals recruited at 22 centers across the United Kingdom97. Genotype data from these individuals were imputed using the Haplotype Reference Consortium (HRC) and UK10K as the reference sample. A European ancestry subset (456,327 individuals, including 348,441 unrelated individuals) was identified by projecting the UKB participants onto the 1000 Genome Project principal components coordinates98. Genotype probabilities were converted to hard-call genotypes using PLINK299 (hard-call 0.1) and single nucleotide polymorphisms (SNPs) with minor allele count < 5, Hardy–Weinberg equilibrium test P value <1.0E−5, missing genotype rate > 0.05, or imputation accuracy (Info) score < 0.3 were excluded.

### Phenotype definition

The UKB phenotypes used in analyses were derived from two categories: one is disease-diagnoses phenotypes from either a death register, self-reported, hospital admission, or primary care record for the corresponding disease and the other is treatment phenotypes based on the operation and medication-taking code. Supplementary Table 1 lists the corresponding case definition and number of cases for each phenotype. PUD disease-diagnoses cases are a combination of gastric ulcer cases (UKB data field: 131591), duodenal ulcer cases (UKB data field: 131593), other site peptic ulcer cases (UKB data field: 131595) and gastro-jejunal ulcer cases (UKB data field: 131597). The remaining individuals were PUD controls. There were 16,666 cases and 439,661 controls for PUD. For the GORD disease-diagnoses phenotype (UKB data field: 131585), there are 54,854 cases and 401,473 controls. Inflammatory bowel disease (IBD)100 disease-diagnoses phenotype cases are a combination of Crohn’s diseases (UKB data field: 131627), ulcerative colitis (UKB data field: 131629) diagnoses, giving a total of 7045 cases and 449,282 controls. There were 29,524 cases and 426,803 controls for irritable bowel syndrome (IBS, UKB data field: 131639). For the comorbidity, full-sibling risk and heritability estimation analyses, we used this IBS phenotype definition. For the IBS GWAS analyses, we first removed 1006 participants who also had IBD diagnoses from the original IBS cases, the remaining 28,518 participants were assigned to case status for the IBS disease-diagnoses phenotype while the other 426,803 participants were coded as IBS controls. In clinical practice, medications for PUD also have a therapeutic effect on GORD. Thus, we combined 55,865 individuals taking medications that are mainly considered medications for GORD/PUD (UKB data field: 6154 and 20003), 1162 participants with endorsement for anti-reflux operations (UKB data field: 41272) and diseases-diagnoses cases for GORD and PUD, leaving a total of 90,175 cases (41,945 male cases) and 366,152 controls (phenotype abbreviation: PG+M—for GORD, PUD, and corresponding medications and treatment). Since the medications for IBD and IBS from UKB can also be used to treat other diseases or relieve symptoms (i.e., medications are not specific), we did not incorporate the medication data for the IBD and IBS phenotypes. The Supplementary Data 1 of Wu et al.88 provides UKB medication classification based on Anatomical Therapeutic Chemical (ATC) Classification System101, and we extracted medications for GORD/PUD (the first two ATC level: A02, Supplementary Table 2). For the validation of UKB PUD and IBS genome-wide significant SNPs, we used Genetic Epidemiology Research on Aging (GERA)36 PUD and IBS summary statistics from Zhu et al.37. The definition of PUD and IBS phenotypes from the GERA cohort is described in The Supplementary Table 4 of Zhu et al.37. Briefly, the total 61,847 individuals were divided into two groups: 1004 peptic ulcer cases according to ICD9 code (531–534) and 60,843 controls, respectively. There are 3359 cases and 58,488 controls for IBS phenotypes using the ICD9 code (564). Sensitivity phenotypes for each of PUD, GORD, IBS, and IBD were regenerated by excluding individuals with more than one GI diagnosis among these four disorders from the corresponding original phenotype cases (Supplementary Note 3). To understand the genetic similarity and difference among the self-report, primary care and hospital admission data for each of the PUD, GORD, and IBS, we further divided the cases of each of the PUD, GORD, and IBS into three groups according to the UKB coding (3rd column of Supplementary Tables 1 and 30: primary care only, 40: hospital admission data only, and 50: self-report only) and generated subgroup phenotypes using those subgroup cases, together with the controls from each of the original phenotypes.

### Comorbidity analyses

Comorbidity analyses, including comorbidity amongst PUD, GORD, IBS, and IBD and comorbidity between each with depression phenotypes in the UKB, were conducted in 348,441 unrelated individuals. Among the four digestive diseases, for each two of the PUD, GORD, IBS, and IBD cases (six pairs in total), we first checked whether the number of overlapped individuals between case groups is statistically significantly larger than the overlap expected by chance. For each of the PUD, GORD, IBS, and IBD disease (defined as the index disease), we conducted competitive comorbidity analyses to test among the other three diseases which disease is more prone to be comorbid with the index disease. Briefly, we calculated the proportion of the index disease cases in the other three diseases respectively and compared them in pairs by using two-proportions Z-test. One prerequisite for the two-proportion Z-test is that the two samples are independent of each other. Given this, we removed the overlapped cases among these three diseases when calculating the proportion of the index disease cases. For comorbidity between each of the PUD, GORD, IBS, and IBD with depression phenotypes, we first derived eight depression phenotypes based on different data field (UKB data field: 20002, 20216, 2090, 20440, 20442, 2100, 41202, and 41204) and mental health online follow-up (data category: 138) from the UKB. The details for depression phenotype definitions were described Cai et al.68. Briefly, depression phenotypes were defined according to help seeking behavior and symptoms, including seen general practice (GP) for nerves, anxiety, tension or depression (abbreviation: GPpsy), seen psychiatrist for nerves, anxiety, tension, or depression (abbreviation: Psypsy), probable recurrent major depression or single probable major depression episode (abbreviation: DepAll), self-reported depression (abbreviation: SelfRepDep), ICD10 defined depression (abbreviation: ICD10Dep), DSM V clinical guideline defined major depression (abbreviation: LifetimeMDD), major depression recurrence (abbreviation: MDDRecur) and seen GP for depression but no cardinal symptoms (abbreviation: GPNoDep) phenotypes. We then checked the overlap individuals from each of the GORD, PUD, IBS, and IBD with the eight depression phenotypes. For each of 32 digestion-depression phenotype pairs, we tested whether the number of individuals who are both digestion phenotype case and depression phenotype case is statistically significantly different from the expected number. Odds ratio, 95% confidence interval (CI) and corresponding P value for each digestion-depression phenotype pair were calculated using fmsb R package (https://cran.r-project.org/web/packages/fmsb/fmsb.pdf). Bonferroni correction was used to account for multiple testing.

### Full-sibling risk and estimation of heritability

To demonstrate the genetic component for the UKB case–control phenotypes of PUD, GORD, IBS, and IBD, we estimated the increased risk of the disorders in full-siblings of those affected (we did not incorporate other relative pairs data given the limited sample size for disease cases), compared to the risk in all UKB individuals (disease risk). As described by Bycroft et al.97, 22,665 full-sibling pairs were inferred from the kinship coefficients estimated using KING102. Risk ratio, 95% CI and corresponding P value were calculated using fmsb R package. After obtaining the full-sibling relative risks, we used liability distribution theory103,104,105 to estimate the heritability of each trait, under the assumption that the increased risk only reflects shared genetic factors.

### Genome-wide association study (GWAS) analyses

We performed case–control GWAS analyses using BOLT-LMM106 with sex, age and 20 ancestry principal components (PCs) fitted as covariates. 543,919 SNPs generated by linkage disequilibrium (LD) pruning (r2 < 0.9) from HapMap3 SNPs were used to control for population structure and polygenic effects, including genetic relatedness between individuals. The effect size (β) from BOLT-LMM on the observed 0–1 scale were transformed to odds ratio (OR) using the following equation107: $${\mathrm{OR}} = \frac{{\left( {k + \beta \left( {1 - p} \right)} \right. \times \left( {1 - k + \beta p} \right)}}{{\left( {k - \beta p} \right) \times \left( {1 - k - \beta \left( {1 - p} \right)} \right)}}$$, where k is the proportion of sample that are cases, and P is the allele frequency in the full UKB European cohort. The standard error (s.e.) for OR were then calculated based on the OR and P value from the initial GWAS using the formula $${\mathrm{s}}.{\mathrm{e}}. = \left| {\frac{{\ln ({\mathrm{OR}})}}{{{\mathrm{{\Phi}}}^{ - 1}\left( {\frac{{\mathrm{P}}}{2}} \right)}}} \right|$$. A total of 8,546,065 SNPs with minor allele frequency (MAF) > 0.01 were analysed. Independent trait-associated SNPs were generated using GCTA-COJO34,35 analyses. The genotype data (8,546,065 SNPs with MAF > 0.01) of 20,000 random sampled unrelated European individuals were used to provide a LD reference. Due to the complexity of major histocompatibility complex (MHC) region (25–34 Mb), only the most significant SNP across that region was reported. Regional visualization plots were produced using LocusZoom108. The genomic inflation factor (λGC) was also reported for each phenotype. We used PUD and IBS GWAS summary statistics37 from the GERA36 cohort for validation look-up of the UKB PUD and IBS genome-wide significant SNPs, respectively. We applied RPower package109 to calculate power for UKB PUD and IBS genome-wide significant SNPs give GERA sample size for each trait. We also conducted pleiotropy (SNP associated with multiple traits) analysis. Briefly, we downloaded published GWAS associations from the GWAS Catalog39 on April 6th 2020. For each of PUD, GORD, PG+M, and IBS associated SNPs in our study (index SNP), we first selected SNPs from the GWAS Catalog within a ±1000 kb window size of the index SNP. We then selected the GWAS Catalog SNPs significantly associated (P < 5.0E−8) with either mental health-related traits or digestive diseases. We reported a pleiotropic association if selected GWAS Catalog SNPs are in LD (r2 > 0.1) with the index SNP. Similarly, for IBD-associated SNPs in our study, we checked whether significant association (P < 5.0E−8) have been reported for inflammatory bowel diseases (including the subtypes) using the downloaded GWAS Catalog data. GWASs for sensitivity phenotypes of each of PUD, GORD, IBS, and IBD were conducted. We also conducted GWASs for the three subgroup phenotypes of each of PUD, GORD, and IBS for further post-GWAS analyses, following the same procedures mentioned above. Given the sex specific effect of rs10512344 on IBS, we further conducted sex-specific GWAS on IBS. To explore the specificity of PUD-associated SNPs, we conducted a multitrait conditional and joint (mtCOJO)37 analysis to condition the PUD GWAS results on GORD GWAS summary statistics and check whether the original PUD-associated SNPs remain significant. We used the GENE2FUNC of FUMA pipeline38, together with GTEx 8th version gene expression data60, to investigate whether the genes surrounding PUD-associated SNPs are overexpressed in any specific tissue.

### SNP-based heritability and genetic correlations of the five digestion phenotypes

Linkage disequilibrium score regression (LDSC)40 was used to estimate SNP-based heritability ($$h_{{\rm{SNP}}}^2$$) from the GWAS summary statistics. The $$h_{{\rm{SNP}}}^2$$ estimated on the observed scale were transformed to the liability scale taking the sample lifetime risk (proportion of sample that are cases) as the disease lifetime risk estimates. The summary statistics for each phenotype were filtered using the LDSC default file, w_hm3.snplist, with the default LD scores computed using 1000 Genomes European data (eur_w_ld_chr) as a reference. Genetic correlations (rg) for each two of the five UKB digestion phenotypes or between each of the five phenotypes and the 258 GWAS traits in LD Hub41 were calculated using bivariate LDSC110. Since we had a particular interest in the relationship between the five digestion phenotypes and disorders of nervous system, we also used more recent GWAS summary statistics than those included in LDHub for seven psychiatric traits (attention deficit/hyperactivity disorder (ADHD)42, schizophrenia (SCZ)43, anxiety disorder44, posttraumatic stress disorder (PTSD)45, bipolar disorder (BIP)46 and autism spectrum disorder (ASD)47, major depression (MD)48) and two neurological traits (Alzheimer’s disease based on family history49 and Parkinson’s disease50). As sensitivity analyses, we repeated analyses using sensitivity phenotypes (excluding any individual recorded to have more than one disorder for each of PUD, GORD, IBS, and IBD). Although removal of these individuals could make estimates of SNP-based heritability difficult to interpret, genetic correlations are more robust to such ascertainment89. We also used three subgroup phenotypes for each of PUD, GORD, and IBS, as mentioned above, to calculate SNP-based heritibilities and within-diseases genetic correlations. Note, as shown by theory and simulation, estimates of genetic correlations are unbiased even in the context of sample overlap110. In the absence of sample overlap, the genetic covariance intercept term in the bivariate LDSC regression equation is expected to be zero. If sample overlap is present then the intercept term is expected to be a function of the phenotypic correlation, and the proportion of the samples that overlap between the two data sets.

### Linking GWAS findings to gene expression

Following the estimation of $$h_{{\rm{SNP}}}^2$$, we partitioned the SNP-based heritability by genomic features111. Briefly, in this method111, genetic variants are assigned into 53 functional categories using 24 publicly available annotation data sets, such as UCSC coding, UTRs, promoter and intronic regions112, conserved regions113 and functional genomic annotations constructed using ENCODE114 and Roadmap Epigenomics Consortium66 data. The method evaluates the contribution of each functional category to the overall $$h_{{\rm{SNP}}}^2$$ of a trait. A category is enriched for $$h_{{\rm{SNP}}}^2$$ if the variants with high LD to that category have elevated χ2 statistics, compared to the expectation given the number of SNPs in the category. In another analysis, genetic variants were annotated to histone marks (H3K4me1, H3K4me3, H3K9ac, and H3K27ac) by cell type specific classes and these annotations were allocated to ten groups: adrenal and pancreas, central nervous system (CNS), cardiovascular, connective and bone, gastrointestinal, immune and hematopoietic, kidney, liver, skeletal muscle, and other. We tested the enrichment of $$h_{{\rm{SNP}}}^2$$ in tissues relevant to the five digestion phenotypes: the adrenal and pancreas, gastrointestinal, immune and hematopoietic, and liver cell types. We also considered the CNS given the high rg between four of the six digestion phenotypes and depressive symptoms. We also used LDSC specific expressed genes (SEG)59 analysis to test the enrichment of $$h_{{\rm{SNP}}}^2$$ through gene expression derived cell-type specific annotations. First, given the strong contribution to PG+M $$h_{{\rm{SNP}}}^2$$ from the CNS and to IBD $$h_{{\rm{SNP}}}^2$$ from the immune cell group, LDSC-SEG59 was applied to test the enrichment of $$h_{{\rm{SNP}}}^2$$ in 205 different tissues (53 from GTEx and 152 from Franke lab). Second, given the observation that GORD, PG+M, and IBS $$h_{{\rm{SNP}}}^2$$ were enriched in the CNS, we also applied LDSC SEG to test the enrichment of $$h_{{\rm{SNP}}}^2$$ for GORD, PG+M, and IBS in 13 brain regions using the multiple brain regions available in the GTEx study (https://gtexportal.org/home) data60 to identify specific brain regions implicated by the GWAS results for the three phenotypes. Bonferroni correction was used to account for multiple testing. As sensitivity analyses, we conducted a multitrait conditional and joint (mtCOJO)37 analysis to condition the PG+M GWAS results on educational attainment (EA)62, body mass index (BMI)54, and tobacco-use63 GWAS summary statistics and further conducted LDSC cell type group and LDSC-SEG enrichment analyses using gene expression data from the tissues which are statistically significantly enriched above. We checked eQTL (expression quantitative trait loci, i.e., SNPs significantly (P < 5 × 10−8) associated with gene expression) status for each genome-wide significant SNP using GTEx60 results for gastrointestinal tissue and brain tissues. Summary-data-based Mendelian randomization (SMR)64 was used to provide evidence for likely causal relationship between the trait-associated SNPs and gene expression. We used eQTLGen115 whole blood eQTL data since this is the largest eQTL data set and many eQTLs are shared across tissues116. To capture more tissue specific eQTL, we used GTEx60 eQTL data from six tissues: esophagus-gastroesophageal junction, esophagus mucosa, esophagus muscularis, stomach, small intestine terminal ileum, colon sigmoid, and colon transverse tissue. We also used GTEx eQTL data from hippocampus, brain anterior cingulate (Brodmann area 24, BA24), frontal cortex (Brodmann area 9, BA9) tissue for PG+M given $$h_{{\rm{SNP}}}^2$$ enrichment results. The Bonferroni corrected significance threshold was 0.05/131,295, where 131,295 is the number of total genes tested in SMR analyses. Because of its complexity, we do not report results of the MHC region (25–34 Mb)48. The statistical framework of SMR64 can be applied to mQTL (genome-wide significant SNP-methylation association) data to identify putative methylation-trait association. Hence, we repeated SMR analyses for PUD using blood mQTL data from McRae et al.65.

### Gene-based and gene-set enrichment analyses

MAGMA (v1.06)67 (Multi-marker Analysis of GenoMic Annotation) was used to test for gene-based association based on the SNP association results of the five digestion phenotypes. Gene length boundaries were defined as 35 kilobase (kb) upstream and 10 kb downstream from start and stop site, respectively, to include regulatory elements. The NCBI 37.3 build was used to assign the genetic variants to each gene. SNPs with MAF > 0.01 from 20,000 randomly sampled and unrelated UKB European-ancestry individuals were used to provide a LD reference. A total of 18,402 genes were assessed for an association with each of the six digestion phenotypes with Bonferroni correction used to determine significance (α = 0.05/18402, P < 2.7E−6). We used the results obtained from gene-based analysis, together with gene ontology sets (c5.cc) from MSigDB117,118 to conduct gene-set enrichment analyses. Competitive test P value for each gene set, as implemented in MAGMA, were computed taking gene size, density, minor allele count and gene–gene correlation into consideration67. False discovery rate (FDR)-adjusted P values for biological pathways for each of the five digestion phenotypes were generated using Benjamini and Hochberg’s method119 to account for multiple testing.

### Mendelian randomization

We applied the generalized summary-data-based Mendelian randomization (GSMR)37 method to explore the potentially causal effect of MD as an exposure on the five UKB digestion phenotypes as outcome traits (defined as forward direction). GSMR uses summary-level data to test for causal associations between a putative risk factor (exposure) and an outcome trait. Independent genome-wide significant SNPs from the MD GWAS (excluding UKB cohort)48 were used as the MR exposure instrument variables. The HEIDI outlier test37 was used to remove outlier pleiotropic genetic instruments associated with both exposure phenotype and outcome phenotype from the analysis. We also conducted reverse causation analysis (i.e., testing the opposite hypothesis that the five digestion phenotypes cause MD). However, GSMR guidelines advise the use of at least ten independent lead SNPs as genetic instruments to achieve robust results. In order to test the effect of PUD (eight SNPs with P < 5.0E−8), GORD (six SNPs), and IBS (two SNPs) on MD, we relaxed the significance threshold to allow for at least ten SNPs for each of the three phenotypes. For each trait as exposure, we only keep the most significant SNP within MHC region for MR analysis (if applicable). We used 0.01 as a clumping threshold r2 in GSMR analyses. The other parameters were set to software defaults. For comparison, we also conducted IVW-MR120, MR-Egger121, weighted median-MR122, and MR-PRESSO123 analyses following the STROBE-MR guideline124 for the effect between PG+M and MD. We also used LCV69 approach for PG+M and MD given the fact that this approach could control pleiotropy well. To explore whether the bidirectionally statistically significant GSMR results between PG+M and MD is mediated by EA62, BMI55, and tobacco-use63 effect, we further used mtCOJO results to conduct bidirectional GSMR analyses, i.e., taking MD conditional GWAS results (the MD original GWAS results conditioned on EA62, BMI55, and tobacco-use63 GWAS summary statistics separately or together) as exposure and PG+M non-conditional GWAS results as outcome and vice versa. As a sensitivity analysis, we further removed the depression cases (the combined cases from eight depression phenotypes in UKB as aforementioned) from the five GI disorders phenotypes and conducted GWASs for the five depression removed sensitivity phenotypes (defined as GI-DepComRMV phenotypes). We further repeated bivariate LDSC analyses for genetic correlation and GSMR analyses for MR between major depression and GI-DepComRMV phenotypes. In addition to this, we removed the depression cases of each of eight depression phenotypes in UKB from PUD phenotypes and generated eight PUD sensitivity phenotypes. We further repeated GSMR analyses for MR between major depression and eight PUD sensitivity phenotypes.

### Out-of-sample polygenic score prediction

We used MD GWAS summary statistics48 (European ancestry, excluding UKB cohort) as discovery data to predict PG+M risk (risk for PUD, GORD, and likelihood for taking PUD, GORD medications or treatments). The MD data SNPs were matched with the PG+M SNPs, then LD pruned and “clumped”, discarding variants within 1000 kb of, and in r2 ≥ 0.1 with, another (more significant) marker using SNPs with MAF > 0.01 from 20,000 random sampled unrelated UKB European-ancestry individuals as the LD reference. Polygenic score of PG+M sample individuals were generated for a range of MD GWAS summary statistics data association P value thresholds (5.0E−8, 1.0E−5, 1.0E−4, 1.0E−3, 1.0E−2, 0.05, 0.1, 0.5). For each discovery-target pair, three outcome variables were calculated. (1) The P value of case-control polygenic score difference from logistic regression. (2) Area under the receiver operator characteristic curve using R package pROC125, which can be interpreted as the probability of ranking a randomly chosen case higher than a randomly chosen control. (3) Odds ratio and 95% confidence interval for the 2nd–10th polygenic score deciles group compared with 1st decile. The polygenic score decile presented in Fig. 6c is based on association P value thresholds 1.0E−2. Given the availability of depression and psychiatric disorders (not GORD) phenotypes in GERA cohort, we used UKB PG+M GWAS summary statistics to calculate polygenic score for GERA individuals based on P value threshold 0.05 and conducted out-of-sample polygenic score prediction for depression and psychiatric disorders risk in GERA individuals, respectively. We further conducted out-of-sample prediction for PUD and IBS risk in GERA cohort following the same steps but the P value threshold for polygenic score calculation are 5E−8 and 0.1, respectively.

### Reporting summary

Further information on research design is available in the Nature Research Reporting Summary linked to this article.


text:
# Landau levels in symmetric gauge

On Shankar’s Quantum Many body page 394 it says for one electron in a magnetic field, ignoring spin,

$$H_0=\frac{(\bf{p}+e\mathbf{A})^2}{2m}$$

$$e\mathbf{A}=-\frac{\hbar}{2l^2}\hat{z}\times \mathbf{r}$$ where $$l=\sqrt{\hbar/eB}$$ is the magnetic length.

He then says that

$$H_0=\frac{\hbar^2 \mathbf{\eta}^2}{2ml^4}$$ where $$\mathbf{\eta}=\frac{1}{2}\mathbf{r}+\frac{l^2}{\hbar}\hat{z}\times \mathbf{p}$$ where $$\eta$$ is the cyclotron coordinate.

It seems like something was left out here. I’m not seeing how squaring this $$\eta$$ would give me back the original Hamiltonian. Am I missing something?

Any help greatly appreciated

## 1 Answer

The problem is two-dimensional. You thus don't have dynamical $$z$$ and $$p_{z}$$ components. Therefore, direct calculation proves

$$\left(\boldsymbol{p}-\dfrac{\hbar}{2l^{2}}\hat{z}\times\boldsymbol{r}\right)^{2}=\left(p_{x}+\dfrac{\hbar}{2l^{2}}y\right)^{2}+\left(p_{y}-\dfrac{\hbar}{2l^{2}}x\right)^{2}=$$

$$=\dfrac{\hbar^{2}}{l^{4}}\left[\left(\dfrac{1}{2}x-\dfrac{l^{2}}{\hbar}p_{y}\right)^{2}+\left(\dfrac{1}{2}y+\dfrac{l^{2}}{\hbar}p_{x}\right)^{2}\right]=\dfrac{\hbar^{2}}{l^{4}}\left(\dfrac{1}{2}\boldsymbol{r}+\dfrac{l^{2}}{\hbar}\hat{z}\times\boldsymbol{p}\right)^{2}=\dfrac{\hbar^{2}\eta^{2}}{l^{4}}$$

format: plain


text:
# Mean Shift Algorithm

#### Introduction

In the article we will look at the basics of Mean Shift Algorithm.

#### Kernel density Estimation

let us first consider a univariate gaussian PDF and sampled data from the PDF. The kernel density estimation uses fact that the density of samples about a given point is proportional to its probability.

It approximates the probability density by estimating the local density of points as seen in figure fig:image1 is resonable.

Large density of points are observed near the maximum of PDF.
fig:image3 The KDE estimate the PDF by superposition of kernel at each data point,which is equivalent to convolving the data points with a gaussian kernel.

#### Mean Shift

Mean shift is a tool for finding the modes in a set of data samples which is sampled from underlying PDF.The aim of the mean shift algorithm is to find the densest region in given set of data samples.

Data points density implies PDF value .

Let us consider a 2D region.The points in the 2D region are sampled from a underlying unknown PDF.

Let $X=[x,y]$be random variables associated with a multi-variate PDF $P(X)$.

Thus sampling a point $P(X)$ will give us a vector $X'=[x',y']$

For example let us consider a multi-variate gaussian distribution where the random variables x and y take values in the range -3 to 3.

#### Modes of Smooth function

Let us say we want to find the modes of PDF.The PDF is approximated using kernel density estimation.Modes are the points at which PDF exhibits local maximum .

Dense regions in PDF corresponds to modes or local maxima.

Since the kernel is smooth,its differentiable.It gives to a smooth PDF.The gradient of density estimate is given by \begin{eqnarray*} \hat{f}_h(x) = \frac{1}{n}\sum_{i=1}^n K_h (x - x_i) \quad = \frac{1}{nh} \sum_{i=1}^n K\Big(\frac{x-x_i}{h}\Big)\\ \nabla \hat{f}_h(x) = \frac{1}{nh}\sum_{i=1}^n \nabla K\Big(\frac{x-x_i}{h}\Big) \\ for gaussian kernel \\ \nabla \hat{f}_h(x) = \frac{C}{nh}\sum_{i=1}^n \nabla exp\Big(\frac{-(x-x_i)^2}{2*h^2}\Big) \\ \nabla \hat{f}_h(x) = \frac{C}{nh*h^2}\sum_{i=1}^n exp\Big(\frac{-(x-x_i)^2}{2*h^2}\Big)*(-(x-xi)) \\ \nabla \hat{f}_h(x) = \frac{1}{nh*h^2}\sum_{i=1}^n K\Big(\frac{x-x_i}{h}\Big)*(-(x-xi)) \\ equating the gradient to 0 \\ \sum_{i=1}^n K\Big(\frac{x'-x_i}{h}\Big)*(x-xi)=0 \\ \sum_{i=1}^n K\Big(\frac{x'-x_i}{h}\Big)*x = \sum_{i=1}^n K\Big(\frac{x-x_i}{h}\Big)x_i\\ x'=\frac{\sum_{i=1}^n K\Big(\frac{x-x_i}{h}\Big)x_i}{\sum_{i=1}^n K\Big(\frac{x-x_i}{h}\Big)} \end{eqnarray*} The estimate is $x'=m(x)$ is called the sample mean at x with kernel K.

This will always be biased towards region with high density.

Thus if we were to move along the vector $m(x)-x$,we would reach the region with higher density.The density at $m(x)$ will be greater than density at $x$. This forms the basis of mean shift algorithm.

The vector $m(x)-x$ is called the mean shift vector which always points in the direction of local maximum or mode. \begin{eqnarray*} m(x)-x = \frac{\sum_{i=1}^n K\Big(\frac{x-x_i}{h}\Big)(x_i-x)}{\sum_{i=1}^n K\Big(\frac{x-x_i}{h}\Big)} \\ m(x)-x = \frac{-h^2\nabla f_h(x)}{f_h(x)} \end{eqnarray*} This is a estimate of normalize gradient of $f_h(x)$

Given any point x,we can take a small step in the direction of vector $m(x)-x$ to reach the local maximum.

Let us consider that the present estimate of the mode is $x$, then we compute $m(x)$ at this point.

For examples let initial estimate of the location of mode be $(-0.96,-2.01)$ The density at this point can be approximated by interpolation or computed again using non parametric density estimation

The plot for this is show in fig:image5.The estimate clearly does not lie at maximum.

To find the direction of the mean shift vector we find the gradient of the normalize density estimate and take a smalll step in that direction.This is perform till gradient magnitude is very small

fig:image5 A video for mean shift algorithm using KDE is shown in

In this case we scale the gradient by the estimated PDF values to obtain normalize gradient values. \begin{eqnarray*} m(x)-x = \frac{-h^2\nabla f_h(x)}{f_h(x)} \end{eqnarray*} This enabled us to adaptively change the step size based on estimated PDF value.The step size magnitude is iversly proportional to estimated PDF values. if the estimated PDF values is small,we are far away from the maximum and the step size will be large.

If the estimate PDf value is large,we are close to maximum and the step size will be small.

to find the modes of the PDF,we do not actually required to estimate the PDF,we require just the gradient of the PDF to move in the direction of the mean shift vector.

The gradient of superposition of kernels centered at each data point is equivalent to convolving the data points with gradient of the kernel.

Instead of convolving with gaussian kernel,we can convolve with gradient of gaussian kernel.

\begin{eqnarray*} k(X) = C exp\Big(-\frac{x^2+y^2}{2*h}\Big) \\ \nabla k(X) = \Big[-\frac{x}{h}*k(x) ; -\frac{y}{h}*k(x) \Big] \end{eqnarray*} Thus given a intial point ${X}$ ,we estimate the value at ${X}$ using the kernels $-\frac{x}{h}*k(x)$ and $-\frac{x}{h}*k(x)$ which gives us the direction of gradient at the point $X$

Since we do not actually estimate the PDF at a point,but estimate the gradient of PDF each time during the mean shift iteration we need to take a step in direction of mean shift vector,in the earlier case ,we used the scale the gradient by the estimated PDF values to obtained a normalized measure.

However in the present case we do not adaptively change the step size but take a step of fixed size in direction of the gradient.

This still incorporates some adaptive behavior,since mean shift vector magnitude depends on the gradient magnitude.

If gradient magnitude is large,step size take will be large else step take will be small and refined ,near the maximum.

video of mean shift algorithm using gradient estimates is shown in

This iterative algorithm is a standard gradient descent algorithm and the convergence is guranteed for infinately small step size.

Since the algorithm depends on kernel density estimate, the bandwith of kernel will play a important role in mean shift algorithm as well.

#### Local Maxima

If we reach a region,where local density is flat or we have reached a local maximum.The algorithm will terminate.

this is a problem in case of all algorithms trying to reach a global maximum.The animation for the same is shown in

#### Code

The Code is written in matlab and available in repository https://github.com/pi19404/m19404/tree/master/meanshift the file mean_shift.m is the main file.The file kgde2 implements kernel density estimator using bivariate gaussian windows for 2D distributions.The file kgde2x implements estimation of gradient on KDE .The dim parameter decides the computation of gradient along x and y directions.


text:
# How can I create an index or TOC using latexdb and mysql?

I have a database full of names, addresses, etc.. We use them at my work to make sure only people in the database are allowed inside (or denied entry, if they've ever done something wrong). I created a document with pdflatexdb, and by using longtable, I now have a 'working' document that I can live with if I have to.

However, as we add people to the database everyday, the "list" gets larger and less manageable as far a scanning for a name or id number and the like. What I'd like to figure out is how to create an "index" that will show which pages last names (a field in the DB) start with... IE - names that start with A are on page one, B page 50, C page 60, and so forth. Here is a working example:

\documentclass[10pt,twoside]{report}

\usepackage{longtable}
\usepackage[left=.5in, right=.5in, top=1cm, bottom=.8in]{geometry}

\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot{}
\fancyfoot[RE, RO]{\thepage}
\fancyfoot[C]{Generated: \today}

\texdbconnection{CONNECTION STUFF}

%% BEGIN TeXDBdef

%% EHD TeXDBdef

\begin{document}
\begin{center}\section*{These people are allowed inside the building.}\end{center}
\begin{center}\Large{Ordered by name}\end{center}
\begin{longtable}{@{\extracolsep{\fill}}llp{8cm}l}
\vspace{.8em}
\end{longtable}

\end{document}

I am a relative n00b to LaTeX, so please be gentle if my document has glaring errors (I'm assuming some of my code is redundant or even useless).

Thanks.

-
FYI, I'm working on a PHP frontend for this, so please don't comment on the uselessness of a paper list... –  jmd9qs Apr 13 '13 at 11:29

It's not possible to run the code without the connection package and something to connect to however

\Large{Ordered by name}

size commands like \Large don't take an argument so if you use in that form the {} are not delimiting an argument but making a group which is harmless in this case but confusing, better to leave out the braces.

But I would guess that you can replace

\texttt{##lname,}

by

\labelname{##lname}\texttt{##lname,}

where \labelname gets the first letter and does a \label if it is new, something like

\def\labelname#1{\xlabelname#1.\relax}
\def\xlabelname#1#2\relax{%
\def\tmp{#1}%
\ifx\tmp\firstletter
\else
\global\let\firstletter\tmp
\label{letter-#1}%
\fi}

then at the end you just need to use \pageref on each letter in turn:

\documentclass{article}

\def\labelname#1{\xlabelname#1.\relax}
\def\xlabelname#1#2\relax{%
\def\tmp{#1}%
\ifx\tmp\firstletter
\else
\global\let\firstletter\tmp
\label{letter-#1}%
\fi}

\begin{document}

\labelname{Alan}Alan
\labelname{Brian}Brian
\labelname{David}David

\newpage

\labelname{Duncan}Duncan
\labelname{Fred}Fred

\section{Name index}

\makeatletter
\def\refnameletter#1{%
\expandafter\ifx\csname r@letter-#1\endcsname\relax\else
\par\noindent#1: \pageref{letter-#1}\par
\fi
\if Z#1\else\expandafter\refnameletter\fi}

\refnameletter ABCDEFGHIJKLMNOPQRSTUVWXYZ

\end{document}

-
thanks! I know this isn't testable on your end, but I'll give it a go and get back to you later on today. –  jmd9qs Apr 13 '13 at 12:16
I should probably comment for the record that there are letters other than A-Z and this will silently ignore them, but it saved worrying about encodings and stuff. –  David Carlisle Apr 13 '13 at 12:18
I figured that, but it suits my needs as I don't need to worry about special characters or anything... Thanks again! –  jmd9qs Apr 13 '13 at 13:02
Thanks for your solution David! As of now it's not gonna work for me, I think I'm going to have to give in and write a perl script... probably a cleaner solution, and more maintainable. –  jmd9qs Apr 13 '13 at 16:10


text:
# Calculate conditional expectation of exponential variables

1. Sep 27, 2014

### obst12

1. The problem statement, all variables and given/known data
Let X and Y be independent exponential random variables with parameters a and b. Calculate E(X|X+Y).

2. Relevant equations

3. The attempt at a solution
I'm pretty sure I have it, just want to make sure.

Joint density for X and Y is abe^(-ax)e^(-by) for x,y>0. Let Z=X and W=X+Y so X=Z and Y=W-Z. The Jacobian is 1, so the joint density is

abe^(-az)e^(-bw+bz)=abe^(+bz-az) e^(-bw)

Marginal density for w is

\int_0^ w abe^(bz-az) e^(-bw) dz=ab(e^(bw-aw)-1) /(b-a)

So then conditional density is

(b-a)e^(bz-az) e^(-bw)/(e^(bw-aw)-1)

Then just integrate z from 0 to infinity to get
e^(-bw)/(1-e^(bw-aw))

Is this okay?

2. Sep 27, 2014

### Ray Vickson

No, it is not OK. Given $X+Y = w$, $X$ has range $[0,w]$; in your notation, $0 \leq (Z|W=w) \leq w$. Therefore, integrating out to $\infty$ is wrong. Also, your "conditional density" $f(z|w)$ for $(Z|W=w)$ looks incorrect a bit. Go back to square one and proceed very carefully. The correct final answer is more complicated than yours.

3. Sep 27, 2014

### obst12

Thanks. Let me try once more.

The joint density is
$abe^{-ax}e^{-by}$
Then making the substitution $X=Z$ and $Y=W-Z$.
$\rho_{Z.W}=abe^{-az}e^{-bw+bz}$
$\rho_{Z,W}=abe^{(b-a)z}e^{-bw}$

Thus the marginal density is
$\rho_W=\int_0^w abe^{(b-a)z}e^{-bw} dz$
$\rho_W=abe^{-bw} \int_0^w e^{(b-a)z} dz$
$rho_W=abe^{-bw} \frac{1}{b-a} (e^{(b-a)w}-1)$

And the conditional density is
$\rho_{Z|W}=abe^{(b-a)z}e^{-bw}\frac{1}{abe^{-bw} \frac{1}{b-a} (e^{(b-a)w}-1)}$
$\rho_{Z|W}=e^{(b-a)z}\frac{1}{\frac{1}{b-a} (e^{(b-a)w}-1)}$
$\rho_{Z|W}=e^{(b-a)z}\frac{b-a}{(e^{(b-a)w}-1)}$

Then integrate from $0$ to $w$

$\mathbb{E}(Z|W)=\int_0^w z e^{(b-a)z}\frac{b-a}{(e^{(b-a)w}-1)} dz$
$\mathbb{E}(Z|W)=\frac{b-a}{(e^{(b-a)w}-1)} \int_0^w z e^{(b-a)z} dz$
$\mathbb{E}(Z|W)=\frac{b-a}{(e^{(b-a)w}-1)} \frac{e^{(b-a)w}((b-a)w-1)+1}{(b-a)^2}$

Is this okay? Thanks for your help.

4. Sep 27, 2014

### Ray Vickson

Yes, it's OK, but it should be simplified a bit. You can make it look nicer by writing
$$E(X|X+Y=w) = \frac{e^{cw}(cw-1)+1}{c(e^{cw}-1)}, \: c = b-a$$

5. Sep 27, 2014

### obst12

Awesome, thanks for all your help!


text:
A narrow beam of singly-charged potassium ions of kinetic energy
Question:

A narrow beam of singly-charged potassium ions of kinetic energy $32 \mathrm{keV}$ is injected into a region of width $1.00 \mathrm{~cm}$ having a magnetic field of strength $0.500 T$ as shown in figure. The ions are collected at a screen $95.5 \mathrm{~cm}$ away from the field region. If the beam contains isotopes of atomic weights 39 and 41 , find the separation between the points where these isotopes strike the screen. Take the mass of a potassium ion $=A\left(1.6 \times 10^{-27}\right) \mathrm{kg}$ where A is the mass number.

Solution:


text:
# Frontiers of Mechanical Engineering

 Front. Mech. Eng.    2020, Vol. 15 Issue (3) : 438-474     https://doi.org/10.1007/s11465-019-0579-1
 REVIEW ARTICLE
Review of the crushing response of collapsible tubular structures
Vivek PATEL(), Gaurav TIWARI, Ravikumar DUMPALA
Department of Mechanical Engineering, Visvesvaraya National Institute of Technology, Nagpur 440010, India
 Download: PDF(6719 KB)   HTML Export: BibTeX | EndNote | Reference Manager | ProCite | RefWorks
 Abstract Studies on determining and analyzing the crushing response of tubular structures are of significant interest, primarily due to their relation to safety. Several aspects of tubular structures, such as geometry, material, configuration, and hybrid structure, have been used as criteria for evaluation. In this review, a comprehensive analysis of the important findings of extensive research on understanding the crushing response of thin-walled tubular structures is presented. Advancements in thin-walled structures, including multi-cell tube, honeycomb and foam-filled, multi wall, and functionally graded thickness tubes, are also discussed, focusing on their energy absorption ability. An extensive review of experimentation and numerical analysis used to extract the deformation behavior of materials, such as aluminum and steel, against static and dynamic loadings are also provided. Several tube shapes, such as tubes of uniform and nonuniform (tapered) cross sections of circular, square, and rectangular shapes, have been used in different studies to identify their efficacy. Apart from geometric and loading parameters, the effects of fabrication process, heat treatment, and triggering mechanism on initiating plastic deformation, such as cutouts and grooves, on the surface of tubular structures are discussed. Corresponding Author(s): Vivek PATEL Just Accepted Date: 23 February 2020   Online First Date: 20 March 2020    Issue Date: 03 September 2020
 Cite this article: Vivek PATEL,Gaurav TIWARI,Ravikumar DUMPALA. Review of the crushing response of collapsible tubular structures[J]. Front. Mech. Eng., 2020, 15(3): 438-474. URL: http://journal.hep.com.cn/fme/EN/10.1007/s11465-019-0579-1 http://journal.hep.com.cn/fme/EN/Y2020/V15/I3/438
 0
 Fig.1  Force vs. displacement curve of tubular structures used for measuring crashworthiness parameters. Fig.2  Classification of a tubular structure. Fig.3  Mode of collapse element: (a) Type-I and (b) Type-II. w: Width of the tube; α, γ: folding angle of corner element; N: Distance between the plastic hinges of folding element. Reproduced with permission from Ref. [6] from Elsevier. Fig.4  Front and top views of a deformed tube with two opposite holes at mid height. Reprinted with permission from Ref. [21] from Elsevier. Fig.5  Specimens with (a) alternative grooves [24] and (b) external grooves only [25]. $D ‾$, $Do$, $Di$: Mean, outer, and inner diameter of shell/tube, respectively; b, d: Width and depth of groove, respectively; λ: Groove distance; H: Length of rings between grooves.Reproduced with permission from Refs. [24,25] from Elsevier. Fig.6  Steel samples: Collapse modes at velocities of 385, 277, 227, 173, and 0 m/s (from left to right). Reprinted with permission from Ref. [27] from Elsevier. Fig.7  Geometric configuration of the ring-fitted tube under axial and oblique loading conditions. V: Velocity of striker; β: Load angle. Reproduced with permission from Ref. [30] from Elsevier. Fig.8  Schematic of circular tubes with (a) radial corrugation and (b) longitudinal corrugation. Fig.9  Schematic of specimens with developed designs of (a) tube with expanding rigid ring press-fitted at the top and (b) tube with wide external grooves. $do$, $di$: Outer and inner diameter of expanding steel ring; L1, L2: Length of tubes. Reproduced from Ref. [34] from Elsevier. Fig.10  Circular tube with buckling initiator. Reprinted with permission from Ref. [39] from Elsevier. Fig.11  Aluminum samples: Collapse mode at velocities of 361, 220, 137, and 0 m/s (from left to right). Reprinted with permission from Ref. [27] from Elsevier. Fig.12  Schematic representation of tube splitting arrangement. Reproduced with permission from Ref. [45] from Elsevier. Fig.13  Constraint used for a square box component: (a) Grooves on the sidewalls of the tube and (b) grooved end cap for end constraint. Reprinted with permission from Ref. [47] from Elsevier. Fig.14  Square hat tube with trigger. Reproduced with permission from Ref. [51] from Elsevier. Fig.15  Numerical models of (a) conventional square tube, (b) square tube with grooves on all faces, and (c) square tube with grooves on opposite faces. Reprinted with permission from Ref. [52] from Elsevier. Fig.16  Schematic of square tubes with different trigger positions: (a) Trigger at the top, (b) trigger symmetric on two planes, and (c) trigger asymmetric on three planes. Reproduced with permission from Ref. [58] from Elsevier. Fig.17  Schematic of new design structure: (a) With pyramidal element, (b) Type A, and (c) Type B patterns. p, q: Side of pyramidal element; s: Apex height. Reproduced with permission from Ref. [59] from Elsevier. Fig.18  Schematic of a square tube with a hole at mid length. $ds$: Slot diameter. Reproduced with permission from Ref. [60] from Taylor & Francis. Fig.19  Mechanism of deformation. Reproduced with permission from Ref. [69] from Elsevier. Fig.20  Schematic of tapered tubes (a) without cutouts and (b) with circular cutouts. $Ds$, $Dl$: Smaller and larger end diameter of frusta tube respectively; φ: Taper angle of frusta tube. Reproduced with permission from Ref. [79] from Elsevier. Fig.21  Collapse modes of combined tube: (a) Compound diamond, (b) compound fragmentation, (c) delamination, and (d) catastrophic failure. Reprinted with permission from Ref. [86] from Elsevier. Fig.22  Modes of failure of specimens under compressive loading: (a) Mode-I, (b) Mode-II, and (c) Mode-III. Reprinted with permission from Ref. [97] from Elsevier. Fig.23  Spot-welded steel–CFRP SHS tube. Reprinted with permission from Ref. [102] from Elsevier. Fig.24  Deformed specimens: (a) Non-compact form and (b) compact form. Reprinted with permission from Ref. [109] from Elsevier. Fig.25  Crushed specimens: (a) Square, (b) hexagonal, and (c) octagonal filled with aluminum foam. Reprinted with permission from Ref. [112] from Elsevier. Fig.26  Constrained multi-tube structure: (a) Hexagonal packed empty, (b) hexagonal packed aluminum foam filled, (c) square packed empty, and (d) square packed aluminum foam filled tube. Reproduced with permission from Ref. [113] from Elsevier. Fig.27  (a) Aluminum foam-filled tube, (b) polystyrene foam-filled tube, and (c) concertina collapse mode. Reprinted with permission from Ref. [120] from Elsevier. Fig.28  (a) Finite element model under oblique loading condition and (b) experimental setup for oblique loading. P: Applied load. Reproduced with permission from Ref. [122] from Elsevier. Fig.29  Geometric configurations of honeycomb sandwich columns: (a) Kagome, (b) triangle, (c) hexagon, (d) square-3, (e) square-4, and (f) diamond. Reprinted with permission from Ref. [125] from Elsevier. Fig.30  Configuration of honeycomb-filled single and bi-tubular polygonal tubes (N = 3, 4, 5, 6, 7, 8, and ∞): (a) Single polygon tubes and (b) bi-tubular polygon tubes. Reprinted with permission from Ref. [126] from Elsevier. Fig.31  Prepared samples: (a) Empty square aluminum tube, (b) aluminum honeycomb-filled tube, (c) polyurethane-filled tube, and (d) tube filled with honeycomb and foam. Reprinted with permission from Ref. [127] from Elsevier. Fig.32  Division of multi-cell section: (a) Corner, (b) crisscross, and (c) T-shaped. Reprinted with permission from Ref. [131] from Elsevier. Fig.33  Multi-cell tube cross section with different angle elements. Reprinted with permission from Ref. [132] from Elsevier. Fig.34  (a) Angle element with varying cross sections and (b) specimen for axial testing. Reprinted with permission from Ref. [134] from Elsevier. Fig.35  Multi-cell tube with different sections. Reprinted with permission from Ref. [135] from Elsevier. Fig.36  Schematic representation of foam-filled tubular structures with different cell configurations. Reprinted with permission from Ref. [137] from Elsevier. Fig.37  Multi-cell tubes: (a) Triangular lattice and (b) Kagome lattice. Reprinted with permission from Ref. [138] from Elsevier. Fig.38  Schematic of a circular tube with inserts. $ti$: Insert wall thickness; R: Radius of shell/tube. Reproduced with permission from Ref. [139] from Elsevier. Fig.39  FGT variation in tubes: (a) Longitudinal direction and (b) transverse direction. Fig.40  (a) Thickness nonuniformity and (b) structural layout of CTGTs under oblique load. Reproduced with permission from Ref. [147] from Elsevier. Fig.41  Prepared specimens: (a) Square tube with uniform and graded thickness and (b) two configurations of graded thickness. Reproduced with permission from Ref. [144] from Elsevier. Fig.42  FGT multi-cell tubes: (a) 3D view and (b) 2D view. Reprinted with permission from Ref. [149] from Elsevier. Fig.43  Configuration of bi-tubular specimens: (a) Parallel and (b) diamond arrangements. Reprinted with permission from Ref. [151] from Elsevier. Fig.44  Schematic of (a) the dumbbell-shaped novel tube, (b) cross-sectional view, and (c) self-locking tube. Reprinted with permission from Ref. [162] from Elsevier. Fig.45  Self-locking energy absorber with enclosed and unenclosed forms. Reproduced with permission from Ref. [164] from Elsevier. Fig.46  Nested tubular structures incorporating the same outer circular part with different inner parts such as: (a) An oblong cross-section, (b) two circular tubes of different diameters, and (c) two circular tubes of the same diameter. Reprinted with permission from Ref. [165] from Elsevier. Fig.47  Comparison of the load–displacement plots of multi-cell tubular structures: (a) Without foam and (b) foam-filled. Reproduced with permission from Ref. [172] from Elsevier.


text:
# How do you decompose the flexible budget variance?

The flexible budget variance captures the impact on Operating Income of changes in usages or prices.

The flexible budget variance is difficult to define because it conflates the effects of variations from many different estimates: selling prices, resource usages and resource prices (for many different kinds of resources), and fixed costs. It is therefore also possible to produce less equivocal third-level variances (L3) by switching successively each kind of estimate and looking at the impact on Operating Income.

Selling price variance

The selling price variance is the impact on operating income of a difference between actual and budgeted selling prices, for one or several products.

For a single product, it is given by the following formula:

$\text{Selling price variance} = Q_\color{red}A \times (P_\color{red}A - P_\color{blue}B)$

You may wonder why there is no usage variance in this case: it is because we assume that one product sold at the price $$P_\color{blue}B$$ corresponds to one product out of the inventory. As for the multi-product case, the easier way to get the selling price variance is to make the sum of all individual products’ selling price variances. An alternative is to use the change in unit contribution margin caused by the changes in selling price, after accounting for the impact of product mix, but before accounting for changes in unit variable costs.

Resource usage variance

The resource usage variance (sometimes also called input efficiency or quantity variance) is the impact on operating income of consuming an actual quantity of resource per unit of output different from the budgeted quantity of resource per unit of output.

It is a difference between the actual and budgeted use of a resources, given the actual volume and the budgeted price of the resource. Note that the resource can be anything: you can have a material usage variance, a labor usage variance, an energy usage variance, etc.

$\text{Resource usage variance} = Q_\color{red}A \times (RU_\color{red}A - RU_\color{blue}B) \times RP_\color{blue}B$

Resource price variance

The resource price variance (sometimes also called input rate variance) is the impact on operating income of buying a quantity of resource at a price different than the budgeted price for this resource.

The resource price variance (sometimes also called input rate variance) is a difference between the amount paid for the resource and the amount that would have been paid if the resource had been purchased at its standard price. Again, the resource can be anything: you can have a material price variance, a labor price (or rate) variance, an energy price variance, etc.

$\text{Resource price variance} = Q_\color{red}A \times RU_\color{red}A \times (RP_\color{red}A - RP_\color{blue}B)$

Together, resource usage and resource price variances constitute the resource cost variance:

\begin{aligned} \text{Resource cost variance} & = Q_\color{red}A \times (RU_\color{red}A \times RP_\color{red}A - RU_\color{blue}B \times RP_\color{blue}B) \\ & = \text{resource usage variance} + \text{resource price variance} \end{aligned}

Fixed costs variance

The fixed cost variance is just the difference between the actual amount of fixed costs and the budgeted amount of fixed costs:

$\text{Fixed cost variance} = FC_\color{red}A - FC_\color{blue}B$

BE CAREFUL! When you compute a cost variance with these formulas (resource usage variance, resource price variance, resource cost variance, or fixed cost variance), a positive number means that costs increase, and therefore operating income decreases. We will see later the impact it has on how you report variances.

Illustration