The sign test is similar in purpose to the one-sample Wilcoxon signed-rank test. It is often less powerful than the signed-rank test, but has the advantage of not requiring the data to be symmetric in distribution. The test compares the number of observations greater or less than the default value without accounting for magnitude of the difference between each observation and the default value.

The test is conducted with the *SIGN.test* function in
the *BSDA* package or the *SignTest* function in the *DescTools*
package. These functions produce a *p*-value for the hypothesis, as well
as the median and confidence interval of the median for the data.

##### Appropriate data

• One-sample data

• Data are ordinal, interval, or ratio

##### Hypotheses

• Null hypothesis: The median of the data set is equal to the default value.

• Alternative hypothesis (two-sided): The median of the data set is not equal to the default value.

##### Interpretation

Reporting significant results as e.g. “Likert scores were significantly different from a default value of 3” is acceptable. As is e.g. “Median Likert scores were significantly different from a default value of 3”

### Packages used in this chapter

The packages used in this chapter include:

• BSDA

• DescTools

The following commands will install these packages if they are not already installed:

if(!require(psych)){install.packages("BSDA")}

if(!require(BSDA)){install.packages("DescTools")}

### One-sample sign test example

For appropriate plots and data frame checking, see the *One-sample
Wilcoxon Signed-rank Test* chapter.

Input =("

Speaker Rater Likert

'Maggie Simpson' 1 3

'Maggie Simpson' 2 4

'Maggie Simpson' 3 5

'Maggie Simpson' 4 4

'Maggie Simpson' 5 4

'Maggie Simpson' 6 4

'Maggie Simpson' 7 4

'Maggie Simpson' 8 3

'Maggie Simpson' 9 2

'Maggie Simpson' 10 5

")

Data = read.table(textConnection(Input),header=TRUE)

### Check the data frame

library(psych)

headTail(Data)

str(Data)

summary(Data)

### Remove unnecessary objects

rm(Input)

### Sign test with the *BSDA* package

Note that *Data$Likert* is the one-sample data, and *md=3*
indicates the default value to compare to.

library(BSDA)

SIGN.test(Data$Likert,

md = 3)

One-sample Sign-Test

s = 7, p-value = 0.07031

alternative hypothesis: true median is not equal to 3

### Note the p-value in the output above

95 percent confidence interval:

3.000000 4.675556

sample estimates:

median of x

4

### Median value and confidence interval

### Sign test with the *DescTools* package

Note that *Data$Likert* is the one-sample data, and *mu=3*
indicates the default value to compare to.

library(DescTools)

SignTest(Data$Likert,

mu = 3)

One-sample Sign-Test

S = 7, number of differences = 8, p-value = 0.07031

### Note the p-value in the output above

alternative hypothesis: true median is not equal to 3

97.9 percent confidence interval:

3 5

sample estimates:

median of the differences

4

### Median value and confidence interval