Phenotypic plasticity as a cause and consequence of population dynamics.