Starting from:

$35

MA 573 Computational Methods of Mathematical Finance Assignment Solved



1.   Use a number generator to produce samples of

a)    10

b)   100

c)    1000

d)   10000

standard uniformly distributed random variables. For every sample size, produce a plot that shows the empirical cumulatice distrbution function Fˆ in comparison with the actual cumulative distibution function F.

2.   Use a number generator to produce samples of

a)    10

b)   100

c)    1000

d)   10000

standard uniformly distributed random variables. For every sample size, produce a histogram that shows the relative frequency of values taken, rounding to one decimal place (i.e., you count the relative frequency of realizations in bins of size 0.1).

2

3.   A good way to check if a sequence of random variables is close to being indeed random is to make a correlation plot: Plot the sequence of pairs (xn,xn+1) generated by the random number generator inside the unit square. As less structure is visible in the plot, as better the random number generator is. Make correlation plots for a sequence of pseudorandom variables for

a)    The built-in uniform random number generator with seed ˜x0 = 375;

b)   A linear congruence random number generator with m = 11, a = 6 and c = 0 (and seed ˜x0 = 1);

c)    A linear congruence random number generator with m = 231 − 1, a = 16807 and c = 0 (and seed ˜x0 = 1);

d)   A linear congruence random number generator with m = 231 − 1, a = 950706376 and c = 0 (and seed ˜x0 = 1).

4.   The generation of random number generators before the Mersenne Twister improved upon the basic linear congruence generator by coming different random number generators. E.g., The Wichmann-Hill generator implemented in Python before version

2.3 sums up over different LCRNGs and takes the fractional part of the sum.

Specifically, assuming that there are K random number generators, working for k ∈{1,...,K} by

x0,k = x˜0,k

          one calculates                               

(where bxc denotes the largest integer smaller or equal than x).

Consider the specific case of two LCRNGs with ˜x0,1 = 3,a1 = 5,m1 = 7 and x˜0,2 = 1,a2 = 7,m2 = 5.

a)    Calculate the period length of the two LCRNGs as well as the combined Wichmann-Hill generator.

b)   Make plots for the serial correlation of all three generators (as in problem 3).

Note: All programming problems should be either in Python 2.7 (recommended) or Python 3.5, matlab, or R (no support for these languages provided). Please comment the programs extensively and send them in a .zip file with title Lastname HW1.zip and suject line ”MA 573 HW1 Lastname” to Qingyun Ren qren@wpi.edu before the due date of the homework (replacing the bold words by your actual last name). Plots can be provided either as printout or as .pdf file.

6 points per problems

More products