Helicobacter pylori eradication therapy was included with insurance coverage from 1999 onwards in Japan, with the incidence of peptic ulcer expected to decrease as a consequence. This study investigated the temporal dynamics of peptic ulcer in Japan and identified underlying contributory factors using mathematical models. We investigated the seroprevalence of H. pylori and analysed a snapshot of peptic ulcer cases. Ten statistical models that incorporated important events – H. pylori infection, the cohort effect, eradication therapy and the natural trend for reduction – were fitted to the case data. The hazard of infection with H. pylori was extracted from published estimates. Models were compared using the Akaike information criterion (AIC), and factor contributions were quantified using the coefficient of determination. The best-fit model indicated that 88.1% of the observed snapshot of cases (AIC = 289.2) included the effects of (i) H. pylori infection, (ii) the cohort effect and (iii) eradication therapy, as explanatory variables, the contributions of which were 80.8%, 4.0% and 3.2%, respectively. Among inpatients, a simpler model with (i) H. pylori infection only was favoured (AIC = 107.7). The time-dependent epidemiological dynamics of peptic ulcers were captured and H. pylori infection and eradication therapy explained ⩾84% of the dramatic decline in peptic ulcer occurrence.