Determinants of local population size in patchy habitats