dataFrame.columns.stat — corrSpearman()
Description
The corrSpearman() method of the stat object computes Spearman's rank correlation coefficient between two selected columns.
Signature
dataFrame.columns(...columnNames).stat.corrSpearman()Argument
...columnNames( string[] )- The name of the columns from which to compute the correlation.
Returns
stat( object[] )- A statistic object containing the Spearman rank correlation coefficient and related statistics.
corr(number)- The Spearman rank correlation coefficient.
p_value(number)- The p-value associated with the correlation.
confidence(number)- A confidence score computed from the correlation p-value as
1 - p_value.
Notes
- The method requires exactly two selected columns.
- The Spearman correlation coefficient ranges from
-1to1 - A value close to
1indicates a strong positive monotonic relationship. - A value close to
-1indicates a strong negative monotonic relationship. - A value close to
0indicates little or no monotonic relationship. - The Spearman correlation coefficient is less sensitive to outliers than Pearson correlation.
- The p-value tests the null hypothesis that the population rank correlation coefficient is equal to zero.
- The confidence score is calculated as
1 - p_value.
Example
// evaluate a Spearman rank correlation for 2 columns of the dataFrame
var stat = dataFrame.columns('groupA', 'groupB').stat.corrSpearman();
// log the stat details
notebook.log(stat);