dataFrame.columns.stat — corrPearson()
Description
The corrPearson() method of the stat object computes the Pearson correlation coefficient between two selected columns.
Signature
dataFrame.columns(...columnNames).stat.corrPearson()Argument
...columnNames( string[] )- The name of the columns from which to compute the correlation.
Returns
stat( object[] )- A statistic object containing the Pearson correlation coefficient and related statistics.
corr(number)- The Pearson 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 Pearson correlation coefficient ranges from
-1to1 - A value close to
1indicates a strong positive linear relationship. - A value close to
-1indicates a strong negative linear relationship. - A value close to
0indicates little or no linear relationship. - The Pearson correlation coefficient is sensitive to outliers.
- The p-value tests the null hypothesis that the population correlation coefficient is equal to zero.
- The confidence score is calculated as
1 - p_value.
Example
// evaluate a Pearson correlation for 2 columns of the dataFrame
var stat = dataFrame.columns('groupA', 'groupB').stat.corrPearson();
// log the stat details
notebook.log(stat);