# How to calculate confidence interval for a geometric mean?

Apologies if this is confusing at all, I'm very unfamiliar with geometric means. For context, my data set is 35 month-end portfolio values. I found the month to month growth rate [Month(N)/Month(N-1)] - 1, such that I now have 34 observations and would like to estimate a month end value using the known previous month end's value. For example if I know what the ending value of the portfolio was last month, I would take that multiplied by a growth rate to get an estimate of this month's ending value +/- the margin of error.

I initially used the arithmetic mean of the growth rates, found the sample standard deviation and calculated a confidence interval to get my lower / upper bound growth rates.

I'm now doubting the accuracy of this method and have tried to use geometric mean instead. So currently I have my set of 34 growth rates except I did not subtract 1 so that all values are positive, calculated the geometric mean, and to calculate standard deviation used this wikipedia formula:
$$\sigma_g = \exp\!\!\left(\sqrt{\frac{\sum_{i=1}^n\ln\!\big(\frac{x_i}{\mu_g}\big)^2}{n}} \right)$$ I'm now at a loss as to how to calculate a 95% CI as I've looked through similar questions on this site as well as general searching the internet and am seeing different opinions on methods and formulas (I admittedly am also getting a bit lost in the underlying math).

Currently I'm using the formulas for a normal distribution to calculate a confidence interval based off the geometric standard deviation minus 1 (to get it back to a percentage), such that:

• Standard Error = [(Geometric Stdev-1)/Sqrt(N)],
• Margin of Error = [Standard Error * 1.96], and
• CI = [Geometric Mean +/- Margin of Error]

Is this a reasonable approximation or should I be using a different method to calculate the CI?

## You can compute the arithmetic mean of the log growth rate:

• Let $V_t$ be the value of your portfolio at time $t$
• Let $R_t = \frac{V_t}{V_{t-1}}$ be the growth rate of your portfolio from $t-1$ to $t$

The basic idea is to take logs and do your standard stuff. Taking logs transforms multiplication into a sum.

• Let $r_t = \log R_t$ be the log growth rate.

$$\bar{r} = \frac{1}{T} \sum_{t=1}^T r_t \quad \quad s_r = \sqrt{\frac{1}{T-1} \sum_{t=1}^T \left( r_t - \bar{r}\right)^2}$$

Then your standard error $\mathit{SE}_{\bar{r}}$ for your sample mean $\bar{r}$ is given by:

$$\mathit{SE}_{\bar{r}} = \frac{s_r}{\sqrt{T}}$$

The 95 percent confidence interval for $\mu_r = {\operatorname{E}[r_t]}$ would be approximately: $$\left( \bar{r} - 2 \mathit{SE}_{\bar{r}} , \bar{r} + 2 \mathit{SE}_{\bar{r}} \right)$$.

### Exponentiate to get confidence interval for $e^{\mu_r}$

Since $e^x$ is a strictly increasing function, a 95 percent confidence interval for $e^{\mu_r}$ would be:

$$\left( e^{\bar{r} - 2 \mathit{SE}_{\bar{r}}} , e^{\bar{r} + 2 \mathit{SE}_{\bar{r}}} \right)$$

And we're done. Why are we done?

### Observe $\bar{r} = \frac{1}{T} \sum_t r_t$ is the log of the geometric mean

Hence $e^{\bar{r}}$ is geometric mean of your sample. To show this, observe the geometric mean is given by:

$$\mathit{GM} = \left(R_1R_2\ldots R_T\right)^\frac{1}{T}$$

Hence if we take the log of both sides:

\begin{align*} \log \mathit{GM} &= \frac{1}{T} \sum_{t=1}^T \log R_t \\ &= \bar{r} \end{align*}

Some example to build intuition:

• Let's say you compute the mean log growth rate is $.02$. Then the geometric mean is $\exp(.02) \approx 1.0202$.
• Let's say you compute the mean log growth rate is $-.05$, then the geometric mean is $\exp(-.05) = .9512$

For $x \approx 1$, we have $\log(x) \approx x - 1$ and for $y \approx 0$, we have $\exp(y) \approx y + 1$. Further away though, those tricks breka down:

• Let's say you compute the mean log growth rate is $.69$, then the geometric mean mean is $\exp(.69) \approx 2$ (i.e. the value doubles every period).

If all your log growth rates $r_t$ are near zero (or equivalently $\frac{V_t}{V_{t-1}}$ is near 1, then you'll find that the geometric mean and the arithmetic mean will be quite close

### Another answer that might be useful:

As this answer discusses, log differences are basically percent changes.

Comment: it's useful in finance to get comfortable thinking in logs. It's similar to thinking in terms of percent changes but mathematically cleaner.

• Thanks for the detailed response, what is the difference between this method and the method proposed by @Greenparker? Should I be getting different results for standard deviation, error, etc? – randyvelour Jun 14 '17 at 16:53
• @randyvelour We're saying something extremely similar. My $\bar{r}$ is the exact same as his $\bar{Y}$. He advocates using the delta method to get the asymptotic distribution of $e^{\bar{Y}}$ and use that to create a confidence interval You could also just exponentiate the endpoints of your confidence interval for $\bar{r}$ and get an asymmetric confidence interval. – Matthew Gunn Jun 14 '17 at 19:05

Let's just extract the statistical problem at hand. You have $X_1, \dots X_n$ from some distribution with mean $\mu$ and variance $\sigma^2$.

Consider $Y_i = \log X_i$, where the mean of $Y$ is $\mu_y$ and variance is $\sigma^2_y$. Consider the average of $Y$s: $\bar{Y}_n = \sum_{i=1}^{n} Y_i/n$. Then due to the CLT, $$\sqrt{n} (\bar{Y}_n - \mu_y) \overset{d}{\to} N(0, \sigma^2_y)\,.$$

Now consider $e^{\bar{Y}_n}$. \begin{align*} e^{\bar{Y}_n} & = \exp\left\{\sum_{i=1}^{n}\dfrac{1}{n} \log Y_i \right\}\\ & = \exp\left\{\sum_{i=1}^{n} \log Y_i^{1/n} \right\}\\ & = \prod_{i=1}^{n}\exp\left\{ \log Y_i^{1/n}\right\}\\ & = \prod_{i=1}^{n} Y_i^{1/n}\,. \end{align*}

Thus, $e^{\bar{Y}}$ is the geometric mean! So next, we can apply the Delta method to the CLT method. Define $g(x) = e^{x}$, then $g'(x) = e^x$. By the Delta method

$$\sqrt{n}(e^{\bar{Y}_n} - e^{\mu_y}) \overset{d}{\to} N(0, e^{2\mu_y}\sigma^2_y).$$

So now you have a tool to make your confidence intervals from. $e^{\mu_y}$ is your true geometric mean, and you want to make a confidence interval for this (this is not a confidence interval for the expected value $\mu$). The first step is estimate $\sigma^2_y$. Since $\sigma^2_y$ is the variance of the $Y$s,

$$s^2_y:= \dfrac{1}{n} \sum_{i=1}^{n}(Y_i - \bar{Y}_n)^2 = \dfrac{1}{n}\sum_{i=1}^{n} (\log X_i - \log e^{\bar{Y}_n})^2 = \dfrac{1}{n} \sum_{i=1}^{n} \log \left( \dfrac{X_i}{e^{\bar{Y}_n}} \right)\,.$$

To make your $100(1 - \alpha)$% confidence interval for the true geometric mean:

$$e^{\bar{Y}_n} \pm z_{1-\alpha/2}\dfrac{e^{\bar{Y}_n} s_y}{\sqrt{n}}\,.$$

• Thank you for the detailed response, a question I have is why does the GEOMEAN function in Excel produce a different geometric mean result than exp(Ybar)? Am I doing something wrong or is a difference expected? Additionally, the GEOMEAN function seems to give (1+Growth Rate) whereas your method returns just a growth rate, do I need to do any conversions after finding the mean? Or in other words are there any points where I need to perform an operation to get back to a growth rate similar to the result of (New/Old)? – randyvelour Jun 14 '17 at 16:46