0

I'm trying to generate random sample with distribution, that can get by sum of independent $\xi$=Exp(0.5) and $\eta$=Unif(-1, 1), and compare empirical cdf and theoretical cdf.

I'm using R to do that

z <- rexp(500, 0.5) + runif(500, -1, 1)

Then I want to check result and make plot of theoretical cdf, but I've stuck on convolution. I know that

$$f_{\xi+\eta}(z)=\int_{-\infty}^{+\infty} f_\xi(x)⋅f_\eta(z−x)dx$$

in my case

$$f_{\xi+\eta}(z)=\int_{-\infty}^{+\infty} 0.5*e^{-0.5x} 1\{0 \le x\} * 1/2 * 1\{-1\le z-x\le1\} dx$$

and then

$$f_{\xi+\eta}(z)=\int_{0}^{+\infty} 0.25*e^{-0.5x} * 1\{x-1\le z\le x+1\} dx$$

What should I do on the next steps?

Slava
  • 3
  • You should have isolated x in your last inequality. Then knowing that you can limit the integral on z(the bounds will depend on z and 0) and then it is just a simple integral on the exponential with variable limits when you can easily solve for. By going the route you did it makes it more convoluted and harder to understand but you could break it up in a similar way but it is far less obvious. – Gupta Oct 09 '21 at 22:14

1 Answers1

0

Hint:

The support of the distribution $G$ of an exponential distributed random variable $T$ and an $-1,1$-uniform random variable $U$, $T$ and $U$ independent, is $(-1,\infty)$. $G$ has density given by given by $$g(x)=\frac12\int_{\mathbb{R}}\lambda e^{-\lambda t}\mathbb{1}_{(0,\infty)}(t)\mathbb{1}_{(-1,1)}(x-t)\,dt=\frac{\lambda}{2}\int^\infty_0\mathbb{1}_{(x-1,x+1)}(t)e^{-\lambda t}\,dt$$

If $x\leq-1$, then $g(x)=0$.

If $-1<x\leq1$, $$g(x)=\frac{\lambda}{2}\int^{x+1}_0 e^{-\lambda t}\,dt$$

if $1<x$, then $$g(x)=\frac{\lambda}{2}\int^{x+1}_{x-1}e^{-\lambda t}\,dt$$

Mittens
  • 39,145