The Sign Test using R

I wrote an article in the October 2016 issue of Visual Studio Magazine titled “Results Are in – the Sign Test using R”. See


The Sign Test is used to analyze “before-and-after” data to determine if there’s been an effect or not. The idea is best explained by example. Suppose you’re working at a pharmaceutical company and want to know if a new weight-loss drug is effective. You get 10 volunteers to use your drug for several weeks. You look at the weights of your 10 subjects before and after the experiment. Suppose 8 out of 10 of the subjects lost weight but 2 subjects gained weight. Do you have solid statistical evidence to suggest that your weight loss drug worked?

Interestingly (well, to me anyway), the R language doesn’t have a dedicated sign.test() function as you’d expect. Instead, the Sign Test is a specific type of the more general binom.test() function.

As with all statistical tests, the results are purely probabilistic and should be interpreted cautiously. It’s much better to say, “The results of the Sign Test suggest that the weight-loss drug likely does have a positive effect” rather than, “The Sign Test shows the weight-loss drug works.”

This entry was posted in R Language. Bookmark the permalink.