Skip to content

Commit f656609

Browse files
committed
Fixing stats.lua issues brought up by atronia
1 parent 17c2c66 commit f656609

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
# Changelog - 0.3.6
2-
- Fixed [Issue #4](https://github.com/TechTastic/Advanced-Math/issues/4)
3-
- Conflicting `metatable` locals in `pid` module
4-
- Fixed `self.integral = max` (`self.integral_max = max`)
5-
- Big thanks to GameSpender for [their PR](https://github.com/TechTastic/Advanced-Math/pull/5)!
1+
# Changelog - 0.3.7
2+
- Fixed various `stat.lua` issues including formatting issues and bad `expect` calls

datapack/data/computercraft/lua/rom/modules/main/advanced_math/stats.lua

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ function stats.winsorMean(data, alpha)
278278
if math.abs(alpha) ~= alpha then
279279
expect(2, alpha, "non-negative number")
280280
end
281-
if alpha > 0.5 then execpt(2, alpha, "number less than or equal to 0.5")
281+
if alpha > 0.5 then execpt(2, alpha, "number less than or equal to 0.5") end
282282
end
283283
alpha = alpha or 0.05
284284
local t = { table.unpack(data) }
@@ -519,7 +519,7 @@ function stats.testdata(n, a, b)
519519
expect(1, n, "number")
520520
expect(2, a, "number")
521521
expect(3, b, "number")
522-
if n < 1 then expect(1, n, "number greater than or equal to one")
522+
if n < 1 then expect(1, n, "number greater than or equal to one") end
523523
local result = {}
524524
a = a or 0
525525
b = b or 1
@@ -569,8 +569,8 @@ end
569569
function stats.linRegPred(model, xval)
570570
expect(1, model, "table")
571571
expect(2, xval, "number")
572-
expect(1, model.slope, "linear regression model")
573-
expect(1, model.intercept, "linear regression model")
572+
expect(1, model.slope, "number")
573+
expect(1, model.intercept, "number")
574574
if not model then return nil end
575575
return model.slope * xval + model.intercept
576576
end
@@ -586,8 +586,8 @@ function stats.r2(x, y, model)
586586
expect(1, x, "table")
587587
expect(2, y, "table")
588588
expect(3, model, "table")
589-
expect(3, model.slope, "linear regression model")
590-
expect(3, model.intercept, "linear regression model")
589+
expect(3, model.slope, "number")
590+
expect(3, model.intercept, "number")
591591
local n = #y
592592
if n == 0 or not model then return nil end
593593

0 commit comments

Comments
 (0)