MATLAB代写-ECMT3110
时间:2022-05-10
ECMT3110: Computational Assignment
Due: May 13, 10:59am
is assessment task requires you to write a MATLAB program to determine
critical values for two statistical tests of stochastic dominance. Your submission
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 assignmentmay require you to useMATLAB commandswe have
not seen in class. You will need to do your own research to nd suitable com-
mands in the online MATLAB documentation or in relevant web fora.
e assignment is worth a total of 25 points towards your nal assessment.
1

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 .
One popular statistic for testing this hypothesis is the Kolmogorov-Smirnov
statistic, or KS statistic. To calculate the KS statistic, we rst order the obser-
vations -1, . . . ,-< from smallest to largest. Denote the ordered observations by
-(1)  -(2)  · · ·  -(<) . Next, we calculate
KS =
⇣ <=
< + =
⌘1/2
max
8=1,...,<
⌧ˆ (-(8)) 8< ,
where ⌧ˆ is the empirical distribution for the sample .1, . . . ,.= , dened for real ~
by
⌧ˆ (~) = 1
=
=’
9=1
(.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-
ical value is the 500th largest KS statistic. Record this critical value.
(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.
2
(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.
(e) How do your critical values based on the uniform distribution compare to
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 theWilcoxon-Mann-Whitney statistic, or WMW statistic. It is dened
by
WMW =
⇣ <=
< + =
⌘1/2 1
<
<’
8=1
⌧ˆ (-(8)) 8< .
(a) Repeat the exercise in parts (a), (b) and (c) ofestion 1 using the WMW
statistic in place of the KS statistic.
(b) Using the critical values for the KS and WMW statistics computed from
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 beer in your simulation?
3

essay、essay代写