pyobsmod.Dataset.r#

Dataset.r(method: Literal['pearson', 'kendall', 'spearman'] = 'pearson') float#

Correlation coefficient.

Correlation between sets of data is a measure of how well they are related. The most common measure of correlation in stats is the Pearson Correlation. It shows the linear relationship between two sets of data. In simple terms, it answers the question, Can I draw a line graph to represent the data?

Parameters:

method (str) –

Method of correlation:

  • pearson : standard correlation coefficient

  • kendall : Kendall Tau correlation coefficient

  • spearman : Spearman rank correlation

The default value is ‘pearson’.

Returns:

r – The correlation coefficient.

Return type:

float

Examples

from pyobsmod import load_dataset_example

ds = load_dataset_example()
print(ds.r())
0.9337308465499089