Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

ECMT3110: Computational Assignment

!is assessment task requires you to write a MATLAB program to determine

should consist of two "les: a PDF containing typed answers to each question, and a MATLAB (.m or .mlx) "le containing the code you have used to obtain your results. You should include comments in your MATLAB code to make it easily understandable. Submit your "les through the Canvas course website.

You may work on this assessment individually, or in pairs.  If you work in pairs, it is important that you clearly indicate the student ID number of your partner in your submission.

Solving this assignment may require you to use MATLAB commands we have not seen in class. You will need to do your own research to "nd suitable com-

!e assignment is worth a total of 25 points towards your "nal assessment.

 

!estion 1

Let 퐹 and ⌧ be two univariate cumulative distribution functions.  Suppose we have an iid sample -1,. . .,-< drawn from the distribution 퐹, and another iid sample .1,. . .,.= drawn from ⌧ , with the two samples independent of one

another. We would like to test the null hypothesis that the two distributions are the same: 퐹(G) = ⌧ (G) for all real G.

KS = ⇣ ⌘ 1/2 8a. ⌧ˆ (-(8)) −   ,

where ⌧ˆ is the empirical distribution for the sample .1,. . .,.=, de"ned for real ~ by

⌧ˆ (~) =  ’  (.9  ~) .

!at is, ⌧ˆ(~) is the proportion of the sample observations .1,. . .,.= which are equal to or less than ~.  We reject the null hypothesis 퐹 = ⌧ if KS exceeds a critical value 2<,=. Your job is to "nd a critical value 2<,= yielding a Type I error

rate of 5% by Monte Carlo simulation. Go through the following steps, supplying answers to questions that are posed.

(a) In each of 10000 Monte Carlo iterations, generate iid samples -1,. . .,-< and.1,. . .,.= by drawing from the standard normal distribution, with < =

25 and = = 25. Compute KS for each pair of samples. Save the 10000 values of KS computed over the simulation.

(b) Rank your 10000 KS statistics from largest to smallest. Your simulated crit-

 

(c) Repeat parts (a) and (b) using all pairs of samples sizes < = 25, 50, 100, 200 and = = 25, 50, 100, 200. You should now have simulated 16 critical values in total. Report them in a table.

 

(d) Repeat parts (a), (b), (c) and (d), but draw-1,. . .,-< and.1,. . .,.= from the uniform distribution on (0, 1) rather than the standard normal distribution. Report a second table of 16 critical values.

 

your critical values based on the standard normal distribution? Can you explain the relationship between the two?

 

 

!estion 2

Another popular statistic for testing the null hypothesis that 퐹(G) = ⌧ (G) for all real G is the Wilcoxon-Mann-Whitney statistic, or WMW statistic. It is de"ned by

WMW = ⇣⌘ 1/2   #⌧ˆ (-(8)) −  # .

(a) Repeat the exercise in parts (a), (b) and (c) of #estion 1 using the WMW

 

 

your Monte Carlo simulations with the standard normal distribution and < = = = 25, run another Monte Carlo simulation with 10000 iterations. In each iteration, draw -1,. . .,-25 from the #(`, 1) distribution with ` = 0, and draw .1,. . .,.25 from the #(0, 1) distribution. Determine whether the null hypothesis is rejected using KS and using WMW. Calculate the rejection frequency for each test over the 10000 iterations.

(c) Repeat the exercise in part (b) using ` = 0.05, 0.1, 0.15,. . ., 3. Produce a graph of the computed rejection frequencies of the KS and WMW tests, showing the two rejection frequencies as a function of ` 2 [0, 3]. Which of the two tests performs be$er in your simulation?