mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 04:50:59 +00:00
docs(stats): say what the r² clamp does and does not fix
This commit is contained in:
1 parent
0e7134a2ea
commit
7af9ebe480
1 file changed
+3
-1
@@ -60,7 +60,9 @@ export function fitFromSums(sums: FitSums): LinearFit | null {
|
||||
intercept: meanY - slope * meanX,
|
||||
// r² is at most 1 by Cauchy–Schwarz. With y far from zero and little
|
||||
// spread (two weighings of about 1000, a tenth apart) the centred sums
|
||||
// lose their last digits and the ratio came out at 1.00000004.
|
||||
// lose their last digits and the ratio came out at 1.00000004. The clamp
|
||||
// keeps it in range; inside the range the same lost digits remain, which
|
||||
// the points and the stored-sums paths share by design.
|
||||
r2: syy === 0 ? null : Math.min(1, (sxy * sxy) / (sxx * syy)),
|
||||
n,
|
||||
meanX,
|
||||
|
||||
Reference in new issue
Block a user