correlation Function

public pure function correlation(x, y) result(rst)

Computes the sample correlation coefficient (an estimate to the population Pearson correlation) as follows.

.

Where, & are the sample standard deviations of x and y respectively.

Arguments

Type IntentOptional Attributes Name
real(kind=real64), intent(in), dimension(:) :: x

The first N-element data set.

real(kind=real64), intent(in), dimension(size(x)) :: y

The second N-element data set.

Return Value real(kind=real64)

Correlation coefficient on [-1, 1]; constant, nonfinite, or undersized data give NaN. Scaled centering avoids overflowing moments.