how is diversity in an ecosystem determined?