Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 3: Write a demonstration program to sample 10 values from a Bernoulli(0) distribution with 0 = 0.3. Recall that there are only two possible

image text in transcribedimage text in transcribedimage text in transcribed
Question 3: Write a demonstration program to sample 10 values from a Bernoulli(0) distribution with 0 = 0.3. Recall that 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. 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 randomly sample Bernoulli distributed values that does not make use of the built-in binomial distribution. Using a seed of 21, verify that the first four observations agree with 1, 1, 0 and 1 respectively. Your MATLAB code could use the following line for the seeding: >> seed=21; rand('state', seed); randn('state',seed); Question 4: In this exercise, we want to generate the random variable x=(x1, x2) from Beta(1, ) by inverse transform method. a) Write down the algorithm for generating x. b) Use MATLAB to construct two sets of N=1000 observations each from Beta (1,4). Set seed =131. Plot histograms of both sets on the same graph and print out the first 5 observations from each set. Observe that the first observations are x1=0.0251 and x2 = 0.0348. C) Find the mean of each set generated.Question 2. Adapt the matlab program above to illustrate the Binomial (N, 0) distribution where N = 10 and 0 = 0.7.Question 1. Adapt the Matlab program in Code 6.2 to illustrate the Beta(a, B) distribution where a = 2 and B = 3

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

Economics The Basics

Authors: Michael Mandel

2nd Edition

0073523186, 9780073523187

More Books

Students also viewed these Economics questions

Question

The relevance of the information to the interpreter

Answered: 1 week ago

Question

The background knowledge of the interpreter

Answered: 1 week ago