Non-parametric alternatives: Spearman’s rank correlation and Kendall’s rank correlation
Written by:
Ylva B Almquist
It is not uncommon that the assumption of normality (i.e. normally distributed variables) is violated. As an alternative, you can conduct Spearman’s rank correlation (also called Spearman’s rho) or Kendall’s rank correlation (also called Kendall’s tau) instead.
Function alternative 1
Basic command
spearman varname1 varname2
Useful options
spearman varname1 varname2, star(level)
Explanations
varname1
Insert the name of the first variable you want to use.
varname2
Insert the name of the second variable you want to use.
star(level)
Denote statistically significant entries with an asterisk (*). Change “level” to the preferred significance level (e.g. 0.05, 0.01, 0.001).
Note You can include more than two variables at the same time in the analysis. Asterisks only appear if you specify more than two variables.
More information help spearman
Function alternative 2
Basic command
ktau varname1 varname2
Useful options
ktau varname1 varname2, star(level)
Explanations
varname1
Insert the name of the first variable you want to use.
varname2
Insert the name of the second variable you want to use.
star(level)
Denote statistically significant entries with an asterisk (*). Change “level” to the preferred significance level (e.g. 0.05, 0.01, 0.001).
Note You can include more than two variables at the same time in the analysis. Asterisks only appear if you specify more than two variables.
More information help ktau
The two commands are largely the same. However, it has been suggested that Kendall’s rank correlation is slightly more robust since it is less sensitive to small samples (which usually has bigger problems with outliers). We have chosen to stick to Spearman’s rank correlation since our sample is large. We have not included the option to show asterisks, since we only use two variables.
Practical example
Dataset
StataData1.dta
Variable name
gpa
Variable label
Grade point average (Age 15, Year 1985)
Value labels
N/A
Variable name
cognitive
Variable label
Cognitive test score (Age 15, Year 1985)
Value labels
N/A
spearman gpa cognitive
The correlation coefficient (Spearman’s rho) is 0.6361. This is roughly the same as the coefficient we got with pwcorr. The p-value (Prob > |t| =) is 0.0000, which is lower than p<0.05. Thus, the correlation between cognitive test score and grade point average is statistically significant also with this test.