Generate plots for a couple of arbitrary ranges

Assignment Help Applied Statistics
Reference no: EM131415073

Lab Description

You will generate random sequences responding to several probability mass functions studied in class

Perform the following tasks:
1. Implement a function, my_rnd_generator, that returns a sequence of N random numbers. The function should accept the following arguments:
N: an integer specifying how long the sequence of random numbers will be.
v: a vector that corresponds to the sample space of the random variable.
p: a vector that corresponds to the probabilities for each element in v.

For example, to generate a vector, r, that corresponds to 10,000 outcomes of tossing a fair die, you should call the function as follows
N = 10000;
v = [1 2 3 4 5 6];
p = ones(1,6)/6;
r = my_rnd_generator(N,v,p);

To generate the biased die toss from lab 3, the function should be called as follows:
N = 10000;
v = [1 2 3 4 5 6];
p = [.1 .1 .1 .1 .1 .5];
r = my_rnd_generator(N,v,p);

Note that your function should adjust automatically for pmfs of various lengths (i.e. not only length 6) and shapes (i.e. not only uniform).

Hint: There are many ways to do this, including existing Matlab functions. You can use anything you want. One way to go about it is using the code below (by Kurt Hornik, used in Octave, a free software very similar to Matlab):
u = rand (1, n);
m = length (p);
s = reshape (cumsum (p / sum (p)), m, 1);
rnd = v (1 + sum ((s * ones (1, n)) <= ((ones (m, 1) * u))));
You may use any part of this code, or a variation of it, but of course I expect a detailed explanation of how it works.

2. For a random variable uniform in the range [a, b], generate a random sequence, r, of at least 100,000. Calculate the following:
a. Theoretical mean, μ.
b. Theoretical variance, σ2.
c. Sample mean, μs, i.e. average of all samples in r. Verify your result using Matlab'smean() function.

d. Sample variance, σ2s, i.e. average of all squared samples in r, minus the square of the sample mean. Verify your result using Matlab'svar()function.

e. In a figure partitioned in a 3×1 grid, plot the following:

i. The first 100 samples in r.Note that plotting all of the samples would not generate a very interesting figure.

ii. The theoreticalpmf, also showing μ and σ2.

iii. The histogram of r, also showing μs and σ2s. Note that the histogram should be very similar to the pmf (since you used at least 100,000 samples.

An example for U(-12,4), i.e. uniform discrete random variable for the inclusive interval [-12, 4], is shown in Figure 1. Please make sure that you display your results exactly as shown in Figure 1. To generate a title for the whole figure, you may use the function suplabel.m. This function is attached in Appendix A. For the example, I used the following code to invoke suplabel:

tt = ['N = ', num2str(N),', Uniform RV, U(',num2str(a),...
',',num2str(b),')'];
suplabel(tt,'t');

f. Generate plots for a couple of arbitrary ranges, including the [12, 4] Iused in the example.

1561_Figure.jpg

Figure 1. Example for part 2.

Note: You can embed greek letters in Matlabtitles and labels by typing a backward slash followed by the greek letter. For example, \Sigma for Σ and \sigma for σ. Use _ and ^ for subscripts and superscripts, respectively. For example \sigma_X^2 generates σX2

3. Repeat step 2 for the binomial distribution. Generate plots for:

a. n=24 and p = 0.2, 0.5 and 0.9, respectively.

b. Two more values for n with a at least a couple of different p values.

4. Repeat step 2 for the geometric distribution. Note that the sample space of the geometric random variable extends to infinity. Please cut of your plots at, say, n=50. If you sum over all 50probabilities in your pmf, you will not get 1, as you are ignoring the low probability samples for k>50. It will be interesting to observe how the plot varies for different ps. Generate plots for p = .1, .2, .5 and .7. What happens if you let p = 0.01 while maintaining n=50?

5. Repeat step 2 for the Poisson distribution. Once again, cut off your plots at n=50. Generate plots for α = 0.5, 3, 9, 24, and 40.

Attachment:- Appendix.rar

Verified Expert

The work is about random number generator using MATLAB. This work has been divided in five parts. In part 1 based on random number generation using probability and sample space. In part 2 based on random number generation which includes calculation for mean, In part 3 based on random number generation which includes calculation for mean, variance, pmf calculations.In part 4 based on random number generation which includes calculation for mean, variance, pmf calculations, plots for the various parts calculated based on geometric random number generation. In part 5 based on random number generation which includes calculation for mean, variance, pmf calculations, plots for the various parts calculated based on Poisson random number generation.

Reference no: EM131415073

Questions Cloud

Enhance the number of millennial leaders : Examine the best practices that your team can cultivate to enhance the number of millennial leaders. Explain how you would present this information to senior managers in your organization.
Acquisition of information-processing technology : What trade-offs are involved in (a) sharing information with other organizations in a supply chain and (b) the acquisition of information-processing technology? Who needs to be involved in decisions as they pertain to technology acquisition for suppl..
Use the three-sphere model for systems management : Think of a recent change that occurred at your college, in your community, or in the news. Use the three-sphere model for systems management and brainstorm issues related to the change based on the business, technology, and organization spheres.
Write on a topic that makes the naval profession stronger : Write on a topic that makes the naval profession stronger. Identify opportunities to better use enlisted professionals' talents. Share leadership best practices. Improve tactical doctrine.
Generate plots for a couple of arbitrary ranges : ENGR383 - APPLIED STOCHASTIC PROCESSES - Generate random sequences responding to several probability mass functions studied in class - Implement a function, my_rnd_generator, that returns a sequence of N random numbers.
Discuss the powers of bureaucracies : Discuss the powers of bureaucracies. What are their sources of power and influence? How is their influence legitimated? How can they be restricted or reined in if they exceed their authority? How are they utimately held accountable?
Entry strategy and strategic alliances : For much of its 144-year history, Diebold Inc. did not worry much about international business. As a premier name in bank vaults and then automated teller machines (ATMs), the Ohio-based company found that it had its hands full focusing on U.S. finan..
Can all non-state actor threats be addressed unilaterally : Can all non-state actor threats be addressed unilaterally as a non-traditional threat to only one country? Do some of these non-traditional threats span borders and require international cooperation to counter the threat?
Describe the behaviors linked with this style : Explain the opportunistic style and how it is derived from the managerial grid by answering the following: Describe the behaviors linked with this style. Provide at least 3 examples of well-known leaders who use the style.

Reviews

inf1415073

3/17/2017 5:07:21 AM

Cheerful to prescribe you to my companions. I like the way that the rights to the work return to me once the undertaking is finished. Likewise, the entire procedure appeared to be composed such a great amount of superior to my past experience.

len1415073

3/6/2017 1:05:56 AM

This is a long lab, so I don’t want you to print anything.Via email, I expect your lab report in PDF format, and your code (i.e. a “.m” file with instructions to use it). Finally, you need to demonstrate your working code (at least a couple of plots for each RV) to the instructor to get credit for the lab. Signature page must be turned in with your report.

len1415073

3/6/2017 1:05:43 AM

You should turn in, via email, at least the following 4 items in a single, cohesive PDF document: 1. Explanation of the code you used to generate the random data. 2. All plots requested, with the corresponding very well documented Matlab code you used to obtain it. Of course I only need one sample matlab code for each of the distributions. For example, if you did ranges [-12, 4], [4,10], and [2,12] for the uniform distribution, I only need to see matlab code for one of the three. 3. Analysis/discussion of your code/results. Note that I do expect at least a brief explanation of what is a discrete random variable, what is a pmf, how/why the histogram relates to it, etc. Additionally, turn in via email to the instructor: 1. All Matlab code, with instructions on how to run it. The subject should be: “EENG 388 – Lab number – Your first and last name.”

len1415073

3/6/2017 1:05:09 AM

Please read the instructions carefully, the code should be written in Matlab. I need two files, lab report with figures and matlab file ".m File" You may use any part of this code, or a variation of it, but of course I expect a detailed explanation of how it works.

Write a Review

Applied Statistics Questions & Answers

  What is the probability the service technician will have

A service call has just come in, but the type of malfunction is unknown. It is 3.00 P.M. and service technicians usually get off at 5:00 P.M. What is the probability the service technician will have to work overtime to fix the machine?

  What is a discrete probability distribution

What is a discrete probability distribution? Explain in your own words. What conditions must be satisfied by the probabilities in a discrete probability distribution? Explain what these conditions mean.

  Find the probability

Find the probability

  What is the probability that a transaction can be completed

Transactions to a computer database are either new items or changes to previous item. The addition of an item can be completed. if 30% of the transactionss are changes what is the probability that a transaction can be completed in less that 100 milli..

  Calculate the correlation between the father and mother

Calculate the correlation between the father's and the mother's years of education. Is there any sign of multicollinearity? Explain.

  What is the factorial notation

1. Complete each of the ANOVA summary tables. In Addition, answer the following questions for each of the ANOVA summary tables:a. What is the factorial notation?

  Find the probability that the company will meet its goal

Find the probability that the company will meet its goal on a particular 100 miles of line. Find the probability that the company will not meet its goal on a particular 100 miles of line.

  The average number of days absent per term

A random sample of [n=64 children] of working mothers showed that they were absent from school a sample average of [x=5.3] days per term, with a standard deviation [s=1.8 days].  Provide a 96% confidence interval for the average number of days absent..

  Find the minimum percentage of all possible daily demand

Find the expected demand. Interpret this value, and label it on the graph of part a. Using Chebyshev's Theorem, find the minimum percentage of all possible daily demand values that will fall in the interval [mx ± 2sx].

  Consider the experiment

Consider the experiment, called the birthday problem , where our task is to determine the probability that in a group of people of a certain size there are a least two people who have the same birthday (the same month and day of month). Suppose there..

  Let x denote the mean of a random sample of size 128

Let X denote the mean of a random sample of size 128

  A uniform back-and-forth movement

Suppose a gun sprays paint in a uniform back-and-forth movement, covering an angular sweep between forty five degrees to either side, onto a screen 100cm away. Assume that the distribution of paint at a distance ±x to either side of the centre of the..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd