Skip to content

Commit 5c3d3e4

Browse files
committed
Fix percentile calculation
1 parent 4b4fefc commit 5c3d3e4

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

lib/model/kernel_density_estimator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export default class KernelDensityEstimator {
5555
const np = n * p
5656
const np_l = Math.floor(np)
5757
const np_h = Math.ceil(np)
58-
return k[np_l] + (np_h - np_l) * (k[np_h] - k[np_l])
58+
return k[np_l] + (np - np_l) * (k[np_h] - k[np_l])
5959
}
6060
const sgm = Math.min(std, (q(0.75) - q(0.25)) / 1.34)
6161

lib/model/nadaraya_watson.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export default class NadarayaWatson {
3838
const np = n * p
3939
const np_l = Math.floor(np)
4040
const np_h = Math.ceil(np)
41-
return k[np_l] + (np_h - np_l) * (k[np_h] - k[np_l])
41+
return k[np_l] + (np - np_l) * (k[np_h] - k[np_l])
4242
}
4343
const sgm = Math.min(std, (q(0.75) - q(0.25)) / 1.34)
4444

lib/model/priestley_chao.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export default class PriestleyChao {
3737
const np = n * p
3838
const np_l = Math.floor(np)
3939
const np_h = Math.ceil(np)
40-
return k[np_l] + (np_h - np_l) * (k[np_h] - k[np_l])
40+
return k[np_l] + (np - np_l) * (k[np_h] - k[np_l])
4141
}
4242
const sgm = Math.min(std, (q(0.75) - q(0.25)) / 1.34)
4343

lib/model/tukeys_fences.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default class TukeysFences {
2626
const np = n * p
2727
const np_l = Math.floor(np)
2828
const np_h = Math.ceil(np)
29-
return x[np_l] + (np_h - np_l) * (x[np_h] - x[np_l])
29+
return x[np_l] + (np - np_l) * (x[np_h] - x[np_l])
3030
}
3131

3232
const q1 = q(0.25)

0 commit comments

Comments
 (0)