Question: Problem 2. (KS statistic from pattern) The two-sample KS test statistic, as with any other rank-based test, can be computed based on the pattern that

Problem 2. (KS statistic from pattern) The two-sample KS test statistic, as with any other rank-based test, can be computed based on the pattern that the two samples make (of the form X X YX X YYX if the samples are labeled X and Y respectively). This is assuming that there are no ties. Write a function pattern.ks.stat(p) that takes in a pattern a vector of the form (x, x, y, x, x, x, y, x), or {0,0, 1,0,0,0,1,0), or if you are a bit more ambitious, any vector with coordinates taking two unspecied different values and returns the two one-sided KS statistics and the two-sided KS statistic for that pattern. Test your function by comparing the result with the ks.test flmction on some simulated data where there are no ties. [This comparison will require converting two numerical samples into a pattern]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
