1
$\begingroup$

Suppose I have $X\sim Uniform[a,b]$ and $Y\sim normal(0,d^2)$, what's the expression for the density of $Z=X+Y$?

Let $F_{Z}(z)$ be the cdf of $Z$ evaluated at $z$, and let $\Phi(\cdot)$ and $\phi$ be standard normal cdf and pdf respectively. I got

$F_{Z}(z)=\frac{1}{b-a}\int_{a}^{b}\Phi(\frac{z-x}{d})dx$,

differentiate wrt to $z$ on both sides gives

$f_{Z}(z)=\frac{1}{b-a}\int_{a}^{b}\phi(\frac{z-x}{d})\frac{1}{d}dx=\frac{1}{b-a}(\Phi(\frac{z-a}{d})-\Phi(\frac{z-b}{d}))$ .

Does this look correct?Thanks!

$\endgroup$
  • $\begingroup$ What progress have you made with your homework problem? Please add this to the question in an edit, add the self-study tag when you edit, and read its wiki. $\endgroup$ – Dave Aug 16 at 21:59
  • $\begingroup$ @Dave Thanks, it's done! $\endgroup$ – T34driver Aug 16 at 22:50
  • $\begingroup$ I see two mistakes. 1) You don’t seem to be using the uniform $X$. 2) You solve this kind of problem using convolution. 3) Please add the self-study tag. $\endgroup$ – Dave Aug 16 at 23:03
  • 1
    $\begingroup$ The left side of your last displayed equation is a function of $z$ while the right side does not depend on $z$ at all. $\endgroup$ – Dilip Sarwate Aug 17 at 1:14
  • 1
    $\begingroup$ Some posts on site address the convolution of uniform and normal. $\endgroup$ – Glen_b Aug 17 at 1:42
1
$\begingroup$

Comment:

As a reality check here is a simulation for the convolution of $U \sim \mathsf{Unif}(a=2, b=7)$ and $Z \sim \mathsf{Norm}(\mu = 0, \sigma = 3).$

Thus $E(U+Z) = 4.5 + 0 = 4.5$ and $V(U+Z) = 25/12 +9 = 4.0833.$

set.seed(2020)
a = 2;  b = 7;  sg = 3
u = runif(10^6, a, b)
z = rnorm(10^6, 0, sg)
x = u + z
mean(x); mean(u);  mean(z);  mean(u) + mean(z)
[1] 4.497167        # aprx E(X) = 4.5
[1] 4.500343        # aprx E(U) = 4.5
[1] -0.003175144    # aprx E(Z) = 0
[1] 4.497167
var(x); var(u); 25/12; var(z); var(u) + var(u)
[1] 11.08561        # aprx Var(X)
[1] 2.081356        # aprx Var(U) = 25/12
[1] 2.083333        # 25/12
[1] 9.011073
[1] 4.162712

hist(x, prob=T, br=50, col="skyblue2", 
 main="Simulated Density of X")
curve(1/(b-a)*( pnorm((x-a)/sg) - pnorm((x-b)/sg) ),
  add=T, col="red", lwd=2)

enter image description here

Note: Figure revised after edit and comment from OP.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks! This is very helpful. I guess you entered the wrong formula for the red curve. It should be dnorm((x-a)/sg) - dnorm((x-b)/sg). $\endgroup$ – T34driver Aug 17 at 4:45
  • $\begingroup$ See this post, when a=0,b=1, sg=1, my formula agrees with the answer given there. stats.stackexchange.com/questions/365601/… $\endgroup$ – T34driver Aug 17 at 4:49
  • 1
    $\begingroup$ Thanks! My first comment was incorrect (I'm not familiar with r and thought your dnorm means distribution function), you need to use: pnorm((x-a)/sg) - pnorm((x-b)/sg). That is, first swap your a and b, a first b second, and then change your density function to distribution function. Then I guess it should work. $\endgroup$ – T34driver Aug 17 at 5:19
  • 1
    $\begingroup$ Deleted my previous comment to avoid confusion. Also, edited my Answer to use corrected PDF, which looks fine. Glad this is resolved. $\endgroup$ – BruceET Aug 17 at 5:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.