REGR_R2() OVER ...
All functions > WINDOW FUNCTION > REGR_R2() OVER ...
Returns the coefficient of determination (R²) over the window frame.
Syntax
Diagram(
Sequence(
Terminal("REGR_R2"),
Terminal("("),NonTerminal('expr_y'), Terminal(','), NonTerminal('expr_x'),Terminal(")"),
Terminal("OVER"),
Terminal("("),
NonTerminal("over_clause"),
Terminal(")"),
)
)| Parameter | Type | Required | Description |
|---|---|---|---|
expr_y | EXPRESSION | Yes | The dependent variable (y) |
expr_x | EXPRESSION | Yes | The independent variable (x) |
over_clause | OVER CLAUSE | Yes | OVER (PARTITION BY ... ORDER BY ... [FRAME ...]) |
Notes
- Equivalent to POWER(CORR(y, x), 2) over the window
- Returns a value between 0 (no fit) and 1 (perfect fit)