Delta: Difference between revisions

From 太極
Jump to navigation Jump to search
(Created page with "Delta method * https://en.wikipedia.org/wiki/Delta_method * R examples. ** Var(xbar/ybar) https://gist.github.com/arraytools/c39f52b9280f4f1858da83a6bc60f185.")
 
No edit summary
 
Line 1: Line 1:
Delta method
Delta method
= Theory =
<ul>
<li>https://en.wikipedia.org/wiki/Delta_method
</ul>
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.


* https://en.wikipedia.org/wiki/Delta_method
The first-order Taylor expansion of g(X̄, Ȳ) around (μx, μy) is:
* R examples.  
:<math>
** Var(xbar/ybar) https://gist.github.com/arraytools/c39f52b9280f4f1858da83a6bc60f185.
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.
 
= Examples =
 
== <math>Var(log(\bar{X}/\bar{Y}))</math> ==
R codes https://gist.github.com/arraytools/c39f52b9280f4f1858da83a6bc60f185.
: <math>
\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>g_1(\mu_x, \mu_y)</math> and <math>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>
\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

Latest revision as of 20:03, 5 August 2023

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.

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