determination_coeff()
Calculate the determination coefficient from a two-dimensional statistical aggregate
Since 1.3.0
Calculate the determination coefficient from a two-dimensional statistical aggregate. The calculation uses the standard least-squares fitting for linear regression.
Samples
Section titled “Samples”Calculate the determination coefficient of independent variable y and dependent variable x for each 15-minute time
bucket:
SELECT id, time_bucket('15 min'::interval, ts) AS bucket, determination_coeff(stats_agg(y, x)) AS summaryFROM fooGROUP BY id, time_bucket('15 min'::interval, ts)Arguments
Section titled “Arguments”The syntax is:
determination_coeff( summary StatsSummary2D) RETURNS DOUBLE PRECISION| Name | Type | Default | Required | Description |
|---|---|---|---|---|
| summary | StatsSummary2D | - | ✔ | The statistical aggregate produced by a stats_agg call |
Returns
Section titled “Returns”| Column | Type | Description |
|---|---|---|
| determination_coeff | DOUBLE PRECISION | The determination coefficient of the least-squares fit line |