Hypothesis testing for a correlation that is zero or negative

I would like to test for a correlation that is zero or negative using the following hypothesis test:
$H_0: p>0$ (Null hypothesis: the correlation is positive)
$H_A: p\le0$ (Alternative hypothesis: the correlation is zero or negative)

Since this is different from the usual correlation statistical hypothesis tests, $(H_0:p=0, H_A:p\ne0)$, I am having difficulty in figuring out the formulas.

How would I perform the calculations for this hypothesis test? (Of course the calculations for $r,\ r^2,\ SS_x,\ SS_y,\ n,$ etc. are all known.) Thank you in advance for your time!

• The difficulty is having the equality in the alternative. How is one to find the distribution of the test statistic under the null? (Can you explain more about the underlying situation?) – Glen_b Feb 10 '14 at 21:26
• Would it be possible to inverse it and calculate and report the p-value for the TypeII error? H0: p<=0 (Null hypothesis: the correlation is zero or negative) HA: p>0 (Alternative hypothesis: the correlation is positive) – user39947 Feb 10 '14 at 21:34
• The situation is to demonstrate that a certain action (treatment) is not providing any benefit (not a positive correlation). For the moment we don't care to distiguish if is has no effect or a negative effect. – user39947 Feb 10 '14 at 21:39
• I don't understand what you mean by the phrase "report the p-value for the TypeII error". The usual approach to the problem you have would be to test against the alternative that it does have a positive effect; failure to reject doesn't prove 'no positive effect', but it does in does show an absence of evidence for it. – Glen_b Feb 10 '14 at 21:56
• It might be better to simply look at a confidence interval for the effect (even two-sided), and to discuss the conclusions in the light of that interval. You may get less tangled up in the hypothesis-testing logic. An alternative would be to be to begin reviewing the way hypothesis tests actually work (I don't mean the hand-wavy explanations, I mean the mathematics). – Glen_b Feb 10 '14 at 22:13

Strange that no direct answer to the original question has been given (even though @Nick Stauner and @Glen_b nicely elaborated on possibly superior alternatives). The wikipedia article discusses various methods, including the following, which is probably the most direct answer.

A one-sided hypothesis test on a correlation can be performed via t as a test statistic. Here,

t $= r\sqrt\frac{{n-2}}{1-r^2}$

with the critical value found via $t_{\alpha,n-2}$ (in the more common two-sided case, only $\alpha$ is changed). So for your $H_0$ that r is smaller than 0, the test rejects if the t resulting from plugging your n and r into the above formula is smaller than the critical value determined by your n and desired $\alpha$.
(Admittedly, even this does not precisely answer the question in the sense that a correlation of exactly 0 is filed on the wrong side.)

Alternatively, a permutation test can be performed (see the wiki article).

You might achieve what you're really after (if it's not exactly what you've asked, which is interesting in its own right; +1 and welcome to CV!) rather simply by fitting a confidence interval (CI) around the correlation (I see @Glen_b suggested this in a comment too). If your correlation is significantly negative, a 95% CI would exclude positive values (and zero) with 95% confidence, which is usually enough for many statistical applications (e.g., in the social sciences, from whence I come brandishing a PhD). See also: When are confidence intervals useful?

I don't know if it's legit to just keep increasing (or decreasing) your confidence levels until your upper bound exceeds zero, but I'm curious enough myself that I'll offer this idea, risk a little rep, and eagerly await any critical comments the community might have for us. I.e., I don't see why you couldn't just take the confidence level at which your correlation estimate's CI touches zero as your estimate of $1-p$ for a test of whether your estimate is on the proper side of zero, but also below the other, more extreme bound...which means I still haven't answered your question exactly. Still, even if your estimate is above zero, you could calculate the level of confidence with which you can say future samples from the same distribution would exhibit correlations that are also above zero and below the upper bound of your CI...

This idea is due in part to my general preference for CIs over significance tests, which itself is due partly to a recent book (Cumming, 2012) I haven't actually read, to be honest—I've heard some pretty credible praise from those who have though—enough to recommend it myself, whether that's wise or otherwise. Speaking of "credible", if you like the CI idea, you might also consider calculating credible intervals—the Bayesian approach to estimating the probability given the fixed data of a random population parameter value being within the interval, as opposed to the CI's probability of the random data given a fixed population parameter...but I'm no Bayesian (yet), so I can't speak to that, or even be certain that I've described the credible interval interpretation with precise accuracy. You may prefer to see these questions:

As you can see, there's a lot of confusion about these matters, and many ways of explaining them.

Reference

Cumming, G. (2012). Understanding the new statistics: Effect sizes, confidence intervals, and meta-analysis. New York: Routledge.

• These are good remarks, but they seem never to address the question itself, which comes down to making a one-tailed versus a two-tailed test. – whuber Jul 21 '14 at 15:10
• Yeah, it wasn't an answer regarding how to perform a one-sided NHST; it's about how to use a CI to (potentially) conclude something similar but upper-bounded as well. I didn't know the direct answer off the top of my head, and given the enthusiasm for confidence intervals that I expressed here, I hadn't felt the need to look up a direct answer. I suppose it was easy enough though, and @jona just filled it in for us. – Nick Stauner Jul 21 '14 at 18:38

The simplest way to do so (for Pearson correlation) is to use Fisher's z-transformation.

Let r be the correlation in question.

Let n be the sample size used to acquire the correlation. tanh is the hyperbolic tangent atanh or $\tanh^{-1}$ is the inverse hyperbolic tangent.

Let z = atanh(r), then z is normally distributed with variance $\frac{1}{n-3}$`

Using this, you can construct a confidence interval

$C.I.(\rho) = \tanh\left(\tanh^{-1}(\rho) \pm q \cdot \frac{1}{\sqrt{n-3}}\right)$, where $q$ is the value that describes the level of confidence you want (i.e., the value you would read from a normal distribution table (e.g., 1.96 for 95% confidence)),

If zero is in the confidence interval, then you would fail to reject the null hypothesis that the correlation is zero. Also, note that you cannot use this for correlations of $\pm 1$ because if they are one for data that is truly continuous, then you only need 3 data points to determine that.

For one-sided values, simply use the z-score you'd use for a 1-sided p-value for it, and then transform it back and see if your correlation is within the range of that interval.

Edit: You can use a 1-sided test using the same values. Also, I changed sample values $r$ to theoretical values $\rho$, since that's a more appropriate use of confidence intervals.

• Although this is a good (standard) approach, you describe a two-tailed test rather than the one-tailed test requested in the question. – whuber Jul 21 '14 at 19:58
• I believe you can use the z-score and compute the p-value from $-\infty$, but yes, you are correct. – Max Candocia Jul 21 '14 at 21:52
• Re the edit: unsophisticated readers may get the wrong idea. I think it's important to be clear and precise about how the z-score is related to the desired confidence. (For a given level of confidence, the z-scores for the one-sided interval are based on different quantiles than the z-scores for the two-sided interval.) An explicit account of that will reveal the difference between the two-sided test and the one-sided test sought by the O.P. – whuber Jul 21 '14 at 22:03