Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Advanced Statistics Expert

Midterm Assignment -

Q1. a. Write code that will use the inverse transform to generate a random variable X which has probability density fX(x) = 4/x2, 2 ≤ x ≤ 4 (and 0 for other values of x).

b. Write code that will generate a point (x and y coordinates) uniformly from the region 2 ≤ x ≤ 4, 0 ≤ y ≤ 4/x2.

Q2. a. Write code that will generate a sample from the distribution Uniform (2, 4).

b. Then, use accept/reject to write code which (using this uniform distribution) generates samples from fX(x) = 4/x2, 2 ≤ x ≤ 4. (To be clear: we're doing the same distribution from question 1, but this time there should be no inverse transforms.)

Q3. a. Suppose that I want to generate a random variable Y that is distributed as Binomial (2, 0.4), using the discrete inverse transform. Fill in /***BLANK 1***/ and /***BLANK 2***/ so that this code runs as quickly as possible. Pay attention to the order of the entries.

double Y;

double P_i_vals[3] = {/***BLANK 1***/};

double X[3] = {/***BLANK 2***/};

double U = MTUniform (0);

for (int i = 0; i <= 2; i++) {

if (U <= P_i_vals[i]) {

Y = X[i];

break;

}

}

b. On average, how many times will the test U <= P i vals[i] have to run to generate the value of Y?

Q4. Suppose you wish to generate a random permutation of {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}. Write pseudo-code explaining an efficient algorithm for this task.

Q5. I draw two independent samples from a normal distribution with mean known to be 0, but unknown variance (which we'll call v). The samples drawn have values 2 and 0. What is the Maximum Likelihood Estimator of v? Show work (there's a shortcut to the answer in this case, but that's not what I want).

Q6. a. Write code that simulates one path of Brownian motion from time t = 0 to t = 1. To be precise: the code should generate B0, B.01, B.02, . . . , B1, printing out each value.

b. Recall our stock price model based on Brownian motion, which we summarized with the equation St = S0eµt+σB_t. Suppose that ?t = 0.01, µ = 0.05, σ = 0.3. Write code that simulates a single price path, and then gives the payoff of a (European) call option on this stock with strike 105, which expires at time T = 1.

Note - Need code in python. Thank you.

Advanced Statistics, Statistics

  • Category:- Advanced Statistics
  • Reference No.:- M92830748
  • Price:- $60

Priced at Now at $60, Verified Solution

Have any Question?


Related Questions in Advanced Statistics

Question 1before beginning a study investigating the

QUESTION 1 Before beginning a study investigating the ability of a drug to lower cholesterol, baseline values of total serum cholesterol were measured for a sample of 30 healthy controls thought not to be at risk forcard ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As