# Normal Distribution with Uniform Mean

I'm trying to understand the distribution, mean, and variance of a normal random variable, with the mean parameter having a uniform distribution. Based on my R simulations it seems that this compound distribution is close to normal, with the mean equals to the mean of the uniform distribution and variance equal to the sum of normal and uniform variances.

a <- 1
b <- 5
x <- runif(n, min=a, max=b)
std <- 3
c <- rnorm(n, mean=x, sd=std)

c(mean(c), (a+b)/2)
c(var(c), var(x) + std^2)


Is my guess correct? Can I find a proof of that? There is little information on the web on this type of compound distributions. Thanks.

• Welcome to stats.SE! Please take a moment to view our tour. Why are you trying to determine this type of mixed distribution? What is your goal? – Tavrock Feb 9 '17 at 4:04
• Hi @Tavrock! I'm interested in this distribution due to a particular problem I'm working on. I have a forecast for a random variable mean (long term return on a financial asset) and its standard deviation. It is provided by a third party and is not estimated from any historical sample. I also assume a normal distribution for this r.v. But I'm not sure that the forecast is accurate. Therefore, I assume that a range of means is equally probable, (uniform distribution). I.e. I'm trying to incorporate uncertainty about the parameters into my model. – Mikhail Feb 10 '17 at 13:03

You can compute the mean and variance of the compound distribution $X$ with the law of total expectation and law of total variance.

Mean:

$$E[X] = E \left[ E [X \mid U ] \right] = E[U] = \frac{b + a}{2}$$

Which is, as you observe, the mean of the uniform distribution.

Variance:

$$Var[X] = E[ Var[X \mid U] ] + Var[ E[X \mid U ] ] = E[3^2] + Var[U] = 9 + \frac{(b - a)^2}{12}$$

Which is, as you observe, the sum of the two variances.

The compound distribution can certainly be far from normal. Consider the case where the standard deviation of the normal distribution is very small in relation to the width of the uniform distribution.

u <- runif(10000)
n <- rnorm(10000, mean=u, sd=0.01)

hist(n, breaks=100) • Thanks, this is very helpful! I was not sure if it is normal distribution or not, but your example shows that it is not necesseraly normal. – Mikhail Feb 10 '17 at 12:39

Distribution that is related to special case of your question was described by Bhattacharjee, Pandit, and Mohan (1963). It assumes that uniform distribution is centered around the global mean $\mu$ and has $(\mu-a, \mu+a)$ bounds.

In standard form it has probability density function

$$f(z) = \frac{1}{2a} \left[\Phi\left(z+a\right) - \Phi\left(z-a\right)\right]$$

and cumulative distribution function

$$F(z) = \frac{1}{2a} \left[z\,\Phi\left(z+a\right) - z\,\Phi\left(z-a\right) + \phi\left(z+a\right) - \phi\left(z-a\right)\right]$$

where $\Phi$ is a standard normal cdf and $\phi$ is a standard normal pdf.

It emerges when $U \sim \mathcal{U}(\mu-a, \mu+a)$ and $X \sim \mathcal{N}(\mu, \sigma^2)$, then $Z = U+X$ follows the distribution described by Bhattacharjee et al.

library(extraDistr)

set.seed(123)

u <- runif(10000, -1, 1)
n <- rnorm(10000, mean=u, sd=1)

hist(n, breaks=100, freq = F)
curve(dbhatt(x, 0, 1, 1), -6, 6, add = T, col = "red") set.seed(123)

u <- runif(10000, -3, 3)
n <- rnorm(10000, mean=u, sd=1)

hist(n, breaks=100, freq = F)
curve(dbhatt(x, 0, 1, 3), -6, 6, add = T, col = "red") Bhattacharjee, G.P., Pandit, S.N.N., and Mohan, R. (1963). Dimensional chains involving rectangular and normal error-distributions. Technometrics, 5, 404-406.

• Fantastic answer, thanks a lot! I did not know about the Bhattacharjee distribution and its function in R. – Mikhail Feb 10 '17 at 12:47