Understanding the dynamics of social and environmental variability