This project requires writing computer code to generate random variables of vari
ID: 3826780 • Letter: T
Question
This project requires writing computer code to generate random variables of various kinds and measure their probability distributions. Generate a sequence of each of the following types of random variables; each sequence should be at least 10,000 points long. (a) A binomial random variable. Let the number of Bernoulli trials be n = 12. Recall that the binomial random variable is defined as the number of 1s in n trials for a Bernoulli (binary) random variable. Let the parameter p in the Bernoulli trials be p = 0.5109. (b) A Poisson random variable as a limiting case of the binomial random variable with p = 0.0125 or less and n = 80 or more while maintaining a = np = 1. (c) A type 1 geometric random variable with parameter p = 0.09. (d) A (continuous) uniform random variable in the range [-2, 5]. (e) A Gaussian random variable with mean mu = 1.3172 and variance sigma^2 = 1.9236. (f) An exponential random variable with parameter lambda = 1.37. 2. Estimate the CDF and PDF or PMF as appropriate and plot these functions next to their theoretical counterparts. Compare and comment on the results obtained. To generate uniform and Gaussian random variables in Step 1(d) and 1(e), use the MATLAB functions "rand" and "randn" respectively with an appropriate transformation. To generate an exponential random variable, you may use the function "expon" from the software package for this book. This function uses the "transformation" method to generate the random variable. In Step 2 you may use the functions "pmfcdf" and "pdfcdf" from the software package.Explanation / Answer
(a)
n = 12
p = 0.5109
r = binornd(n,p,[1 10000])
(c)
rng default % For reproducibility
p = 0.09;
r1 = geornd(p, 1, 10000)
(d) r = -2 + (5+2)*rand(10000,1) % r = -a + (b-a) rand (10000 * 1 column vector)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.