15.3 One-Sample Sign Test

Michael Sullivan

2023-08-29

There is no direct function in Base R or Mosaic to perform the signs test. This will follow Example 2 within Section 15.3. We will work through Example 1 from Section 15.3. Begin by entering the data in Table 3.

Balance <- c(6000,870,1530,1660,1060,1790,1630,3180,2180,2370,1800,2170,1210,410,1720,1270,570,1050,2320,1120)

To test the null hypothesis $H_0:M = $1770, determine the number of observations less than 1770 and the total number of observations (other than 1770).

minus <- sum(Balance<1770)
total <- sum(Balance!=1770)
minus

## [1] 12

total

## [1] 20

Now, run a binomial test with x = minus successes, n = total, and p = 0.5. The default for binom.test is a two-tailed alternative. If the hypothesis test is a right-tailed test include alternative = ‘greater’; for a left-tailed test include alternative = ‘less’.

binom.test(minus,total,p = 0.5)

##
##  Exact binomial test
##
## data:  minus and total
## number of successes = 12, number of trials = 20, p-value = 0.5034
## alternative hypothesis: true probability of success is not equal to 0.5
## 95 percent confidence interval:
##  0.3605426 0.8088099
## sample estimates:
## probability of success
##                    0.6

The P-value is 0.5034.