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