0
$\begingroup$

I need to calculate the standard error of the kendall tau and pearson r correlation coefficients. Unfortunately I couldn't find any formula or python code to calculate them. Any suggestions on how I can calculate the standard error of two methods? And what are the equation/formula for the standard error of both methods?

The following python script can calculate only the kendall tau and pearson r correlation coefficients but not the standard error of both methods:

import scipy.stats as stats
from scipy.stats.stats import pearsonr

x1 = [10, 18, 23, 24]
x2 = [2, 45, 7, 10, 0]
tau, p_value = stats.kendalltau(x1, x2)
r, p = pearsonr(x1, x2)
$\endgroup$
1
  • $\begingroup$ I immediately found three (at least) [previous questions about the variance of the correlation coefficient. Here's the first: stats.stackexchange.com/questions/102965/…. Presumably you are interested not in the "standard error" but instead on the standard deviation which is just the sqrt of the variance. $\endgroup$
    – DWin
    Mar 31, 2018 at 5:51

1 Answer 1

1
$\begingroup$

My answer focuses on Kendall's $\tau$.

First and foremost, we know its asymptotic distribution is normal: here are some formulas based on that for the standard error: https://www.researchgate.net/profile/Douglas_Bonett/publication/24063325_Sample_size_requirements_for_estimating_Pearson_Kendall_and_Spearman_correlations/links/00463536ae6c8b1f13000000.pdf. (There is some info for Spearman's $\rho$ in there too.)

The variance of the empirical version of Kendall's $\tau$ between $X$ and $Y$, say $\hat\tau(X,Y)$, depends on the underlying distribution. A general formula provided by many authors independently (Lindeberg, Daniel & Kendall, and Hoeffding, see this paper for more info: https://onlinelibrary.wiley.com/doi/pdf/10.1111/j.1467-842X.2011.00622.x) is \begin{align*} \mathrm{Var}(\hat\tau) = \frac{8}{n(n-1)} \Big\{ 2(n-2)(Q - P^2) + P(1-P) \Big\}. \end{align*} where P is the probability of concordance between $(X,Y)$ and its independent copy $(X^*,Y^*)$ and Q is the probability that $(X,Y)$ is concordant with two independent copies $(X^*,Y^*)$ and $(X^\bullet,Y^\bullet)$. If you know about copulas, then you can write these probabilities as \begin{align*} P = 2 \int_{[0,1]^2} C(u,v)\ \mathrm{d} C(u,v) \quad \text{and} \quad Q = \int_{[0,1]^2} \{ C(u,v) + \bar{C}(u,v) \}^2\ \mathrm{d} C(u,v) \end{align*} where $\bar{C}$ is the survival function of $C$. Note that \begin{align*} \tau(X,Y) = -1 + 4 \int_{[0,1]^2} C(u,v)\ \mathrm{d} C(u,v). \end{align*}

I suspect that this is a bit too much for your question... Here is a specific situation that might interest you. If your data is multivariate normal, then $\tau = 2 \arcsin(\rho) /\pi$, where $\rho$ is Pearson's correlation. Using this, you can derive \begin{align*} \mathrm{Var}(\hat\tau) = \frac{2}{n(n-1)} \Big[ 1 - \frac{4}{\pi^2} \arcsin^2(\rho) + 2(n-2)\Big\{ \frac{1}{9} - \frac{4}{\pi^2} \arcsin^2(\rho/2) \Big\} \Big] \end{align*} Changing $\rho$ for $\hat\rho$ provides you an estimator. If this is the case that interests you, then you should also take a look here: https://ncss-wpengine.netdna-ssl.com/wp-content/themes/ncss/pdf/Procedures/PASS/Confidence_Intervals_for_Kendalls_Tau-b_Correlation.pdf.

If you want a nonparametric estimate of the asymptotic variance, there is one in the Appendix of this paper: https://arxiv.org/abs/1706.05940.

Finally, I suggest you also look at the answer of this question as it contains valuable information too: Confidence intervals for Kendall's tau. In particular, it discusses bootstrap methods.

Hope that helps.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.