Question
info here is given to help solve #3 below this photo:
You may use any computer software of your choice to complete this assignment Random variables from the four probability distr

Prob.3 (Laplace Distribution) Consider a two-sided exponential (Laplace) random variable with probability density function gi

Prob. 3 (Gaussian Distribution) Consider a standard Gaussian random variable with probability density function given by x2 2J

You may use any computer software of your choice to complete this assignment Random variables from the four probability distributions given may be generated as follows 1. A standard uniform random variable, U in the interval (0,1), i.e., U ~ U (0,1), may be generated using the Matlab function 'rand'. The corresponding uniform random variable, X in the interval (-1,1) may be obtained as X 2U 1 2. A random variable Xwith a triangular distribution in the interval (-1,1) may be obtained as the difference between two independent standard uniform random variables, i.e., X (U - U2), where U1~U(0,1) and U2 U(0,1) are independent standard uniform random variables. 3. A standard Laplacian random variable may be generated as X In(U1/U2), where UU(0,1) and U2 U(0,1) are independent standard uniform random variables 4. A standard Gaussian random variable Z may be generated by using the Matlab function 'randn'. For each of the four continuous distributions given below, do the following: (a) Generate a large number (at least 5000) random variables with the given distribution and plot a histogram of the samples (properly normalized)- you may use the Matlab function hist (b) Superimpose a plot of the pdf on your histogram (c) Compute the probability that the random variable falls in the intervals shown on the table and verify your result by simulation Note that the probability that a random variable falls in a specified interval, i.e., the probability P(IX s a) = P(-asXs a), may be estimated by generating a very large number of the random variable X and estimating the fraction of them that lie in the interval a, a)
Prob.3 (Laplace Distribution) Consider a two-sided exponential (Laplace) random variable with probability density function given by fx(x) =exp-xl), -o
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Solution :

Given the distribution :

fx(x)exp(-x), -co<x<oo fx(x) -3 -2 -4 1 4 2 0 3

we compute all the probabilities theoretically as shown below :

=========================================================================

Note we will use the integral :

P(-a X a) fx (x)dx 2 0.5edr 2 0 1 - 1 _ - ea -a

=========================================================================

c0.5 e0.5 P(-0.5 X0.5) 0.5e d 0.393469340287 fx(x)da 2 -0,5

P(-1 X 1) 0.5ed 0.632120558829 fx()dr T 2

c1.5 c1.5 P -1.5 X1.5) 0.5e d 0.776869839852 fx(x)dx -1.5

P(-2 X<2) fx(x)da 0.5edr 0.864664716763 2

2.5 2.5 P (-2.5 X2.5) 0.5e d0.917915001376 fx(x)dx 2,5

3 / P(-3 X 3) fx(x)da -3 0.5e dr 0.950212931632 2

3.5 3.5 P (-3.5 X 3.5) 0.5ed 0.969802616578 fx(x)da -3.5

P-4 X 4) fx(x)da 0.5ed 0.981684361111 2

==================================================================================

simulation based computations :

%*********************

clear all;
clc;
close all;


len = 5000;
X1 = rand(1,len);
X2 = rand(1,len);
X = log(X1./X2);

hist(X,100);


p1 = sum( X>=(-0.5) & X<=(0.5))/len
p2 = sum( X>=(-1) & X<=(1))/len
p3 = sum( X>=(-1.5) & X<=(1.5))/len
p4 = sum( X>=(-2) & X<=(2))/len
p5 = sum( X>=(-2.5) & X<=(2.5))/len
p6 = sum( X>=(-3) & X<=(3))/len
p7 = sum( X>=(-3.5) & X<=(3.5))/len
p8 = sum( X>=(-4) & X<=(4))/len

%*******************

this gives output :

500 400 300 200 100 10 0 10

p1 = 0.38640
p2 = 0.62520
p3 = 0.77720
p4 = 0.86720
p5 = 0.91680
p6 = 0.95060
p7 = 0.97040
p8 = 0.98180

so we have :

Probability Exact Calculation Simulation 0.3935 P(-0.5X0.5) 0.38640 0.62520 PC-1SX1) 0.6321 P(-1.5X1.5) 0.77720 0.7769 0.8647

==================================================================

similarly for gaussian distribution :

1 exp fx(x) 2 fx(x) V2n x -4-3 -2 -1 0 1 2 3 4

we compute all the probabilities theoretically as shown below :

0.5 c0.5 2/2 dr 0.3829 fx(x)da P(-0.5 X0.5) E -0,5

\small P\left ( -1\le X \le 1\right ) = \int_{-1}^{1}f_{X}(x)dx = 2\int_{0}^{1} \frac{1}{\sqrt2\pi}e^{-x^{2}/2}dx = 0.6827

\small P\left ( -1.5\le X \le 1.5\right ) = \int_{-1.5}^{1.5}f_{X}(x)dx = 2\int_{0}^{1.5} \frac{1}{\sqrt2\pi}e^{-x^{2}/2}dx =0.8664

\small P\left ( -2\le X \le 2\right ) = \int_{-2}^{2}f_{X}(x)dx = 2\int_{0}^{2} \frac{1}{\sqrt2\pi}e^{-x^{2}/2}dx = 0.9545

\small P\left ( -2.5\le X \le 2.5 \right ) = \int_{-2.5}^{2.5}f_{X}(x)dx = 2\int_{0}^{2.5} \frac{1}{\sqrt2\pi}e^{-x^{2}/2}dx = 0.9876

\small P\left ( -3\le X \le 3\right ) = \int_{-3}^{3}f_{X}(x)dx = 2\int_{0}^{3} \frac{1}{\sqrt2\pi}e^{-x^{2}/2}dx =0.9973

3.5 3.5 2 dr 0.9995 fx(a)da P (-3.5 X 3.5) E 2T -3.5

\small P\left ( -4\le X \le 4\right ) = \int_{-4}^{4}f_{X}(x)dx = 2\int_{0}^{4}\frac{1}{\sqrt2\pi}e^{-x^{2}/2}dx =0.9999

=========================

Matlab based simulation :

clear all;
clc;
close all;


len = 5000;
X = randn(1,len);

hist(X,100);


p1 = sum( X>=(-0.5) & X<=(0.5))/len
p2 = sum( X>=(-1) & X<=(1))/len
p3 = sum( X>=(-1.5) & X<=(1.5))/len
p4 = sum( X>=(-2) & X<=(2))/len
p5 = sum( X>=(-2.5) & X<=(2.5))/len
p6 = sum( X>=(-3) & X<=(3))/len
p7 = sum( X>=(-3.5) & X<=(3.5))/len
p8 = sum( X>=(-4) & X<=(4))/len

%**************

20 150 100 50

p1 = 0.39180
p2 = 0.68400
p3 = 0.87000
p4 = 0.95380
p5 = 0.98820
p6 = 0.99760
p7 = 0.99980
p8 = 1

So we have :

Probability Exact Calculation Simulation 0.3829 P-0.5 0.5) 0.39180 P(-1SXS1) 0.6827 0.68400 P(-1.5 XS1.5) 0.8664 0.9545 0.870

Add a comment
Know the answer?
Add Answer to:
info here is given to help solve #3 below this photo: You may use any computer...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT