Skip to main content

CORR

Categories: Aggregate

CORR

Calculates the Pearson correlation coefficient of the values expression1 and expression2. The function name must be enclosed in double quotes ("CORR").

Syntax

CORR(expression1 numeric, expression2 numeric) → double

  • expression1: An expression that evaluates to a numeric type. This parameter is the dependent value.
  • expression2: An expression that evaluates to a numeric type. This parameter is the independent value.

Examples

CORR example
SELECT "CORR"(100, 4)
-- NaN
CORR example
SELECT passenger_count,
"CORR"(fare_amount, tip_amount)
FROM "Samples"."samples.dremio.com"."nyc-taxi-trips"
GROUP BY passenger_count
LIMIT 5
-- 8, 0.38978465691058356
-- 4, 0.4254971384215677
-- 208, NaN
-- 255, -1.0
-- 3, 0.46551948595802983