Testing for order among K populations: theory and examples