libb.rsq

rsq(x, y)[source]

Compute R-squared (coefficient of determination) between x and y.

Parameters:
  • x – First array.

  • y – Second array.

Returns:

R-squared value.

Return type:

float

Example:

>>> x = [ 6, 5, 11, 7, 5, 4, 4]
>>> y = [ 2, 3,  9, 1, 8, 7, 5]
>>> "{:.5}".format(rsq(x, y))
'0.05795'