{
  "id": 324476,
  "title": " Kendall’s Tau (Kendall Rank Correlation Coefficient)",
  "url": "/competitions/AI4Code/discussion/324476",
  "author_name": "Marília Prata",
  "post_date": "2022-05-12T00:10:45.061000",
  "votes": 51,
  "comment_count": 11,
  "views": 0,
  "content": "<h1>What is Kendall’s Tau?</h1>\n<p>\"Kendall’s Tau is a nonparametric measure of the degree of correlation. It was introduced by Maurice Kendall in 1938 (Kendall 1938).\"</p>\n<p>\"Kendall’s Tau measures the strength of the relationship between two ordinal level variables. Together with Spearman’s rank correlation coefficient, they are two widely accepted measures of rank correlations and more popular rank correlation statistics.\"</p>\n<p>\"It is required that the two variables, X and Y, are paired observations. Then, provided both variables are at least ordinal, it would be possible to calculate the correlation between them. In general, application of the product-moment correlation coefficient is limited by the requirement that the trend must be linear. A less restrictive measure of correlation is based on the probabilistic notion that the correlation between variables X and Y is strong if on average, there is a high probability that an increase in X will be accompanied by an increase in Y (or decrease in Y).\"</p>\n<p><a href=\"https://link.springer.com/referenceworkentry/10.1007/978-3-642-04898-2_324#:~:text=It%20was%20introduced%20by%20Maurice,between%20two%20ordinal%20level%20variables\" target=\"_blank\">https://link.springer.com/referenceworkentry/10.1007/978-3-642-04898-2_324#:~:text=It%20was%20introduced%20by%20Maurice,between%20two%20ordinal%20level%20variables</a>.</p>\n<h1>Sir Maurice George Kendall</h1>\n<p>Sir Maurice George Kendall, FBA (6 September 1907 – 29 March 1983) was a prominent British statistician. The Kendall tau rank correlation is named after him.</p>\n<p><a href=\"https://en.wikipedia.org/wiki/Maurice_Kendall\" target=\"_blank\">https://en.wikipedia.org/wiki/Maurice_Kendall</a></p>\n<h1>The Tau Correlation Coefficient</h1>\n<p>\"Kendall’s Tau is a non-parametric measure of relationships between columns of ranked data. The Tau correlation coefficient returns a value of 0 to 1, where:\"</p>\n<p>0 is no relationship,<br>\n1 is a perfect relationship.</p>\n<p>\"A quirk of this test is that it can also produce negative values (i.e. from -1 to 0). Unlike a linear graph, a negative relationship doesn’t mean much with ranked columns (other than you perhaps switched the columns around), so just remove the negative sign when you’re interpreting Tau.\"</p>\n<p>\"Several version’s of Tau exist.\"</p>\n<p>\"Tau-A and Tau-B are usually used for square tables (with equal columns and rows). Tau-B will adjust for tied ranks. Tau-C is usually used for rectangular tables. For square tables, Tau-B and Tau-C are essentially the same. Most statistical packages have Tau-B built in, but you can use the following formula to calculate it by hand:\"</p>\n<p>Kendall’s Tau = (C – D / C + D)</p>\n<p>\"Where C is the number of concordant pairs and D is the number of discordant pairs.\"</p>\n<p><a href=\"https://www.statisticshowto.com/kendalls-tau/\" target=\"_blank\">https://www.statisticshowto.com/kendalls-tau/</a></p>\n<h1>Assumptions for Kendall’s Tau</h1>\n<p>\"Kendall’s Tau is used to understand the strength of the relationship between two variables. Your variables of interest can be continuous or ordinal and should have a monotonic relationship.\" </p>\n<p>\"Every statistical method has assumptions. Assumptions mean that your data must satisfy certain properties in order for statistical method results to be accurate.\"</p>\n<p>The assumptions for Kendall’s Tau include:</p>\n<p>Continuous or ordinal<br>\nMonotonicity<br>\nLet’s dive in to each one of these individually.</p>\n<p>CONTINUOUS or ORDINAL</p>\n<p>\"The variables that you care about must be continuous or ordinal. Continuous means that the variable can take on any reasonable value. Some good examples of continuous variables include age, weight, height, test scores, survey scores, yearly salary, etc. Kendall’s Tau is often used for correlation on continuous data if there are outliers in the data.\"</p>\n<p>\"Ordinal variables are categories that have an inherent order. For instance, education level (GDE/Bachelors/Masters/PhD), income level (if grouped into high/medium/low) etc.\"</p>\n<p>MONOTONICITY</p>\n<p>\"Your two variables should have a monotonic relationship. This means that the direction of the relationship between the variables is consistent. For instance, when one variable goes up, the other goes up (in general). In this case, a plot of the two variables would move consistently in the up-right direction. The relationship would also be monotonic if when one variable goes up, the other goes down (in general). In this case, the plot of the two variables would move consistently in the down-right direction.\"</p>\n<p>WHEN TO USE KENDALL'S TAU</p>\n<p>\"You should use Kendall’s Tau in the following scenario:\"</p>\n<p>\"You want to know the relationship between two variables. <br>\nYour variables of interest are continuous with outliers or ordinal<br>\nYou have only two variables.\"</p>\n<p>TWO VARIABLES</p>\n<p>\"Kendall’s Tau can only be used to compare two variables.\"</p>\n<p>\"DIFFERENCE BETWEEN SPEARMAN'S RHO and KENDALL'S TAU?</p>\n<p>\"Spearman’s RHO and Kendall’s Tau are very similar tests and are used in similar scenarios. We recommend using Kendall’s Tau first and Spearman’s Rho as a backup.\"</p>\n<p>More Resources:</p>\n<p>\"How do I run Kendall’s Tau in SPSS or R?\"</p>\n<p>\"StatsTest is focused on helping you pick the right statistical method every time. There are many resources available to help you figure out how to run this method with your data:</p>\n<p>SPSS article: <a href=\"https://statistics.laerd.com/spss-tutorials/kendalls-tau-b-using-spss-statistics.php\" target=\"_blank\">https://statistics.laerd.com/spss-tutorials/kendalls-tau-b-using-spss-statistics.php</a><br>\nSPSS video: <a href=\"https://www.youtube.com/watch?v=dTUTvqY4f0E\" target=\"_blank\">https://www.youtube.com/watch?v=dTUTvqY4f0E</a></p>\n<p>R article: <a href=\"http://www.r-tutor.com/gpu-computing/correlation/kendall-tau-b\" target=\"_blank\">http://www.r-tutor.com/gpu-computing/correlation/kendall-tau-b</a><br>\nR video: <a href=\"https://www.youtube.com/watch?v=PC8HXz4P06c\" target=\"_blank\">https://www.youtube.com/watch?v=PC8HXz4P06c</a></p>\n<p><a href=\"https://www.statstest.com/kendalls-tau/\" target=\"_blank\">https://www.statstest.com/kendalls-tau/</a></p>\n<h1>How to Calculate Kendall’s Tau in R</h1>\n<p><a href=\"https://www.statology.org/kendalls-tau/\" target=\"_blank\">https://www.statology.org/kendalls-tau/</a>   Published by Zach (Feb 26, 2020)</p>\n<p>\"In the statistical software R, you can use the kendall.tau() function from the VGAM library to calculate Kendall’s Tau for two vectors, which uses the following syntax:\"</p>\n<p>kendall.tau(x, y)</p>\n<p>\"where x and y are two numerical vectors of equal lenghth.\"</p>\n<p>load VGAM<br>\nlibrary(VGAM)</p>\n<p>create vector for each coach's rankings</p>\n<p>coach_1 &lt;- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)<br>\ncoach_2 &lt;- c(1, 2, 3, 5, 4, 7, 6, 8, 10, 9, 11, 12)</p>\n<p>calculate Kendall's Tau<br>\nkendall.tau(coach_1, coach_2)</p>\n<p>[1] 0.9090909</p>\n<p><a href=\"https://www.statology.org/kendalls-tau/\" target=\"_blank\">https://www.statology.org/kendalls-tau/</a></p>\n<h1>Analysis Nonparametric Kendall Rank Correlation.</h1>\n<p>\"Kendall's rank correlation provides a distribution free test of independence and a measure of the strength of dependence between two variables.\"</p>\n<p>\"Spearman's rank correlation is satisfactory for testing a null hypothesis of independence between two variables but it is difficult to interpret when the null hypothesis is rejected. Kendall's rank correlation improves upon this by reflecting the strength of the dependence between the variables being compared.\"</p>\n<p>\"Consider two samples, x and y, each of size n. The total number of possible pairings of x with y observations is n(n-1)/2. Now consider ordering the pairs by the x values and then by the y values. If x3 &gt; y3 when ordered on both x and y then the third pair is concordant, otherwise the third pair is discordant. S is the difference between the number of concordant (ordered in the same way, nc) and discordant (ordered differently, nd) pairs.\"</p>\n<p>TECHNICAL VALIDATION</p>\n<p>\"An asymptotically distribution-free confidence interval is constructed for τb or τ using the variant of the method of Samra and Randles (1988) described by Hollander and Wolfe (1999).\" </p>\n<p>\"In the absence of ties, the probability of null S (and thus τ) is evaluated using a recurrence formula when n &lt; 9 and an Edgeworth series expansion when n ≥ 9. In the presence of ties you are guided to make inferences from the normal approximation . Note that StatsDirect uses more accurate methods for calculating the P values associated with τ than does most other statistical software, therefore, there may be differences in results.\"</p>\n<p><a href=\"https://www.statsdirect.com/help/nonparametric_methods/kendall_correlation.htm\" target=\"_blank\">https://www.statsdirect.com/help/nonparametric_methods/kendall_correlation.htm</a></p>\n<p>My question? Who is going to be the first to run Kendall's Tau in R in that Competition?</p>\n<p>What I learned after that: We never have a Monotonic Relationship with Kaggle and Kendall isNot Jenner</p>",
  "messages": [
    {
      "id": 1785227,
      "postDate": "2022-05-12T00:10:45.060Z",
      "content": "<h1>What is Kendall’s Tau?</h1>\n<p>\"Kendall’s Tau is a nonparametric measure of the degree of correlation. It was introduced by Maurice Kendall in 1938 (Kendall 1938).\"</p>\n<p>\"Kendall’s Tau measures the strength of the relationship between two ordinal level variables. Together with Spearman’s rank correlation coefficient, they are two widely accepted measures of rank correlations and more popular rank correlation statistics.\"</p>\n<p>\"It is required that the two variables, X and Y, are paired observations. Then, provided both variables are at least ordinal, it would be possible to calculate the correlation between them. In general, application of the product-moment correlation coefficient is limited by the requirement that the trend must be linear. A less restrictive measure of correlation is based on the probabilistic notion that the correlation between variables X and Y is strong if on average, there is a high probability that an increase in X will be accompanied by an increase in Y (or decrease in Y).\"</p>\n<p><a href=\"https://link.springer.com/referenceworkentry/10.1007/978-3-642-04898-2_324#:~:text=It%20was%20introduced%20by%20Maurice,between%20two%20ordinal%20level%20variables\" target=\"_blank\">https://link.springer.com/referenceworkentry/10.1007/978-3-642-04898-2_324#:~:text=It%20was%20introduced%20by%20Maurice,between%20two%20ordinal%20level%20variables</a>.</p>\n<h1>Sir Maurice George Kendall</h1>\n<p>Sir Maurice George Kendall, FBA (6 September 1907 – 29 March 1983) was a prominent British statistician. The Kendall tau rank correlation is named after him.</p>\n<p><a href=\"https://en.wikipedia.org/wiki/Maurice_Kendall\" target=\"_blank\">https://en.wikipedia.org/wiki/Maurice_Kendall</a></p>\n<h1>The Tau Correlation Coefficient</h1>\n<p>\"Kendall’s Tau is a non-parametric measure of relationships between columns of ranked data. The Tau correlation coefficient returns a value of 0 to 1, where:\"</p>\n<p>0 is no relationship,<br>\n1 is a perfect relationship.</p>\n<p>\"A quirk of this test is that it can also produce negative values (i.e. from -1 to 0). Unlike a linear graph, a negative relationship doesn’t mean much with ranked columns (other than you perhaps switched the columns around), so just remove the negative sign when you’re interpreting Tau.\"</p>\n<p>\"Several version’s of Tau exist.\"</p>\n<p>\"Tau-A and Tau-B are usually used for square tables (with equal columns and rows). Tau-B will adjust for tied ranks. Tau-C is usually used for rectangular tables. For square tables, Tau-B and Tau-C are essentially the same. Most statistical packages have Tau-B built in, but you can use the following formula to calculate it by hand:\"</p>\n<p>Kendall’s Tau = (C – D / C + D)</p>\n<p>\"Where C is the number of concordant pairs and D is the number of discordant pairs.\"</p>\n<p><a href=\"https://www.statisticshowto.com/kendalls-tau/\" target=\"_blank\">https://www.statisticshowto.com/kendalls-tau/</a></p>\n<h1>Assumptions for Kendall’s Tau</h1>\n<p>\"Kendall’s Tau is used to understand the strength of the relationship between two variables. Your variables of interest can be continuous or ordinal and should have a monotonic relationship.\" </p>\n<p>\"Every statistical method has assumptions. Assumptions mean that your data must satisfy certain properties in order for statistical method results to be accurate.\"</p>\n<p>The assumptions for Kendall’s Tau include:</p>\n<p>Continuous or ordinal<br>\nMonotonicity<br>\nLet’s dive in to each one of these individually.</p>\n<p>CONTINUOUS or ORDINAL</p>\n<p>\"The variables that you care about must be continuous or ordinal. Continuous means that the variable can take on any reasonable value. Some good examples of continuous variables include age, weight, height, test scores, survey scores, yearly salary, etc. Kendall’s Tau is often used for correlation on continuous data if there are outliers in the data.\"</p>\n<p>\"Ordinal variables are categories that have an inherent order. For instance, education level (GDE/Bachelors/Masters/PhD), income level (if grouped into high/medium/low) etc.\"</p>\n<p>MONOTONICITY</p>\n<p>\"Your two variables should have a monotonic relationship. This means that the direction of the relationship between the variables is consistent. For instance, when one variable goes up, the other goes up (in general). In this case, a plot of the two variables would move consistently in the up-right direction. The relationship would also be monotonic if when one variable goes up, the other goes down (in general). In this case, the plot of the two variables would move consistently in the down-right direction.\"</p>\n<p>WHEN TO USE KENDALL'S TAU</p>\n<p>\"You should use Kendall’s Tau in the following scenario:\"</p>\n<p>\"You want to know the relationship between two variables. <br>\nYour variables of interest are continuous with outliers or ordinal<br>\nYou have only two variables.\"</p>\n<p>TWO VARIABLES</p>\n<p>\"Kendall’s Tau can only be used to compare two variables.\"</p>\n<p>\"DIFFERENCE BETWEEN SPEARMAN'S RHO and KENDALL'S TAU?</p>\n<p>\"Spearman’s RHO and Kendall’s Tau are very similar tests and are used in similar scenarios. We recommend using Kendall’s Tau first and Spearman’s Rho as a backup.\"</p>\n<p>More Resources:</p>\n<p>\"How do I run Kendall’s Tau in SPSS or R?\"</p>\n<p>\"StatsTest is focused on helping you pick the right statistical method every time. There are many resources available to help you figure out how to run this method with your data:</p>\n<p>SPSS article: <a href=\"https://statistics.laerd.com/spss-tutorials/kendalls-tau-b-using-spss-statistics.php\" target=\"_blank\">https://statistics.laerd.com/spss-tutorials/kendalls-tau-b-using-spss-statistics.php</a><br>\nSPSS video: <a href=\"https://www.youtube.com/watch?v=dTUTvqY4f0E\" target=\"_blank\">https://www.youtube.com/watch?v=dTUTvqY4f0E</a></p>\n<p>R article: <a href=\"http://www.r-tutor.com/gpu-computing/correlation/kendall-tau-b\" target=\"_blank\">http://www.r-tutor.com/gpu-computing/correlation/kendall-tau-b</a><br>\nR video: <a href=\"https://www.youtube.com/watch?v=PC8HXz4P06c\" target=\"_blank\">https://www.youtube.com/watch?v=PC8HXz4P06c</a></p>\n<p><a href=\"https://www.statstest.com/kendalls-tau/\" target=\"_blank\">https://www.statstest.com/kendalls-tau/</a></p>\n<h1>How to Calculate Kendall’s Tau in R</h1>\n<p><a href=\"https://www.statology.org/kendalls-tau/\" target=\"_blank\">https://www.statology.org/kendalls-tau/</a>   Published by Zach (Feb 26, 2020)</p>\n<p>\"In the statistical software R, you can use the kendall.tau() function from the VGAM library to calculate Kendall’s Tau for two vectors, which uses the following syntax:\"</p>\n<p>kendall.tau(x, y)</p>\n<p>\"where x and y are two numerical vectors of equal lenghth.\"</p>\n<p>load VGAM<br>\nlibrary(VGAM)</p>\n<p>create vector for each coach's rankings</p>\n<p>coach_1 &lt;- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)<br>\ncoach_2 &lt;- c(1, 2, 3, 5, 4, 7, 6, 8, 10, 9, 11, 12)</p>\n<p>calculate Kendall's Tau<br>\nkendall.tau(coach_1, coach_2)</p>\n<p>[1] 0.9090909</p>\n<p><a href=\"https://www.statology.org/kendalls-tau/\" target=\"_blank\">https://www.statology.org/kendalls-tau/</a></p>\n<h1>Analysis Nonparametric Kendall Rank Correlation.</h1>\n<p>\"Kendall's rank correlation provides a distribution free test of independence and a measure of the strength of dependence between two variables.\"</p>\n<p>\"Spearman's rank correlation is satisfactory for testing a null hypothesis of independence between two variables but it is difficult to interpret when the null hypothesis is rejected. Kendall's rank correlation improves upon this by reflecting the strength of the dependence between the variables being compared.\"</p>\n<p>\"Consider two samples, x and y, each of size n. The total number of possible pairings of x with y observations is n(n-1)/2. Now consider ordering the pairs by the x values and then by the y values. If x3 &gt; y3 when ordered on both x and y then the third pair is concordant, otherwise the third pair is discordant. S is the difference between the number of concordant (ordered in the same way, nc) and discordant (ordered differently, nd) pairs.\"</p>\n<p>TECHNICAL VALIDATION</p>\n<p>\"An asymptotically distribution-free confidence interval is constructed for τb or τ using the variant of the method of Samra and Randles (1988) described by Hollander and Wolfe (1999).\" </p>\n<p>\"In the absence of ties, the probability of null S (and thus τ) is evaluated using a recurrence formula when n &lt; 9 and an Edgeworth series expansion when n ≥ 9. In the presence of ties you are guided to make inferences from the normal approximation . Note that StatsDirect uses more accurate methods for calculating the P values associated with τ than does most other statistical software, therefore, there may be differences in results.\"</p>\n<p><a href=\"https://www.statsdirect.com/help/nonparametric_methods/kendall_correlation.htm\" target=\"_blank\">https://www.statsdirect.com/help/nonparametric_methods/kendall_correlation.htm</a></p>\n<p>My question? Who is going to be the first to run Kendall's Tau in R in that Competition?</p>\n<p>What I learned after that: We never have a Monotonic Relationship with Kaggle and Kendall isNot Jenner</p>",
      "rawMarkdown": "#What is Kendall’s Tau?\n\n\"Kendall’s Tau is a nonparametric measure of the degree of correlation. It was introduced by Maurice Kendall in 1938 (Kendall 1938).\"\n\n\"Kendall’s Tau measures the strength of the relationship between two ordinal level variables. Together with Spearman’s rank correlation coefficient, they are two widely accepted measures of rank correlations and more popular rank correlation statistics.\"\n\n\"It is required that the two variables, X and Y, are paired observations. Then, provided both variables are at least ordinal, it would be possible to calculate the correlation between them. In general, application of the product-moment correlation coefficient is limited by the requirement that the trend must be linear. A less restrictive measure of correlation is based on the probabilistic notion that the correlation between variables X and Y is strong if on average, there is a high probability that an increase in X will be accompanied by an increase in Y (or decrease in Y).\"\n\nhttps://link.springer.com/referenceworkentry/10.1007/978-3-642-04898-2_324#:~:text=It%20was%20introduced%20by%20Maurice,between%20two%20ordinal%20level%20variables.\n\n#Sir Maurice George Kendall \n\nSir Maurice George Kendall, FBA (6 September 1907 – 29 March 1983) was a prominent British statistician. The Kendall tau rank correlation is named after him.\n\nhttps://en.wikipedia.org/wiki/Maurice_Kendall\n\n#The Tau Correlation Coefficient \n\n\"Kendall’s Tau is a non-parametric measure of relationships between columns of ranked data. The Tau correlation coefficient returns a value of 0 to 1, where:\"\n\n0 is no relationship,\n1 is a perfect relationship.\n\n\"A quirk of this test is that it can also produce negative values (i.e. from -1 to 0). Unlike a linear graph, a negative relationship doesn’t mean much with ranked columns (other than you perhaps switched the columns around), so just remove the negative sign when you’re interpreting Tau.\"\n\n\"Several version’s of Tau exist.\"\n\n\"Tau-A and Tau-B are usually used for square tables (with equal columns and rows). Tau-B will adjust for tied ranks. Tau-C is usually used for rectangular tables. For square tables, Tau-B and Tau-C are essentially the same. Most statistical packages have Tau-B built in, but you can use the following formula to calculate it by hand:\"\n\nKendall’s Tau = (C – D / C + D)\n\n\"Where C is the number of concordant pairs and D is the number of discordant pairs.\"\n\nhttps://www.statisticshowto.com/kendalls-tau/\n\n#Assumptions for Kendall’s Tau\n\n\"Kendall’s Tau is used to understand the strength of the relationship between two variables. Your variables of interest can be continuous or ordinal and should have a monotonic relationship.\" \n\n\"Every statistical method has assumptions. Assumptions mean that your data must satisfy certain properties in order for statistical method results to be accurate.\"\n\nThe assumptions for Kendall’s Tau include:\n\nContinuous or ordinal\nMonotonicity\nLet’s dive in to each one of these individually.\n\nCONTINUOUS or ORDINAL\n\n\"The variables that you care about must be continuous or ordinal. Continuous means that the variable can take on any reasonable value. Some good examples of continuous variables include age, weight, height, test scores, survey scores, yearly salary, etc. Kendall’s Tau is often used for correlation on continuous data if there are outliers in the data.\"\n\n\"Ordinal variables are categories that have an inherent order. For instance, education level (GDE/Bachelors/Masters/PhD), income level (if grouped into high/medium/low) etc.\"\n\nMONOTONICITY\n\n\"Your two variables should have a monotonic relationship. This means that the direction of the relationship between the variables is consistent. For instance, when one variable goes up, the other goes up (in general). In this case, a plot of the two variables would move consistently in the up-right direction. The relationship would also be monotonic if when one variable goes up, the other goes down (in general). In this case, the plot of the two variables would move consistently in the down-right direction.\"\n\nWHEN TO USE KENDALL'S TAU\n\n\"You should use Kendall’s Tau in the following scenario:\"\n\n\"You want to know the relationship between two variables. \nYour variables of interest are continuous with outliers or ordinal\nYou have only two variables.\"\n\nTWO VARIABLES\n\n\"Kendall’s Tau can only be used to compare two variables.\"\n\n\"DIFFERENCE BETWEEN SPEARMAN'S RHO and KENDALL'S TAU?\n\n\"Spearman’s RHO and Kendall’s Tau are very similar tests and are used in similar scenarios. We recommend using Kendall’s Tau first and Spearman’s Rho as a backup.\"\n\nMore Resources:\n\n\"How do I run Kendall’s Tau in SPSS or R?\"\n\n\"StatsTest is focused on helping you pick the right statistical method every time. There are many resources available to help you figure out how to run this method with your data:\n\nSPSS article: https://statistics.laerd.com/spss-tutorials/kendalls-tau-b-using-spss-statistics.php\nSPSS video: https://www.youtube.com/watch?v=dTUTvqY4f0E\n\nR article: http://www.r-tutor.com/gpu-computing/correlation/kendall-tau-b\nR video: https://www.youtube.com/watch?v=PC8HXz4P06c\n\nhttps://www.statstest.com/kendalls-tau/\n\n#How to Calculate Kendall’s Tau in R \n\nhttps://www.statology.org/kendalls-tau/   Published by Zach (Feb 26, 2020)\n\n\"In the statistical software R, you can use the kendall.tau() function from the VGAM library to calculate Kendall’s Tau for two vectors, which uses the following syntax:\"\n\nkendall.tau(x, y)\n\n\"where x and y are two numerical vectors of equal lenghth.\"\n\nload VGAM\nlibrary(VGAM)\n\ncreate vector for each coach's rankings\n\ncoach_1 <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)\ncoach_2 <- c(1, 2, 3, 5, 4, 7, 6, 8, 10, 9, 11, 12)\n\ncalculate Kendall's Tau\nkendall.tau(coach_1, coach_2)\n\n[1] 0.9090909\n\nhttps://www.statology.org/kendalls-tau/\n\n#Analysis Nonparametric Kendall Rank Correlation. \n\n\"Kendall's rank correlation provides a distribution free test of independence and a measure of the strength of dependence between two variables.\"\n\n\"Spearman's rank correlation is satisfactory for testing a null hypothesis of independence between two variables but it is difficult to interpret when the null hypothesis is rejected. Kendall's rank correlation improves upon this by reflecting the strength of the dependence between the variables being compared.\"\n\n\"Consider two samples, x and y, each of size n. The total number of possible pairings of x with y observations is n(n-1)/2. Now consider ordering the pairs by the x values and then by the y values. If x3 > y3 when ordered on both x and y then the third pair is concordant, otherwise the third pair is discordant. S is the difference between the number of concordant (ordered in the same way, nc) and discordant (ordered differently, nd) pairs.\"\n\nTECHNICAL VALIDATION\n\n\"An asymptotically distribution-free confidence interval is constructed for τb or τ using the variant of the method of Samra and Randles (1988) described by Hollander and Wolfe (1999).\" \n\n\"In the absence of ties, the probability of null S (and thus τ) is evaluated using a recurrence formula when n < 9 and an Edgeworth series expansion when n ≥ 9. In the presence of ties you are guided to make inferences from the normal approximation . Note that StatsDirect uses more accurate methods for calculating the P values associated with τ than does most other statistical software, therefore, there may be differences in results.\"\n\nhttps://www.statsdirect.com/help/nonparametric_methods/kendall_correlation.htm\n\nMy question? Who is going to be the first to run Kendall's Tau in R in that Competition?\n\nWhat I learned after that: We never have a Monotonic Relationship with Kaggle and Kendall isNot Jenner",
      "votes": 49
    },
    {
      "id": 1862102,
      "postDate": "2022-07-19T13:09:48.713Z",
      "content": "<p>Wow! Your little resume about Kendall Correlation is very interesting!</p>\n<p>What is the difference or error % between Kendal and Pearson Correlation?</p>",
      "rawMarkdown": "Wow! Your little resume about Kendall Correlation is very interesting!\n\nWhat is the difference or error % between Kendal and Pearson Correlation?",
      "votes": 1,
      "replies": [
        {
          "id": 1862485,
          "postDate": "2022-07-19T18:26:57.183Z",
          "content": "<p><a href=\"https://www.kaggle.com/xoelcouselo\" target=\"_blank\">@xoelcouselo</a> <br>\nGracias Xoel.</p>\n<p>\"Spearman's rho is more sensitive to error and discrepancies in the data. When data is normal, Kendall's tau has smaller gross error sensitivity and smaller asymptotic variance.\"<br>\n<a href=\"https://statisticaloddsandends.wordpress.com/2019/07/08/spearmans-rho-and-kendalls-tau/\" target=\"_blank\">https://statisticaloddsandends.wordpress.com/2019/07/08/spearmans-rho-and-kendalls-tau/</a></p>\n<p>In fact, I don't know what is the difference. I'm just a curious kaggler that is learning on Kaggle. </p>\n<p>Anyway, you're a DS. You can tell me better the correct answer to your question.</p>",
          "rawMarkdown": "@xoelcouselo \nGracias Xoel.\n\n\"Spearman's rho is more sensitive to error and discrepancies in the data. When data is normal, Kendall's tau has smaller gross error sensitivity and smaller asymptotic variance.\"\nhttps://statisticaloddsandends.wordpress.com/2019/07/08/spearmans-rho-and-kendalls-tau/\n\nIn fact, I don't know what is the difference. I'm just a curious kaggler that is learning on Kaggle. \n\nAnyway, you're a DS. You can tell me better the correct answer to your question.",
          "votes": 1,
          "replies": [
            {
              "id": 2546709,
              "postDate": "2023-12-02T18:19:55.537Z",
              "content": "<p>I must be very bad at DS for not knowing the difference.</p>\n<p>Sorry for the late response</p>",
              "rawMarkdown": "I must be very bad at DS for not knowing the difference.\n\nSorry for the late response"
            }
          ]
        }
      ]
    },
    {
      "id": 1789598,
      "postDate": "2022-05-14T03:41:42.113Z",
      "content": "<p>Super helpful, it took me time to understand the metric!</p>",
      "rawMarkdown": "Super helpful, it took me time to understand the metric!",
      "votes": 1,
      "replies": [
        {
          "id": 1790133,
          "postDate": "2022-05-14T14:51:30.353Z",
          "content": "<p>I'm very glad that you found it useful to understand the metric.</p>",
          "rawMarkdown": "I'm very glad that you found it useful to understand the metric."
        }
      ]
    },
    {
      "id": 1787246,
      "postDate": "2022-05-13T17:45:39.057Z",
      "content": "<p>Thanks for the information🖖</p>",
      "rawMarkdown": "Thanks for the information🖖",
      "votes": 1,
      "replies": [
        {
          "id": 1787288,
          "postDate": "2022-05-13T18:41:33.067Z",
          "content": "<p>You're welcome wuuthraad. Thank you.</p>",
          "rawMarkdown": "You're welcome wuuthraad. Thank you."
        }
      ]
    },
    {
      "id": 1785469,
      "postDate": "2022-05-12T06:00:59.757Z",
      "content": "<p><a href=\"https://www.kaggle.com/mpwolke\" target=\"_blank\">@mpwolke</a> this is an interesting topic, do you know of the implementation in python?</p>",
      "rawMarkdown": "@mpwolke this is an interesting topic, do you know of the implementation in python?",
      "votes": 1,
      "replies": [
        {
          "id": 1785734,
          "postDate": "2022-05-12T11:19:11.267Z",
          "content": "<p>Ryan Holbrook made one example of Kendall Tau:<br>\n<a href=\"https://www.kaggle.com/code/ryanholbrook/competition-metric-kendall-tau-correlation\" target=\"_blank\">https://www.kaggle.com/code/ryanholbrook/competition-metric-kendall-tau-correlation</a></p>\n<p>Till yesterday, I haven't ever heard about Kendall's correlation.</p>\n<p>As I wrote at the end: Now I know Kendall isn't just Jenner :)</p>\n<p>Thank you for your precious support Lachlan!</p>",
          "rawMarkdown": "Ryan Holbrook made one example of Kendall Tau:\nhttps://www.kaggle.com/code/ryanholbrook/competition-metric-kendall-tau-correlation\n\nTill yesterday, I haven't ever heard about Kendall's correlation.\n\nAs I wrote at the end: Now I know Kendall isn't just Jenner :)\n\nThank you for your precious support Lachlan!",
          "votes": 1
        }
      ]
    },
    {
      "id": 1787192,
      "postDate": "2022-05-13T16:46:10.403Z",
      "rawMarkdown": "",
      "votes": 1,
      "isDeleted": true,
      "replies": [
        {
          "id": 1787294,
          "postDate": "2022-05-13T18:52:03.710Z",
          "content": "<p>Thank you Azmine. I'm glad I've helped you to start learning Kendall's Tau.</p>",
          "rawMarkdown": "Thank you Azmine. I'm glad I've helped you to start learning Kendall's Tau.",
          "votes": 1
        }
      ]
    }
  ],
  "comments": [
    {
      "id": 1862102,
      "author_name": "Xoel Couselo",
      "author_url": "",
      "post_date": "2022-07-19T13:09:48.713000",
      "content": "<p>Wow! Your little resume about Kendall Correlation is very interesting!</p>\n<p>What is the difference or error % between Kendal and Pearson Correlation?</p>",
      "votes": 1,
      "replies": [
        {
          "id": 1862485,
          "author_name": "Marília Prata",
          "author_url": "",
          "post_date": "2022-07-19T18:26:57.183000",
          "content": "<p><a href=\"https://www.kaggle.com/xoelcouselo\" target=\"_blank\">@xoelcouselo</a> <br>\nGracias Xoel.</p>\n<p>\"Spearman's rho is more sensitive to error and discrepancies in the data. When data is normal, Kendall's tau has smaller gross error sensitivity and smaller asymptotic variance.\"<br>\n<a href=\"https://statisticaloddsandends.wordpress.com/2019/07/08/spearmans-rho-and-kendalls-tau/\" target=\"_blank\">https://statisticaloddsandends.wordpress.com/2019/07/08/spearmans-rho-and-kendalls-tau/</a></p>\n<p>In fact, I don't know what is the difference. I'm just a curious kaggler that is learning on Kaggle. </p>\n<p>Anyway, you're a DS. You can tell me better the correct answer to your question.</p>",
          "votes": 1,
          "replies": [
            {
              "id": 2546709,
              "author_name": "Xoel Couselo",
              "author_url": "",
              "post_date": "2023-12-02T18:19:55.537000",
              "content": "<p>I must be very bad at DS for not knowing the difference.</p>\n<p>Sorry for the late response</p>",
              "votes": 0,
              "replies": []
            }
          ]
        }
      ]
    },
    {
      "id": 1789598,
      "author_name": "Bhavesh Bisht",
      "author_url": "",
      "post_date": "2022-05-14T03:41:42.113000",
      "content": "<p>Super helpful, it took me time to understand the metric!</p>",
      "votes": 1,
      "replies": [
        {
          "id": 1790133,
          "author_name": "Marília Prata",
          "author_url": "",
          "post_date": "2022-05-14T14:51:30.353000",
          "content": "<p>I'm very glad that you found it useful to understand the metric.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1787246,
      "author_name": "wuuthraad",
      "author_url": "",
      "post_date": "2022-05-13T17:45:39.057000",
      "content": "<p>Thanks for the information🖖</p>",
      "votes": 1,
      "replies": [
        {
          "id": 1787288,
          "author_name": "Marília Prata",
          "author_url": "",
          "post_date": "2022-05-13T18:41:33.067000",
          "content": "<p>You're welcome wuuthraad. Thank you.</p>",
          "votes": 0,
          "replies": []
        }
      ]
    },
    {
      "id": 1785469,
      "author_name": "Lachlan Gillian",
      "author_url": "",
      "post_date": "2022-05-12T06:00:59.757000",
      "content": "<p><a href=\"https://www.kaggle.com/mpwolke\" target=\"_blank\">@mpwolke</a> this is an interesting topic, do you know of the implementation in python?</p>",
      "votes": 1,
      "replies": [
        {
          "id": 1785734,
          "author_name": "Marília Prata",
          "author_url": "",
          "post_date": "2022-05-12T11:19:11.267000",
          "content": "<p>Ryan Holbrook made one example of Kendall Tau:<br>\n<a href=\"https://www.kaggle.com/code/ryanholbrook/competition-metric-kendall-tau-correlation\" target=\"_blank\">https://www.kaggle.com/code/ryanholbrook/competition-metric-kendall-tau-correlation</a></p>\n<p>Till yesterday, I haven't ever heard about Kendall's correlation.</p>\n<p>As I wrote at the end: Now I know Kendall isn't just Jenner :)</p>\n<p>Thank you for your precious support Lachlan!</p>",
          "votes": 1,
          "replies": []
        }
      ]
    },
    {
      "id": 1787192,
      "author_name": "",
      "author_url": "",
      "post_date": "2022-05-13T16:46:10.403000",
      "content": "",
      "votes": 1,
      "replies": [
        {
          "id": 1787294,
          "author_name": "Marília Prata",
          "author_url": "",
          "post_date": "2022-05-13T18:52:03.710000",
          "content": "<p>Thank you Azmine. I'm glad I've helped you to start learning Kendall's Tau.</p>",
          "votes": 1,
          "replies": []
        }
      ]
    }
  ],
  "raw_markdown_by_id": {
    "1785227": "#What is Kendall’s Tau?\n\n\"Kendall’s Tau is a nonparametric measure of the degree of correlation. It was introduced by Maurice Kendall in 1938 (Kendall 1938).\"\n\n\"Kendall’s Tau measures the strength of the relationship between two ordinal level variables. Together with Spearman’s rank correlation coefficient, they are two widely accepted measures of rank correlations and more popular rank correlation statistics.\"\n\n\"It is required that the two variables, X and Y, are paired observations. Then, provided both variables are at least ordinal, it would be possible to calculate the correlation between them. In general, application of the product-moment correlation coefficient is limited by the requirement that the trend must be linear. A less restrictive measure of correlation is based on the probabilistic notion that the correlation between variables X and Y is strong if on average, there is a high probability that an increase in X will be accompanied by an increase in Y (or decrease in Y).\"\n\nhttps://link.springer.com/referenceworkentry/10.1007/978-3-642-04898-2_324#:~:text=It%20was%20introduced%20by%20Maurice,between%20two%20ordinal%20level%20variables.\n\n#Sir Maurice George Kendall \n\nSir Maurice George Kendall, FBA (6 September 1907 – 29 March 1983) was a prominent British statistician. The Kendall tau rank correlation is named after him.\n\nhttps://en.wikipedia.org/wiki/Maurice_Kendall\n\n#The Tau Correlation Coefficient \n\n\"Kendall’s Tau is a non-parametric measure of relationships between columns of ranked data. The Tau correlation coefficient returns a value of 0 to 1, where:\"\n\n0 is no relationship,\n1 is a perfect relationship.\n\n\"A quirk of this test is that it can also produce negative values (i.e. from -1 to 0). Unlike a linear graph, a negative relationship doesn’t mean much with ranked columns (other than you perhaps switched the columns around), so just remove the negative sign when you’re interpreting Tau.\"\n\n\"Several version’s of Tau exist.\"\n\n\"Tau-A and Tau-B are usually used for square tables (with equal columns and rows). Tau-B will adjust for tied ranks. Tau-C is usually used for rectangular tables. For square tables, Tau-B and Tau-C are essentially the same. Most statistical packages have Tau-B built in, but you can use the following formula to calculate it by hand:\"\n\nKendall’s Tau = (C – D / C + D)\n\n\"Where C is the number of concordant pairs and D is the number of discordant pairs.\"\n\nhttps://www.statisticshowto.com/kendalls-tau/\n\n#Assumptions for Kendall’s Tau\n\n\"Kendall’s Tau is used to understand the strength of the relationship between two variables. Your variables of interest can be continuous or ordinal and should have a monotonic relationship.\" \n\n\"Every statistical method has assumptions. Assumptions mean that your data must satisfy certain properties in order for statistical method results to be accurate.\"\n\nThe assumptions for Kendall’s Tau include:\n\nContinuous or ordinal\nMonotonicity\nLet’s dive in to each one of these individually.\n\nCONTINUOUS or ORDINAL\n\n\"The variables that you care about must be continuous or ordinal. Continuous means that the variable can take on any reasonable value. Some good examples of continuous variables include age, weight, height, test scores, survey scores, yearly salary, etc. Kendall’s Tau is often used for correlation on continuous data if there are outliers in the data.\"\n\n\"Ordinal variables are categories that have an inherent order. For instance, education level (GDE/Bachelors/Masters/PhD), income level (if grouped into high/medium/low) etc.\"\n\nMONOTONICITY\n\n\"Your two variables should have a monotonic relationship. This means that the direction of the relationship between the variables is consistent. For instance, when one variable goes up, the other goes up (in general). In this case, a plot of the two variables would move consistently in the up-right direction. The relationship would also be monotonic if when one variable goes up, the other goes down (in general). In this case, the plot of the two variables would move consistently in the down-right direction.\"\n\nWHEN TO USE KENDALL'S TAU\n\n\"You should use Kendall’s Tau in the following scenario:\"\n\n\"You want to know the relationship between two variables. \nYour variables of interest are continuous with outliers or ordinal\nYou have only two variables.\"\n\nTWO VARIABLES\n\n\"Kendall’s Tau can only be used to compare two variables.\"\n\n\"DIFFERENCE BETWEEN SPEARMAN'S RHO and KENDALL'S TAU?\n\n\"Spearman’s RHO and Kendall’s Tau are very similar tests and are used in similar scenarios. We recommend using Kendall’s Tau first and Spearman’s Rho as a backup.\"\n\nMore Resources:\n\n\"How do I run Kendall’s Tau in SPSS or R?\"\n\n\"StatsTest is focused on helping you pick the right statistical method every time. There are many resources available to help you figure out how to run this method with your data:\n\nSPSS article: https://statistics.laerd.com/spss-tutorials/kendalls-tau-b-using-spss-statistics.php\nSPSS video: https://www.youtube.com/watch?v=dTUTvqY4f0E\n\nR article: http://www.r-tutor.com/gpu-computing/correlation/kendall-tau-b\nR video: https://www.youtube.com/watch?v=PC8HXz4P06c\n\nhttps://www.statstest.com/kendalls-tau/\n\n#How to Calculate Kendall’s Tau in R \n\nhttps://www.statology.org/kendalls-tau/   Published by Zach (Feb 26, 2020)\n\n\"In the statistical software R, you can use the kendall.tau() function from the VGAM library to calculate Kendall’s Tau for two vectors, which uses the following syntax:\"\n\nkendall.tau(x, y)\n\n\"where x and y are two numerical vectors of equal lenghth.\"\n\nload VGAM\nlibrary(VGAM)\n\ncreate vector for each coach's rankings\n\ncoach_1 <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)\ncoach_2 <- c(1, 2, 3, 5, 4, 7, 6, 8, 10, 9, 11, 12)\n\ncalculate Kendall's Tau\nkendall.tau(coach_1, coach_2)\n\n[1] 0.9090909\n\nhttps://www.statology.org/kendalls-tau/\n\n#Analysis Nonparametric Kendall Rank Correlation. \n\n\"Kendall's rank correlation provides a distribution free test of independence and a measure of the strength of dependence between two variables.\"\n\n\"Spearman's rank correlation is satisfactory for testing a null hypothesis of independence between two variables but it is difficult to interpret when the null hypothesis is rejected. Kendall's rank correlation improves upon this by reflecting the strength of the dependence between the variables being compared.\"\n\n\"Consider two samples, x and y, each of size n. The total number of possible pairings of x with y observations is n(n-1)/2. Now consider ordering the pairs by the x values and then by the y values. If x3 > y3 when ordered on both x and y then the third pair is concordant, otherwise the third pair is discordant. S is the difference between the number of concordant (ordered in the same way, nc) and discordant (ordered differently, nd) pairs.\"\n\nTECHNICAL VALIDATION\n\n\"An asymptotically distribution-free confidence interval is constructed for τb or τ using the variant of the method of Samra and Randles (1988) described by Hollander and Wolfe (1999).\" \n\n\"In the absence of ties, the probability of null S (and thus τ) is evaluated using a recurrence formula when n < 9 and an Edgeworth series expansion when n ≥ 9. In the presence of ties you are guided to make inferences from the normal approximation . Note that StatsDirect uses more accurate methods for calculating the P values associated with τ than does most other statistical software, therefore, there may be differences in results.\"\n\nhttps://www.statsdirect.com/help/nonparametric_methods/kendall_correlation.htm\n\nMy question? Who is going to be the first to run Kendall's Tau in R in that Competition?\n\nWhat I learned after that: We never have a Monotonic Relationship with Kaggle and Kendall isNot Jenner",
    "1862102": "Wow! Your little resume about Kendall Correlation is very interesting!\n\nWhat is the difference or error % between Kendal and Pearson Correlation?",
    "1789598": "Super helpful, it took me time to understand the metric!",
    "1787246": "Thanks for the information🖖",
    "1785469": "@mpwolke this is an interesting topic, do you know of the implementation in python?",
    "1787192": ""
  }
}