The origins of ultra-high-energy cosmic rays (UHECRs) continue to elude us due to the intricate
interplay between their acceleration and escape mechanisms, propagation physics, and detection
limitations. Developing a comprehensive statistical model is further complicated by the numerous
parameters and uncertainties involved. In this study, we present a statistical analysis of the
connection between UHECRs and astrophysical sources using a Bayesian hierarchical framework
introduced in Capel and Mortlock (MNRAS, 484, 2). We expand on this framework by incorporating the effects
of the Galactic magnetic field on UHECR propagation and introduce a novel method for inferring
the nuclear composition at the source based on the observed composition at Earth. Our approach
respects rigidity-dependent deflections and energy-loss horizons for each event, depending on
its observed mass, energy, and arrival direction. We applied our approach to publicly available
data from the Telescope Array. Since event-by-event composition-
sensitive variables are not yet available, we assume an average observed composition. By providing
a more accurate understanding of the nuclear composition at the source, our approach can improve
our knowledge of the processes that generate cosmic rays. Our results offer new insights into
the differences between Northern and Southern skies and enhance our ability to understand the
astrophysical phenomena underlying UHECR production.