[R] Make sign test show test statistics

(Ted Harding) ted.harding at nessie.mcc.ac.uk
Mon May 14 12:57:22 CEST 2007

On 14-May-07 10:07:53, Johan A. Stenberg wrote:
> When I perform a two-tailed sign test with the following simple syntax,
> binom.test(59,100)
> R returns a P-value (0.088) but nothing else. As I want the result for
> a 
> one-tailed test I take P/2 = 0.044).

1: If you want a 1-sided P-value, use the appropriate option
to binom.test(). For example (assuming your Null Hypothesis
is that p = 0.5, which is the default, and your Alternative
Hypothesis is that p > 0.5):

  binom.test(x=59, n=100,alternative="greater")

        Exact binomial test

  data:  59 and 100 
  number of successes = 59, number of trials = 100, p-value = 0.04431
  alternative hypothesis: true probability of success is greater
    than 0.5 
  95 percent confidence interval:
    0.5028918 1.0000000 
  sample estimates:
  probability of success 

(which confirms that your "divide by two" strategy was about right
in this case, though that will not always be true; and certainly
will not be appropriate for the opposite Alternative Hypothesis
that p < 0.5).

> However, the journal to which I've
> submitted my results requests the test statistics, not just the 
> P-values. How can I make R return the test statistics?

2: Have a word (et borgerlig ord, as the Danes say -- sorry
I do not have the same familiarity with Swedish, but maybe you
say the same) with the journal editor.

The plain and simple fact is that the data (x = 59 out of n = 100)
constitue the test statistic. In the conditional context that
n=100, the test statistic is simply x = 59.

However, one should strictly speaking always include a statement
about n, no matter how one expresses the test statistic. For instance,
you might use t = x/n as test statistic (with expectation p=0.5
and SD sqrt( p*(1-p)/n ) in your case). While its expecation now
depends only on the NH (p = 0.5), it cannot be evaluated as a test
without knowldge of n since that is needed to get the SD.

So R (see above) has indeed returned the "test statistic", and
the journal is not being reasonable!

Hoping this helps,

E-Mail: (Ted Harding) <ted.harding at nessie.mcc.ac.uk>
Fax-to-email: +44 (0)870 094 0861
Date: 14-May-07                                       Time: 11:57:19
------------------------------ XFMail ------------------------------

More information about the R-help mailing list