Versions:

# determination_coeff() ToolkitTimescaleDB Toolkit functions are available under Timescale Community Edition. They are automatically included with Timescale Cloud. Click to learn more.

Toolkit

TimescaleDB Toolkit functions are available under Timescale Community Edition. They are automatically included with Timescale Cloud. Click to learn more.

```
determination_coeff(
summary StatsSummary2D
) RETURNS DOUBLE PRECISION
```

The coefficient of determination (or the R squared) of the least squares fit line computed from a two-dimensional statistical aggregate.

For more information about statistical aggregate functions, see the hyperfunctions documentation.

## Required arguments

Name | Type | Description |
---|---|---|

`summary` | `StatsSummary2D` | The input StatsSummary from a `stats_agg` call |

## Returns

Name | Type | Description |
---|---|---|

`determination_coeff` | `DOUBLE PRECISION` | The determination coefficient of the least squares fit line. |

## Sample usage

```
SELECT
id,
time_bucket('15 min'::interval, ts) AS bucket,
determination_coeff(stats_agg(y, x)) AS summary
FROM foo
GROUP BY id, time_bucket('15 min'::interval, ts)
```

Found an issue on this page?

Report an issue!