REGR_R2() GROUP BY ...
All functions > GROUP BY > REGR_R2() GROUP BY ...
Returns the coefficient of determination (R²) of the linear regression.
Syntax
Diagram(
Sequence(
Terminal("REGR_R2"),
Terminal("("),
NonTerminal("expr_y"),
Terminal(","),
NonTerminal("expr_x"),
Terminal(")"),
Choice(0, Skip(),
Sequence(
Terminal("FILTER"),
Terminal("("),
Terminal("WHERE"),
NonTerminal("condition"),
Terminal(")")
)
),
Choice(0, Skip(),
Sequence(
Terminal("GROUP BY"),
OneOrMore(NonTerminal("feature"), Terminal(","))
)
)
)
)| Parameter | Type | Required | Description |
|---|---|---|---|
expr_y | T | Yes | The dependent variable (y) |
expr_x | T | Yes | The independent variable (x) |
condition | BOOLEAN | No | The condition to filter the values before aggregation |
feature | FEATURE | No | The features to group by (many features are supported) |
Notes
- Equivalent to POWER(CORR(y, x), 2)
- Returns a value between 0 (no fit) and 1 (perfect fit)
- NULL values in either expression are excluded from the calculation
- Returns NULL if fewer than 2 non-NULL pairs exist