<- runif(100, -1, 1)
x <- x^2 y
10 Permutation Tests
Q10.1
Refer to Example 10.1 and Figure 10.1. Suppose that we want to test weight
for the casein
feed group and weight
for the sunflower
feed group of the chickwts
data. A test can be based on the two-sample Kolmogorov-Smirnov statistic as shown in Example 10.1. Display a histogram of the permutation replicates of the Kolmogorov-Smirnov two-sample test statistic for this test. Is the test significant at
Q10.2
Write a function to compute the two-sample Cramer-von Mises statistic. The Cramer-von Mises distance between distributions is: rank
function). Compute:
Note that
Q10.3
Implement the two-sample Cramer-von Mises test for equal distributions as a permutation test using (10.14). Apply the test to the data in Examples 10.1 and 10.2 (NOTE should it be 10.3)?
Q10.4
An statistic
argument of the boot
function) to compute the test statistic Tnr(z, ix, sizes, nn)
.
Q10.5
The iris
data is a four-dimensional distribution with measurement on three species of iris flowers. Using your function Tnr
of Exercise 10.4 and the boot
function, applyl your nearest neighbors statistic (
Q10.6
A commonly applied statistic for dependence is Pearson’s product-moment correlation
Clearly,
Show that if
and then .Apply the correlation t-test to the simulated data
usingcor.test
to test the null hypothesis vs . Is the null hypothesis rejected?Test
are independent vs. are dependent using the distance covarnace test. (Usedcov.test
in theenergy
package or follow Example 10.14.) Is the null hypothesis of independence rejected?Discuss and compare the results of both tests.
Q10.7
The Count 5 test for equal variances in Section 7.4 is based on the maximum number of extreme points. Example 7.15 shows that the Count 5 criterion is not applicable for unequal sample sizes. Implement a permutation test for equal variance based on the maximum number of extreme points that applies when samples sizes are not necessarily equal. Repeat Example 7.15 using the permutation test.