A general framework for quantitatively assessing ecological stochasticity