# How do I calculate the standard deviation of the log-odds?

I have in my notes that the standard deviation of log odds is given by the

$$\sqrt{(1/a + 1/b + 1/c + 1/d)}$$

I know that the derivation of this requires the Delta Method, but I'm not familiar with this method. Would anybody mind spelling this out?

Essentially, the Delta Method is a way of "linearizing" a non-linear function using a Taylor Series expansion so that you can find the variance and hence the standard error. For example, let's say you have a function $$f(X) = Y$$ that has a first and second order derivative. Then a first order Taylor Series Expansion centered around $$\mu$$ is given by:

$$\begin{eqnarray*} \newcommand{\Var}{{\rm Var}} Y=f(X) \approx f(\mu)+f^{\prime}\left(\mu\right)(X-\mu)] \end{eqnarray*}$$ And a second order approximation given by:

$$\begin{eqnarray*} f(X) \approx f(\mu) + f^\prime({\mu})(X-\mu)+ {1 \over{2}}f^{\prime\prime}(\mu)(X-\mu)^2 \end{eqnarray*}$$

So, assuming $$E(X)=\mu$$ and $$Var(X)=\sigma^2$$ to find the approximate expected value of the nonlinear function $$Y$$, we have:

$$\begin{eqnarray*} E(Y)\approx E[f(X)] & = & E[f(\mu)]+E\big[f^{\prime}\left(\mu\right)(X-\mu)\big]+\frac{1}{2}E\big[f^{\prime\prime}\left(\mu\right)(X-\mu)^{2}\big]\\ & = & f(\mu)+f^{\prime}\left(\mu\right)(\mu-\mu)+\frac{1}{2}f^{\prime\prime}\left(\mu\right)E[(X-\mu)^{2}]\\ & = & f(\mu)+\frac{1}{2}f^{\prime\prime}\left(\mu\right)\sigma^{2} \end{eqnarray*}$$

Its corresponding Variance can be estimated by:

$$\begin{array}{} \Var(Y)=\Var\left[f(X)\right]=E\left\{ [f(x)-E(f(x))]^{2}\right\} & \approx & E\left[f(\mu)+f^{\prime}(\mu)(X-\mu)-f(\mu))\right] \\ & &\mbox{(Substituting 1st order polynomial)} \\ & = & \left[f^{\prime}(\mu)^{2}\right]E\left[(X-\mu)^{2}\right]\\ & = & \left[f^{\prime}(\mu)^{2}\right]\Var(X) \end{array}$$

So, in the case of the log odds, $$\log(\hat{OR)}$$, Let $$Y = \log(\hat{OR)}$$. Then, because the groups $$n_1$$ and $$n_2$$ are independent we have:

$$\begin{eqnarray*} \Var\left[\log(\hat{OR})\right] & = & \Var\left[\log\left(\frac{\frac{\hat{p}_1}{1-\hat{p}_1}}{\frac{\hat{p}_2}{1-\hat{p}_2}}\right)\right]\\[5pt] & = & \Var\left[\log\left(\frac{\hat{p}_1}{1-\hat{p}_1}\right)\right]+ \Var\left[\log\left(\frac{\hat{p}_2}{1-\hat{p}_2}\right)\right]\\[5pt] & = & \left(\frac{1}{\hat{p}_{1}\left(1-\hat{p}_{1}\right)}\right)^{2}\frac{\hat{p}_{1}(1-\hat{p}_{1})}{n_{1}}+\left(\frac{1}{\hat{p}_{2}\left(1-\hat{p}_{2}\right)}\right)^{2}\frac{\hat{p}_{2}(1-\hat{p}_{2})}{n_{2}}\\[5pt] & = & \frac{1}{n_{1}\hat{p}_{1}(1-\hat{p}_{1})}+\frac{1}{n_{2}\hat{p}_{2}(1-\hat{p}_{2})}\\[5pt] & = & \frac{1}{n_{1}\hat{p}_{1}}+\frac{1}{n_{1}(1-\hat{p}_{1})}+\frac{1}{n_{2}\hat{p}_{2}}+\frac{1}{n_{2}(1-\hat{p}_{2})}\\[5pt] & = & \frac{1}{a}+\frac{1}{b}+\frac{1}{c}+\frac{1}{d} \end{eqnarray*}$$

To obtain the standard error, we simply take the square root and you obtain your results from your notes:

$$\begin{eqnarray*} SE[\log(\hat{OR})] = \sqrt{\Var\left[\log(\hat{OR})\right]}= \sqrt{\frac{1}{a}+\frac{1}{b}+\frac{1}{c}+\frac{1}{d}} \end{eqnarray*}$$

I discovered a slightly easier way of coming to the same conclusion:

\begin{align}\text{OR} &= \frac{ad}{bc}\\ \log(\text{OR}) &= \log(a) + \log(d) – \log(b) – \log(c) \\ & =\log(a) – \log(b) – \log(c) + \log(d)\end{align}

We treat the four counts as independent Poisson so $$\operatorname{var}(a) = a, ~\operatorname{var}(b) = b, ~\operatorname{var}(c) = c, ~\operatorname{var}(d) = d.$$

By Delta Method:

$$\operatorname{var} (f(X)) = (f^\prime(X))^2 \cdot \operatorname{var}(X)$$

$$\operatorname{var}(\log(a)) = (1/a)^2 \cdot \operatorname{var}(a) = 1/a$$

And by independence

$$\operatorname{var}(\log(\text{OR})) = 1/a + 1/b + 1/c + 1/d.$$

QED