In the last decade interest in the "wisdom of crowds" effect has gained momentum in both organizational research and corporate practice. Crowd wisdom relies on the aggregation of independent judgments. The accuracy of a group's aggregate prediction rises with the number, ability, and diversity of its members. We investigate these variables' relative importance for collective prediction using agent-based simulation. We replicate the "diversity trumps ability" proposition for large groups, showing that samples of heterogeneous agents outperform same-sized homogeneous teams of high ability. In groups smaller than about 16 members, however, the effects of group composition depend on the social decision function employed: Diversity is key only in continuous estimation tasks (averaging) and much less important in discrete choice tasks (voting), in which agents' individual abilities remain crucial. Thus, strategies to improve collective decision-making must adapt to the predictive situation at hand.