qesuite 1.0.14 → 1.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +105 -0
- package/dist/index.mjs +105 -0
- package/index.ts +112 -2
- package/package.json +1 -1
- package/versions/1_0_15.md +15 -0
package/dist/index.d.mts
CHANGED
|
@@ -329,6 +329,10 @@ declare const Distributions: {
|
|
|
329
329
|
*/
|
|
330
330
|
pdf(x: number, a: number, b: number): number;
|
|
331
331
|
};
|
|
332
|
+
ChiSq: {
|
|
333
|
+
cdf(x: number, df: number): number;
|
|
334
|
+
RightTail(x: number, df: number): number;
|
|
335
|
+
};
|
|
332
336
|
Exponential: {
|
|
333
337
|
/**
|
|
334
338
|
* Cumulative Distribution Function. Calculates the probability of a random variable with a value less than or equal to x occuring from the exponential distribution with the specified scale parameter and optional threshold parameter.
|
|
@@ -588,6 +592,23 @@ declare const Distributions: {
|
|
|
588
592
|
* @param scale [OPTIONAL] (σ): The scale parameter of the specified distribution. The scale parameter of the normal distribution is equivalent to the Standard Deviation.
|
|
589
593
|
*/
|
|
590
594
|
pdf(x: number, location?: number, scale?: number): number;
|
|
595
|
+
RyanJoiner: {
|
|
596
|
+
Test(data: number[]): {
|
|
597
|
+
RJ: number;
|
|
598
|
+
critical: number;
|
|
599
|
+
};
|
|
600
|
+
Critical(data: number[]): number;
|
|
601
|
+
};
|
|
602
|
+
JarqueBera(data: number[]): {
|
|
603
|
+
JB: number;
|
|
604
|
+
};
|
|
605
|
+
Chebyshev(data: number[], spec: Specification): number;
|
|
606
|
+
Skewness(data: any): number;
|
|
607
|
+
Kurtosis(data: any): number;
|
|
608
|
+
KolmogorovSmirnov(data: any): {
|
|
609
|
+
KS: number;
|
|
610
|
+
p: any;
|
|
611
|
+
};
|
|
591
612
|
};
|
|
592
613
|
T: {
|
|
593
614
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -329,6 +329,10 @@ declare const Distributions: {
|
|
|
329
329
|
*/
|
|
330
330
|
pdf(x: number, a: number, b: number): number;
|
|
331
331
|
};
|
|
332
|
+
ChiSq: {
|
|
333
|
+
cdf(x: number, df: number): number;
|
|
334
|
+
RightTail(x: number, df: number): number;
|
|
335
|
+
};
|
|
332
336
|
Exponential: {
|
|
333
337
|
/**
|
|
334
338
|
* Cumulative Distribution Function. Calculates the probability of a random variable with a value less than or equal to x occuring from the exponential distribution with the specified scale parameter and optional threshold parameter.
|
|
@@ -588,6 +592,23 @@ declare const Distributions: {
|
|
|
588
592
|
* @param scale [OPTIONAL] (σ): The scale parameter of the specified distribution. The scale parameter of the normal distribution is equivalent to the Standard Deviation.
|
|
589
593
|
*/
|
|
590
594
|
pdf(x: number, location?: number, scale?: number): number;
|
|
595
|
+
RyanJoiner: {
|
|
596
|
+
Test(data: number[]): {
|
|
597
|
+
RJ: number;
|
|
598
|
+
critical: number;
|
|
599
|
+
};
|
|
600
|
+
Critical(data: number[]): number;
|
|
601
|
+
};
|
|
602
|
+
JarqueBera(data: number[]): {
|
|
603
|
+
JB: number;
|
|
604
|
+
};
|
|
605
|
+
Chebyshev(data: number[], spec: Specification): number;
|
|
606
|
+
Skewness(data: any): number;
|
|
607
|
+
Kurtosis(data: any): number;
|
|
608
|
+
KolmogorovSmirnov(data: any): {
|
|
609
|
+
KS: number;
|
|
610
|
+
p: any;
|
|
611
|
+
};
|
|
591
612
|
};
|
|
592
613
|
T: {
|
|
593
614
|
/**
|
package/dist/index.js
CHANGED
|
@@ -975,6 +975,17 @@ var Distributions = {
|
|
|
975
975
|
return Math.pow(x, a - 1) * Math.pow(1 - x, b - 1) / Beta.fn(a, b);
|
|
976
976
|
}
|
|
977
977
|
},
|
|
978
|
+
ChiSq: {
|
|
979
|
+
cdf(x, df) {
|
|
980
|
+
if (df === 2) {
|
|
981
|
+
return 1 - Math.exp(-x / 2);
|
|
982
|
+
}
|
|
983
|
+
return NaN;
|
|
984
|
+
},
|
|
985
|
+
RightTail(x, df) {
|
|
986
|
+
return 1 - Distributions.ChiSq.cdf(x, df);
|
|
987
|
+
}
|
|
988
|
+
},
|
|
978
989
|
Exponential: {
|
|
979
990
|
/**
|
|
980
991
|
* Cumulative Distribution Function. Calculates the probability of a random variable with a value less than or equal to x occuring from the exponential distribution with the specified scale parameter and optional threshold parameter.
|
|
@@ -1469,6 +1480,100 @@ var Distributions = {
|
|
|
1469
1480
|
*/
|
|
1470
1481
|
pdf(x, location = 0, scale = 1) {
|
|
1471
1482
|
return 1 / (scale * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((x - location) / scale, 2));
|
|
1483
|
+
},
|
|
1484
|
+
RyanJoiner: {
|
|
1485
|
+
Test(data) {
|
|
1486
|
+
let N = data.length;
|
|
1487
|
+
let Z = [];
|
|
1488
|
+
let Y = data.sort(function(a, b) {
|
|
1489
|
+
return a - b;
|
|
1490
|
+
});
|
|
1491
|
+
let numSum = 0;
|
|
1492
|
+
let denSum = 0;
|
|
1493
|
+
let mean = Mean(data);
|
|
1494
|
+
let variance = Math.pow(StDev.S(data), 2);
|
|
1495
|
+
for (let i = 0; i < N; i++) {
|
|
1496
|
+
Z[i] = Distributions.Normal.inv((i + 1 - 0.375) / (N + 0.25));
|
|
1497
|
+
numSum += Z[i] * (Y[i] - mean);
|
|
1498
|
+
denSum += Math.pow(Z[i], 2);
|
|
1499
|
+
}
|
|
1500
|
+
let RJ = numSum / Math.sqrt(variance * (N - 1) * denSum);
|
|
1501
|
+
return {
|
|
1502
|
+
RJ,
|
|
1503
|
+
critical: Distributions.Normal.RyanJoiner.Critical(data)
|
|
1504
|
+
};
|
|
1505
|
+
},
|
|
1506
|
+
Critical(data) {
|
|
1507
|
+
let N = data.length;
|
|
1508
|
+
return 1.0063 - 0.6118 / N + 1.3505 / Math.pow(N, 2) - 0.1288 / Math.pow(N, 0.5);
|
|
1509
|
+
}
|
|
1510
|
+
},
|
|
1511
|
+
JarqueBera(data) {
|
|
1512
|
+
let N = data.length;
|
|
1513
|
+
let S = Distributions.Normal.Skewness(data);
|
|
1514
|
+
let K = Distributions.Normal.Kurtosis(data);
|
|
1515
|
+
let JB = N / 6 * (Math.pow(S, 2) + 0.25 * Math.pow(K, 2));
|
|
1516
|
+
return {
|
|
1517
|
+
JB
|
|
1518
|
+
// p: Distributions.ChiSq.RightTail(JB, 2)
|
|
1519
|
+
};
|
|
1520
|
+
},
|
|
1521
|
+
Chebyshev(data, spec) {
|
|
1522
|
+
let mean = Mean(data);
|
|
1523
|
+
let standard_deviation = StDev.S(data);
|
|
1524
|
+
let AbsUSL = spec.USL - mean;
|
|
1525
|
+
let AbsLSL = mean - spec.LSL;
|
|
1526
|
+
let min;
|
|
1527
|
+
if (AbsUSL < AbsLSL) {
|
|
1528
|
+
min = AbsUSL;
|
|
1529
|
+
} else {
|
|
1530
|
+
min = AbsLSL;
|
|
1531
|
+
}
|
|
1532
|
+
return min / (10 * standard_deviation);
|
|
1533
|
+
},
|
|
1534
|
+
Skewness(data) {
|
|
1535
|
+
let N = data.length;
|
|
1536
|
+
let mean = Mean(data);
|
|
1537
|
+
let numsum = 0;
|
|
1538
|
+
let densum = 0;
|
|
1539
|
+
for (let i = 0; i < N; i++) {
|
|
1540
|
+
let inner = data[i] - mean;
|
|
1541
|
+
numsum += Math.pow(inner, 3);
|
|
1542
|
+
}
|
|
1543
|
+
let num = numsum * N;
|
|
1544
|
+
let den = (N - 2) * (N - 1) * Math.pow(StDev.S(data), 3);
|
|
1545
|
+
return num / den;
|
|
1546
|
+
},
|
|
1547
|
+
Kurtosis(data) {
|
|
1548
|
+
let N = data.length;
|
|
1549
|
+
let mean = Mean(data);
|
|
1550
|
+
let numsum = 0;
|
|
1551
|
+
let densum = 0;
|
|
1552
|
+
for (let i = 0; i < N; i++) {
|
|
1553
|
+
let inner = data[i] - mean;
|
|
1554
|
+
numsum += Math.pow(inner, 4);
|
|
1555
|
+
}
|
|
1556
|
+
let num = numsum * N * (N + 1) / ((N - 1) * (N - 2) * (N - 3) * Math.pow(StDev.S(data), 4)) - 3 * Math.pow(N - 1, 2) / ((N - 2) * (N - 3));
|
|
1557
|
+
return num;
|
|
1558
|
+
},
|
|
1559
|
+
KolmogorovSmirnov(data) {
|
|
1560
|
+
let N = data.length;
|
|
1561
|
+
data.sort();
|
|
1562
|
+
let mean = Mean(data);
|
|
1563
|
+
let std = StDev.S(data);
|
|
1564
|
+
let dMinusArray = [];
|
|
1565
|
+
let dPlusArray = [];
|
|
1566
|
+
for (let i = 1; i <= N; i++) {
|
|
1567
|
+
let Z_i = this.cdf(data[i - 1], mean, std);
|
|
1568
|
+
dPlusArray.push(i / N - Z_i);
|
|
1569
|
+
dMinusArray.push(Z_i - (i - 1) / N);
|
|
1570
|
+
}
|
|
1571
|
+
let KS = Math.max(Math.max(...dMinusArray), Math.max(...dPlusArray));
|
|
1572
|
+
let p = GoodnessOfFit.AndersonDarling.p(KS, N);
|
|
1573
|
+
return {
|
|
1574
|
+
KS,
|
|
1575
|
+
p
|
|
1576
|
+
};
|
|
1472
1577
|
}
|
|
1473
1578
|
},
|
|
1474
1579
|
T: {
|
package/dist/index.mjs
CHANGED
|
@@ -888,6 +888,17 @@ var Distributions = {
|
|
|
888
888
|
return Math.pow(x, a - 1) * Math.pow(1 - x, b - 1) / Beta.fn(a, b);
|
|
889
889
|
}
|
|
890
890
|
},
|
|
891
|
+
ChiSq: {
|
|
892
|
+
cdf(x, df) {
|
|
893
|
+
if (df === 2) {
|
|
894
|
+
return 1 - Math.exp(-x / 2);
|
|
895
|
+
}
|
|
896
|
+
return NaN;
|
|
897
|
+
},
|
|
898
|
+
RightTail(x, df) {
|
|
899
|
+
return 1 - Distributions.ChiSq.cdf(x, df);
|
|
900
|
+
}
|
|
901
|
+
},
|
|
891
902
|
Exponential: {
|
|
892
903
|
/**
|
|
893
904
|
* Cumulative Distribution Function. Calculates the probability of a random variable with a value less than or equal to x occuring from the exponential distribution with the specified scale parameter and optional threshold parameter.
|
|
@@ -1382,6 +1393,100 @@ var Distributions = {
|
|
|
1382
1393
|
*/
|
|
1383
1394
|
pdf(x, location = 0, scale = 1) {
|
|
1384
1395
|
return 1 / (scale * Math.sqrt(2 * Math.PI)) * Math.exp(-0.5 * Math.pow((x - location) / scale, 2));
|
|
1396
|
+
},
|
|
1397
|
+
RyanJoiner: {
|
|
1398
|
+
Test(data) {
|
|
1399
|
+
let N = data.length;
|
|
1400
|
+
let Z = [];
|
|
1401
|
+
let Y = data.sort(function(a, b) {
|
|
1402
|
+
return a - b;
|
|
1403
|
+
});
|
|
1404
|
+
let numSum = 0;
|
|
1405
|
+
let denSum = 0;
|
|
1406
|
+
let mean = Mean(data);
|
|
1407
|
+
let variance = Math.pow(StDev.S(data), 2);
|
|
1408
|
+
for (let i = 0; i < N; i++) {
|
|
1409
|
+
Z[i] = Distributions.Normal.inv((i + 1 - 0.375) / (N + 0.25));
|
|
1410
|
+
numSum += Z[i] * (Y[i] - mean);
|
|
1411
|
+
denSum += Math.pow(Z[i], 2);
|
|
1412
|
+
}
|
|
1413
|
+
let RJ = numSum / Math.sqrt(variance * (N - 1) * denSum);
|
|
1414
|
+
return {
|
|
1415
|
+
RJ,
|
|
1416
|
+
critical: Distributions.Normal.RyanJoiner.Critical(data)
|
|
1417
|
+
};
|
|
1418
|
+
},
|
|
1419
|
+
Critical(data) {
|
|
1420
|
+
let N = data.length;
|
|
1421
|
+
return 1.0063 - 0.6118 / N + 1.3505 / Math.pow(N, 2) - 0.1288 / Math.pow(N, 0.5);
|
|
1422
|
+
}
|
|
1423
|
+
},
|
|
1424
|
+
JarqueBera(data) {
|
|
1425
|
+
let N = data.length;
|
|
1426
|
+
let S = Distributions.Normal.Skewness(data);
|
|
1427
|
+
let K = Distributions.Normal.Kurtosis(data);
|
|
1428
|
+
let JB = N / 6 * (Math.pow(S, 2) + 0.25 * Math.pow(K, 2));
|
|
1429
|
+
return {
|
|
1430
|
+
JB
|
|
1431
|
+
// p: Distributions.ChiSq.RightTail(JB, 2)
|
|
1432
|
+
};
|
|
1433
|
+
},
|
|
1434
|
+
Chebyshev(data, spec) {
|
|
1435
|
+
let mean = Mean(data);
|
|
1436
|
+
let standard_deviation = StDev.S(data);
|
|
1437
|
+
let AbsUSL = spec.USL - mean;
|
|
1438
|
+
let AbsLSL = mean - spec.LSL;
|
|
1439
|
+
let min;
|
|
1440
|
+
if (AbsUSL < AbsLSL) {
|
|
1441
|
+
min = AbsUSL;
|
|
1442
|
+
} else {
|
|
1443
|
+
min = AbsLSL;
|
|
1444
|
+
}
|
|
1445
|
+
return min / (10 * standard_deviation);
|
|
1446
|
+
},
|
|
1447
|
+
Skewness(data) {
|
|
1448
|
+
let N = data.length;
|
|
1449
|
+
let mean = Mean(data);
|
|
1450
|
+
let numsum = 0;
|
|
1451
|
+
let densum = 0;
|
|
1452
|
+
for (let i = 0; i < N; i++) {
|
|
1453
|
+
let inner = data[i] - mean;
|
|
1454
|
+
numsum += Math.pow(inner, 3);
|
|
1455
|
+
}
|
|
1456
|
+
let num = numsum * N;
|
|
1457
|
+
let den = (N - 2) * (N - 1) * Math.pow(StDev.S(data), 3);
|
|
1458
|
+
return num / den;
|
|
1459
|
+
},
|
|
1460
|
+
Kurtosis(data) {
|
|
1461
|
+
let N = data.length;
|
|
1462
|
+
let mean = Mean(data);
|
|
1463
|
+
let numsum = 0;
|
|
1464
|
+
let densum = 0;
|
|
1465
|
+
for (let i = 0; i < N; i++) {
|
|
1466
|
+
let inner = data[i] - mean;
|
|
1467
|
+
numsum += Math.pow(inner, 4);
|
|
1468
|
+
}
|
|
1469
|
+
let num = numsum * N * (N + 1) / ((N - 1) * (N - 2) * (N - 3) * Math.pow(StDev.S(data), 4)) - 3 * Math.pow(N - 1, 2) / ((N - 2) * (N - 3));
|
|
1470
|
+
return num;
|
|
1471
|
+
},
|
|
1472
|
+
KolmogorovSmirnov(data) {
|
|
1473
|
+
let N = data.length;
|
|
1474
|
+
data.sort();
|
|
1475
|
+
let mean = Mean(data);
|
|
1476
|
+
let std = StDev.S(data);
|
|
1477
|
+
let dMinusArray = [];
|
|
1478
|
+
let dPlusArray = [];
|
|
1479
|
+
for (let i = 1; i <= N; i++) {
|
|
1480
|
+
let Z_i = this.cdf(data[i - 1], mean, std);
|
|
1481
|
+
dPlusArray.push(i / N - Z_i);
|
|
1482
|
+
dMinusArray.push(Z_i - (i - 1) / N);
|
|
1483
|
+
}
|
|
1484
|
+
let KS = Math.max(Math.max(...dMinusArray), Math.max(...dPlusArray));
|
|
1485
|
+
let p = GoodnessOfFit.AndersonDarling.p(KS, N);
|
|
1486
|
+
return {
|
|
1487
|
+
KS,
|
|
1488
|
+
p
|
|
1489
|
+
};
|
|
1385
1490
|
}
|
|
1386
1491
|
},
|
|
1387
1492
|
T: {
|
package/index.ts
CHANGED
|
@@ -1054,7 +1054,18 @@ export const Distributions = {
|
|
|
1054
1054
|
pdf(x: number, a: number, b: number){
|
|
1055
1055
|
return (Math.pow(x, a - 1) * Math.pow(1 - x, b - 1))/Beta.fn(a, b);
|
|
1056
1056
|
}
|
|
1057
|
-
},
|
|
1057
|
+
},
|
|
1058
|
+
ChiSq: {
|
|
1059
|
+
cdf(x: number, df: number){
|
|
1060
|
+
if(df === 2){
|
|
1061
|
+
return 1 - Math.exp(-x/2);
|
|
1062
|
+
}
|
|
1063
|
+
return NaN
|
|
1064
|
+
},
|
|
1065
|
+
RightTail(x: number, df: number){
|
|
1066
|
+
return 1 - Distributions.ChiSq.cdf(x, df);
|
|
1067
|
+
}
|
|
1068
|
+
},
|
|
1058
1069
|
Exponential: {
|
|
1059
1070
|
/**
|
|
1060
1071
|
* Cumulative Distribution Function. Calculates the probability of a random variable with a value less than or equal to x occuring from the exponential distribution with the specified scale parameter and optional threshold parameter.
|
|
@@ -1546,8 +1557,107 @@ export const Distributions = {
|
|
|
1546
1557
|
*/
|
|
1547
1558
|
pdf(x: number, location: number = 0, scale: number = 1) {
|
|
1548
1559
|
return (1 / (scale * Math.sqrt(2 * Math.PI))) * Math.exp(-.5 * Math.pow((x - location) / scale, 2))
|
|
1560
|
+
},
|
|
1561
|
+
RyanJoiner: {
|
|
1562
|
+
Test(data: number[]){
|
|
1563
|
+
let N = data.length;
|
|
1564
|
+
|
|
1565
|
+
let Z: number[] = [];
|
|
1566
|
+
let Y = data.sort(function (a, b){return a-b});
|
|
1567
|
+
let numSum = 0;
|
|
1568
|
+
let denSum = 0;
|
|
1569
|
+
let mean = Mean(data);
|
|
1570
|
+
let variance = Math.pow(StDev.S(data), 2);
|
|
1571
|
+
|
|
1572
|
+
for(let i = 0; i < N; i++){
|
|
1573
|
+
Z[i] = Distributions.Normal.inv((i + 1 - 0.375)/ (N + 0.25))
|
|
1574
|
+
numSum += Z[i]*(Y[i]-mean);
|
|
1575
|
+
denSum += Math.pow(Z[i], 2);
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
let RJ = numSum/Math.sqrt(variance*(N-1)*denSum);
|
|
1579
|
+
return {
|
|
1580
|
+
RJ: RJ,
|
|
1581
|
+
critical: Distributions.Normal.RyanJoiner.Critical(data)
|
|
1582
|
+
}
|
|
1583
|
+
},
|
|
1584
|
+
Critical(data: number[]){
|
|
1585
|
+
let N = data.length;
|
|
1586
|
+
return 1.0063-(0.6118/N)+(1.3505/Math.pow(N, 2))-(.1288/Math.pow(N, .5))
|
|
1587
|
+
}
|
|
1588
|
+
},
|
|
1589
|
+
JarqueBera(data: number[]){
|
|
1590
|
+
let N = data.length;
|
|
1591
|
+
let S = Distributions.Normal.Skewness(data);
|
|
1592
|
+
let K = Distributions.Normal.Kurtosis(data);
|
|
1593
|
+
|
|
1594
|
+
let JB = (N/6)*(Math.pow(S, 2) + .25 * Math.pow(K, 2));
|
|
1595
|
+
return {
|
|
1596
|
+
JB: JB,
|
|
1597
|
+
// p: Distributions.ChiSq.RightTail(JB, 2)
|
|
1598
|
+
}
|
|
1599
|
+
},
|
|
1600
|
+
Chebyshev(data: number[], spec: Specification){
|
|
1601
|
+
let mean = Mean(data);
|
|
1602
|
+
let standard_deviation =StDev.S(data);
|
|
1603
|
+
let AbsUSL = spec.USL - mean;
|
|
1604
|
+
let AbsLSL = mean - spec.LSL;
|
|
1605
|
+
let min;
|
|
1606
|
+
if(AbsUSL < AbsLSL){
|
|
1607
|
+
min = AbsUSL;
|
|
1608
|
+
}else{
|
|
1609
|
+
min = AbsLSL;
|
|
1610
|
+
}
|
|
1611
|
+
return min/(10*standard_deviation);
|
|
1612
|
+
},
|
|
1613
|
+
Skewness(data){
|
|
1614
|
+
// SRC: https://www.omnicalculator.com/statistics/skewness#what-are-skewness-and-kurtosis
|
|
1615
|
+
let N = data.length;
|
|
1616
|
+
let mean = Mean(data);
|
|
1617
|
+
let numsum = 0;
|
|
1618
|
+
let densum = 0;
|
|
1619
|
+
for(let i = 0; i < N; i++){
|
|
1620
|
+
let inner = data[i] - mean;
|
|
1621
|
+
numsum += Math.pow(inner, 3);
|
|
1622
|
+
}
|
|
1623
|
+
let num = numsum * N;
|
|
1624
|
+
let den = (N - 2) * (N - 1) * Math.pow(StDev.S(data),3)
|
|
1625
|
+
return num/den;
|
|
1626
|
+
},
|
|
1627
|
+
Kurtosis(data){
|
|
1628
|
+
// SRC: https://www.omnicalculator.com/statistics/skewness#what-are-skewness-and-kurtosis
|
|
1629
|
+
let N = data.length;
|
|
1630
|
+
let mean = Mean(data);
|
|
1631
|
+
let numsum = 0;
|
|
1632
|
+
let densum = 0;
|
|
1633
|
+
for (let i = 0; i < N; i++) {
|
|
1634
|
+
let inner = data[i] - mean;
|
|
1635
|
+
numsum += Math.pow(inner, 4);
|
|
1636
|
+
}
|
|
1637
|
+
let num = numsum * N * (N + 1) / ((N - 1) * (N - 2) * (N - 3) * Math.pow(StDev.S(data), 4)) - 3 * Math.pow(N - 1, 2) / ((N-2) * (N-3));
|
|
1638
|
+
return num;
|
|
1639
|
+
},
|
|
1640
|
+
KolmogorovSmirnov(data){
|
|
1641
|
+
let N = data.length;
|
|
1642
|
+
data.sort();
|
|
1643
|
+
let mean = Mean(data);
|
|
1644
|
+
let std = StDev.S(data);
|
|
1645
|
+
let dMinusArray: number[] = [];
|
|
1646
|
+
let dPlusArray: number[] = [];
|
|
1647
|
+
for(let i = 1; i <= N; i++){
|
|
1648
|
+
let Z_i = this.cdf(data[i-1], mean, std)
|
|
1649
|
+
dPlusArray.push((i/N)-Z_i);
|
|
1650
|
+
dMinusArray.push(Z_i-(i-1)/N);
|
|
1651
|
+
|
|
1652
|
+
}
|
|
1653
|
+
let KS = Math.max(Math.max(...dMinusArray),Math.max(...dPlusArray));
|
|
1654
|
+
let p = GoodnessOfFit.AndersonDarling.p(KS, N);
|
|
1655
|
+
return {
|
|
1656
|
+
KS: KS,
|
|
1657
|
+
p: p
|
|
1658
|
+
};
|
|
1549
1659
|
}
|
|
1550
|
-
|
|
1660
|
+
},
|
|
1551
1661
|
T: {
|
|
1552
1662
|
/**
|
|
1553
1663
|
* Cumulative Distribution Function. Calculates the probability of a random variable with a value less than or equal to x occuring from the T distribution with the specified degrees of freedom. (LEFT TAILED T-TEST)
|
package/package.json
CHANGED