The p-values provided by the built-in Matlab and Pylab Pearson correlation functions are stated to be inaccurate for small sample sizes, or when the samples are not normally distributed. The python documentation suggests using an N>500 for the p-value to be accurate, while the Matlab documentation gives no specific cutoff other than "large".
Does anyone know a method that can correctly test for statistical significance of the Pearson correlation coefficient under such circumstances?
My instinct is that I could just perform a permutation test by scrambling the X or Y values and re-sampling the Pearson correlation coefficient from the scrambled data -- then use that distribution to get a confidence interval. But, would this be correct?