University of Minnesota, Twin Cities     School of Statistics     Stat 5601     Rweb

Stat 5601 (Geyer) Examples (Sign Test and Related Procedures)

Contents

General Instructions

To do each example, just click the "Submit" button. You do not have to type in any R instructions or specify a dataset. That's already done for you.

The Sign Test

Example 3.5 in Hollander and Wolfe.

External Data Entry

Enter a dataset URL :

Summary

Comments

The Associated Point Estimate (Median)

Example 3.6 in Hollander and Wolfe.

External Data Entry

Enter a dataset URL :

Summary

The Associated Confidence Interval

Example 3.6 in Hollander and Wolfe.

External Data Entry

Enter a dataset URL :

Summary

Comments

The R Function sign.test

All of the above can be done in one shot with the R function sign.test (on-line help).

External Data Entry

Enter a dataset URL :

The Zero Fudge

Many authorities recommend (at least lukewarmly) the following procedure for dealing with zero differences (differences equal to the hypothesized value μ if not zero) in the sign test. After defining the vector z of differences, do

z <- z[z != mu]
n <- length(z)
which treates zero differences as if they were not part of the data (and the sample size is reduced accordingly).

The best that can be said for this is

But

The alternative to the zero fudge, what Hollander and Wolfe call the conservative approach is to count the zero differences as evidence in favor of the null hypothesis. This is a bit tricky, since no matter how you do it, the recipe for the test must be altered. In my opinion, the easiest way is to change the definition of the test statistic for the upper-tailed test.

For the lower tailed test, assuming the vector of differences z, the sample size n, and the hypothesisized value of the median mu have already been defined,

b <- sum(z >= mu)
pbinom(b, n, 1 / 2)
calculates the P-value for the lower-tailed test. Note that we need the weak inequality (>=) to include the zero differences in the tail area calculated by the following statement.

Reversing the inquality gives the conservative upper-tailed test.

blow <- sum(z <= mu)
pbinom(blow, n, 1 / 2)
Note that this isn't the test statistic described in the book, but obviously does the right thing by symmetry.

The sign.test function described in the preceding section has an optional argument that controls whether it does the zero fudge (zero.fudge=TRUE or the conservative procedure (zero.fudge=FALSE). Perhaps inadvisedly, zero.fudge=TRUE is the default.