Delta
Delta method
Theory
Let’s say that X̄ is approximately normally distributed with mean μx and variance σx^2/n, and Ȳ is approximately normally distributed with mean μy and variance σy^2/n.
The first-order Taylor expansion of g(X̄, Ȳ) around (μx, μy) is:
- [math]\displaystyle{ g(\bar{X}, \bar{Y}) ≈ g(\mu_x, \mu_y) + g_1(\mu_x, \mu_y)(\bar{X} - \mu_x) + g_2(\mu_x, \mu_y)(\bar{Y} - \mu_y) }[/math]
where g1(μx, μy) and g2(μx, μy) are the partial derivatives of g with respect to X̄ and Ȳ evaluated at (μx, μy), respectively.
"car" R package
- https://cran.r-project.org/web/packages/car/index.html
- How do we combine errors, in biology? The delta method
Examples
[math]\displaystyle{ Var(log(\bar{X}/\bar{Y})) }[/math]
R codes https://gist.github.com/arraytools/c39f52b9280f4f1858da83a6bc60f185.
- [math]\displaystyle{ \begin{align} g(\bar{X}, \bar{Y}) &\approx g(\mu_x, \mu_y) + g_1(\mu_x, \mu_y)(\bar{X} - \mu_x) + g_2(\mu_x, \mu_y)(\bar{Y} - \mu_y) \\ Var(g(\bar{X}, \bar{Y})) &\approx g_1(\mu_x,\mu_y)^2 * Var(\bar{X}) + g_2(\mu_x,\mu_y)^2 *Var(\bar{Y}) + \\ & \qquad 2*g_1(\mu_x, \mu_y)*g_2(\mu_x, \mu_y)*Cov(\bar{X}, \bar{Y}) \end{align} }[/math]
where [math]\displaystyle{ g_1(\mu_x, \mu_y) }[/math] and [math]\displaystyle{ g_2(\mu_x, \mu_y) }[/math] are the partial derivatives of g with respect to X̄ and Ȳ evaluated at (μx, μy), respectively. In the case of log(X̄/Ȳ), we have:
g1(μx, μy) = ∂g/∂X̄ = 1/X̄, g2(μx, μy) = ∂g/∂Ȳ = -1/Ȳ
Substituting these values into the formula above gives:
- [math]\displaystyle{ \begin{align} Var(log(\bar{X}/\bar{Y})) &≈ (1/\mu_x)^2 * Var(\bar{X}) + (-1/\mu_y)^2 * Var(\bar{Y}) + 2 * (1/\mu_x) * (-1/\mu_y) * Cov(\bar{X}, \bar{Y}) \\ &= \sigma_x^2/(n*\mu_x^2) + \sigma_y^2/(n*\mu_y^2) - 2Cov(\bar{X}, \bar{Y})/(\mu_x \mu_y) \end{align} }[/math]
Gamma method of moment estimator (bivariate normal)
http://fisher.stats.uwo.ca/faculty/kulperger/SS3858/Handouts/DeltaMethod.pdf