# Two-sample test for deviation from zero?

What would be an appropriate statistical test to test whether one sample is more significantly spread out around zero than other?

I believe that what I am looking for is a kind of f-test but instead of comparing variances (variations around the mean of each sample) I would want to compare "variances" around a fixed predefined value (in my case zero) between the two samples.

Here's a pic in an attempt to depict qualitatively how the test I seek should work:

• Why are you interested in zero? Dec 13 '16 at 15:12
• I am interest in allelic expression. And I would like to be able to test if two samples (homozygous and heterozygous) have expression values sufficiently different from zero (in log-scale, that is). So I would like to be able to detect if the spread from zero of heterozygous samples is greater than that of the homozygous samples. Dec 13 '16 at 16:03
• Can you post an example dataset to clarify your situation? Dec 13 '16 at 17:41
• @gung: Just added a pic which I hope clarifies what I am looking for. Dec 13 '16 at 18:55
• What would you guys say about using Mann–Whitney U test (en.wikipedia.org/wiki/Mann%E2%80%93Whitney_U_test) on samples A' and B', where A' and B' are absolute-value-transformed samples of A and B, respectively? Dec 13 '16 at 19:41

Perform the Mann–Whitney U test on the absolute values.

Here's some code in R that does the job:

stat.test <- function(sample_A, sample_B, difference = 0) {
sample_A_abs <- abs(sample_A)
sample_B_abs <- abs(sample_B)

wilcox.test(x = sample_B_abs, y = sample_A_abs,
alternative = "greater", mu = difference)

}