R offers three methods for correlations, Pearson, Spearman and Kendall. For speed I use cor(x, y)
being x a matrix and y a vector of same length. I get back the correlation of all the variables on x with y (I can't do that with cor.test).
To calculate the p-value of these correlations I created a function for the Pearson correlation value and the number of samples using this formula $t = \frac{\hat{\rho}}{\sqrt{\frac{1-\hat{\rho}^2}{n-2}}}$. Will this p-value work for a Spearman or Kendall correlation too?
I don't fully grasp the formula and where does it comes from. And failed to find three different pairs of data that have the same correlation value for the three methods (aside from 0 and 1).