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!
 A: 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).
A: 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: 


*

*What, precisely, is a confidence interval?


*

*Possible dupe of ^: What does a confidence interval (vs. a credible interval) actually express?


*Clarification on interpreting confidence intervals?


*

*Interpreting a confidence interval.


*Confidence intervals when using Bayes' theorem

*What's the difference between a confidence interval and a credible interval?

*Should I report credible intervals instead of confidence intervals?

*Are there any examples where Bayesian credible intervals are obviously inferior to frequentist confidence intervals
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.
A: 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.
Source: http://en.wikipedia.org/wiki/Fisher_transformation
