From 877390c354dbb15627aadbf2cdd007d1671097a7 Mon Sep 17 00:00:00 2001 From: Kirk Swenson Date: Fri, 15 Nov 2024 12:18:31 -0800 Subject: [PATCH] fix: bivariate semi-aggregates (linRegrPredicted, linRegrResidual) respect filter argument --- v3/src/models/formula/functions/bivariate-stats-functions.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/v3/src/models/formula/functions/bivariate-stats-functions.ts b/v3/src/models/formula/functions/bivariate-stats-functions.ts index d54b33ce7..d04e0f207 100644 --- a/v3/src/models/formula/functions/bivariate-stats-functions.ts +++ b/v3/src/models/formula/functions/bivariate-stats-functions.ts @@ -134,7 +134,8 @@ function evaluateRawLinearRegressionSemiAggregate(fn: (lsr: ValidLSRResult, x: n scope.withLocalContext(() => { const [xIsValid, x] = checkNumber(evaluateNode(xArg, scope)) const [yIsValid, y] = checkNumber(evaluateNode(yArg, scope)) - if (xIsValid && yIsValid) { + const filterValue = filterArg ? evaluateNode(filterArg, scope) : true + if (xIsValid && yIsValid && isValueTruthy(filterValue)) { result = fn(lsrResult, x, y) } })