  The stellar-to-halo mass relation (SHMR) is a fundamental relationship
between galaxies and their host dark matter haloes. In this study, we examine
the scatter in this relation for primary galaxies in the semi-analytic
L-Galaxies model and two cosmological hydrodynamical simulations, \eagle{} and
\tng{}. We find that in low-mass haloes, more massive galaxies tend to reside
in haloes with higher concentration, earlier formation time, greater
environmental density, earlier major mergers, and, to have older stellar
populations, which is consistent with findings in various studies. Quantitative
analysis reveals the varying significance of halo and galaxy properties in
determining SHMR scatter across simulations and models. In \eagle{} and \tng{},
halo concentration and formation time primarily influence SHMR scatter for
haloes with $M_{\rm h}<10^{12}~\rm M_\odot$, but the influence diminishes at
high mass. Baryonic processes play a more significant role in \lgal{}. For
halos with $M_{\rm h} <10^{11}~\rm M_\odot$ and $10^{12}~\rm M_\odot<M_{\rm
h}<10^{13}~\rm M_\odot$, the main drivers of scatter are galaxy SFR and age. In
the $10^{11.5}~\rm M_\odot<M_{\rm h} <10^{12}~\rm M_\odot$ range, halo
concentration and formation time are the primary factors. And for halos with
$M_{\rm h} > 10^{13}~\rm M_\odot$, supermassive black hole mass becomes more
important. Interestingly, it is found that AGN feedback may increase the
amplitude of the scatter and decrease the dependence on halo properties at high
masses.
