Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

pdf from generated numbers cdf from input pdf input pdf 0.3 0.8 0.25 0.2 0.15 0.4 0.1 0.2 0.05 5 10 generated numbers 5 0.5

image text in transcribedimage text in transcribedimage text in transcribed
pdf from generated numbers cdf from input pdf input pdf 0.3 0.8 0.25 0.2 0.15 0.4 0.1 0.2 0.05 5 10 generated numbers 5 0.5 1.5 2 2.5 3 3.5 4 4.5 * 104 1. Simulate tossing a coin with probability of heads p using only 3 lines of code. (Hint: You should be using U = rand;) 2. Give an algorithm to simulate the value of a random variable X such that P(X = 1) = 0.35 P(X = 2) = 0.15 P(X = 3) = 0.4 P(X = 4) = 0.13. Suppose we know from previous research that in a given population, IQ coefficients are Normally distributed with a mean of 100 and a standard deviation of 15. Calculate the probability that a randomly drawn person from this population has an IQ greater than 110 but smaller than 130. You can achieve this using one line of MATLAB code. What does this look like? 4. Write a demonstration program to sample 10 values from a Bernoulli(0) distribution with 0 =0.3. Note that the Bernoulli distribution is one of the simplest discrete distributions to simulate. There are only two possible outcomes, 0 and 1. With probability 0, the outcome is 1, and with probability 1 - 0, the outcome is 0. In other words, p(X = 1) = 0, and p(X = 0) = 1 -0. This distribution can be used to simulate outcomes in a number of situations, such as head or tail outcomes from a weighted coin, correct/incorrect outcomes from true/false questions, etc. In MATLAB, you can simulate the Bernoulli distribution using the binomial distribution with N = 1. However, for the purpose of this exercise, please write the code needed to sample Bernoulli distributed values that does not make use of the built-in binomial distribution.5. It is often useful in simulations to ensure that each replication of the simulation gives the exact same result. In MATLAB, when drawing random values from distributions, the values are different every time you restart the code. There is a simple way to "seed" the random number generators to insure that they produce the same sequence. Write a MATLAB script that samples two sets of 10 random values drawn from a uniform distribution between [0,1]. Use the seeding function between the two sampling steps to demonstrate that the two sets of random values are identical. Your MATLAB code could use the following line: seed=1; rand('state', seed); randn('state',seed); Note that there are more advanced methods to seed the random number generator in MATLAB using RandStream methods. For most applications in this course, such methods are not needed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

WebAssign For Differential Equations With Boundary-Value Problems

Authors: Dennis G Zill

9th Edition

1337879762, 9781337879767

More Books

Students also viewed these Mathematics questions