ratio_variance¶
-
forest.benchmarking.observable_estimation.
ratio_variance
(a: Union[float, numpy.ndarray], var_a: Union[float, numpy.ndarray], b: Union[float, numpy.ndarray], var_b: Union[float, numpy.ndarray]) → Union[float, numpy.ndarray]¶ Given random variables ‘A’ and ‘B’, compute the variance on the ratio Y = A/B.
Denote the mean of the random variables as a = E[A] and b = E[B] while the variances are var_a = Var[A] and var_b = Var[B] and the covariance as Cov[A,B]. The following expression approximates the variance of Y
\[Var[Y] \approx (a/b)^2 * ( var_a /a^2 + var_b / b^2 - 2 * Cov[A,B]/(a*b) )\]We assume the covariance of A and B is negligible, resting on the assumption that A and B are independently measured. The expression above rests on the assumption that B is non-zero, an assumption which we expect to hold true in most cases, but makes no such assumptions about A. If we allow E[A] = 0, then calculating the expression above via numpy would complain about dividing by zero. Instead, we can re-write the above expression as
\[Var[Y] \approx var_a /b^2 + (a^2 * var_b) / b^4\]where we have dropped the covariance term as noted above.
See the following for more details:
Parameters: - a – Mean of ‘A’, to be used as the numerator in a ratio.
- var_a – Variance in ‘A’
- b – Mean of ‘B’, to be used as the numerator in a ratio.
- var_b – Variance in ‘B’