---
abstract: 'We use a statistical approach to determine the relationship between the stellar masses of galaxies and the masses of the dark matter halos in which they reside. We obtain a parameterized stellar-to-halo mass (SHM) relation by populating halos and subhalos in an $N$-body simulation with galaxies and requiring that the observed stellar mass function be reproduced. We find good agreement with constraints from galaxy-galaxy lensing and predictions of semi-analytic models. Using this mapping, and the positions of the halos and subhalos obtained from the simulation, we find that our model predictions for the galaxy two-point correlation function (CF) as a function of stellar mass are in excellent agreement with the observed clustering properties in the SDSS at $z=0$. We show that the clustering data do not provide additional strong constraints on the SHM function and conclude that our model can therefore predict clustering as a function of stellar mass. We compute the conditional mass function, which yields the average number of galaxies with stellar masses in the range $m\pm{\rm d}m/2$ that reside in a halo of mass $M$. We study the redshift dependence of the SHM relation and show that, for low mass halos, the SHM ratio is 