REGR_SLOPE() GROUP BY ...
All functions > GROUP BY > REGR_SLOPE() GROUP BY ...
Returns the slope of the linear regression line fitted to (x, y) pairs.
Syntax
Diagram(
Sequence(
Terminal("REGR_SLOPE"),
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 COVAR_POP(y, x) / VAR_POP(x)
- NULL values in either expression are excluded from the calculation
- Returns NULL if VAR_POP(x) is zero or fewer than 2 non-NULL pairs exist