Analyzing patterns of species diversity as departures from random expectations