Write code that will use the inverse transform

Assignment Help Advanced Statistics
Reference no: EM131993097 , Length:

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.

Reference no: EM131993097

Questions Cloud

Write a paper about the strategic planning guarantees : Strategic planning guarantees that an organization stays important and receptive to the requirements of its locale and adds to organizational dependability.
Describe the change in southwest airlines boarding process : Describe the change in Southwest Airlines boarding process. What was Southwest's main goal introducing the early-bird check-in?
What is the stock required rate of return : Encino Burger incorporated has preferred stock outstanding that pays dividend of $1 at the end of each year. What is the stock's required rate of return?
Write an opinion in response to a current newspaper article : Write an opinion in response to a current newspaper article or op/ed piece. Rule of thumb: Do not use dot.org websites (one exception is PBS).
Write code that will use the inverse transform : MTH 4135 Midterm Assignment. Write code that will use the inverse transform to generate a random variable X which has probability density
Review the main principles of effective listening : Generate two (2) advantages and two (2) disadvantages of group decision making within the context of deciding how to spend revenue obtained from a new sales tax
Representation of evil and our actions : I believe free will do exist and is a representation of evil and our actions is our responsibility.
Are there too many it services contractors : At the same time, the federal government is cutting costs, which means that there are fewer contracts for the contractors, so they are laying off staff.
Statements related to risk and return is false : Which of the following statements related to risk and return is FALSE?

Reviews

Write a Review

Advanced Statistics Questions & Answers

  Relationship between speed, flow and geometry

Write a project proposal on relationship between speed, flow and geometry on single carriageway roads.

  Logistic regression model

Compute the log-odds ratio for each group in Logistic regression model.

  Logistic regression

Foundations of Logistic Regression

  Probability and statistics

The tubes produced by a machine are defective. If six tubes are inspected at random , determine the probability that.

  Solve the linear model

o This is a linear model. If your model needs a different engine, then you need to rethink your approach to the model. Remember, there are no IF, Max, or MIN statements in linear models.

  Plan the analysis

Plan the analysis

  Quantitative analysis

State the hypotheses that you are going to test.

  Modelise as a markov chain

modelise as a markov chain

  Correlation and regression

What are the degrees of freedom for regression

  Construct a frequency distribution for payment method

Construct a frequency distribution for Payment method

  Perform simple linear regression

Perform simple linear regression

  Quality control analysis

Determining the root causes

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