Premature loss of offspring decreases direct fitness of parents. In gregarious mammals, both ecological and social variables impact offspring survival and may interact with each other in this regard. Although a number of studies have investigated factors influencing offspring loss in mammals, we still know very little on how different factors interact with one another. We therefore investigated fetal and infant mortality in 3 large groups of wild crested macaques (Macaca nigra) over a period of up to 5 years by including potential social causes such as maternal dominance rank, male immigration, between group encounters, and ecological conditions such as rainfall in a multivariate survival analysis using Cox proportional hazards model. Infant but not fetal survival was most impaired after a recent takeover of the alpha-male position by an immigrant male. Furthermore, infant survival probability increased when there was an increase in number of group adult females and rainfall. Fetal survival probability also increased with an increase of these 2 factors, but more in high-ranking than low-ranking females. Fetal survival, unlike that of infants, was also improved by an increase of intergroup encounter rates. Our study thus stresses the importance of survival analyses using a multivariate approach and encompassing more than a single offspring stage to investigate the determinants of female direct fitness. We further provide evidence for fitness costs and benefits of group living, possibly deriving from high pressures of both within- and between-group competition, in a wild primate population.