qesuite 1.0.41 → 1.0.43

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 CHANGED
@@ -606,9 +606,11 @@ declare const Distributions: {
606
606
  Lilliefors: {
607
607
  Test(data: number[]): {
608
608
  KS: number;
609
- p: number;
609
+ p: void;
610
610
  };
611
- p(KS: number, N: number): number;
611
+ p(KS: number, N: number): void;
612
+ pApprox(KS: number, N: number): number;
613
+ pChart(KS: number, N: number): number | "<0.01";
612
614
  };
613
615
  RyanJoiner: {
614
616
  Test(data: number[]): {
@@ -791,8 +793,6 @@ declare function IndividualDistributionPlots(data: number[]): {
791
793
  boxCox: HTMLCanvasElement;
792
794
  exponential: HTMLCanvasElement;
793
795
  exponential2p: HTMLCanvasElement;
794
- gamma: HTMLCanvasElement;
795
- gamma3p: HTMLCanvasElement;
796
796
  largestExtremeValue: HTMLCanvasElement;
797
797
  logistic: HTMLCanvasElement;
798
798
  loglogistic: HTMLCanvasElement;
package/dist/index.d.ts CHANGED
@@ -606,9 +606,11 @@ declare const Distributions: {
606
606
  Lilliefors: {
607
607
  Test(data: number[]): {
608
608
  KS: number;
609
- p: number;
609
+ p: void;
610
610
  };
611
- p(KS: number, N: number): number;
611
+ p(KS: number, N: number): void;
612
+ pApprox(KS: number, N: number): number;
613
+ pChart(KS: number, N: number): number | "<0.01";
612
614
  };
613
615
  RyanJoiner: {
614
616
  Test(data: number[]): {
@@ -791,8 +793,6 @@ declare function IndividualDistributionPlots(data: number[]): {
791
793
  boxCox: HTMLCanvasElement;
792
794
  exponential: HTMLCanvasElement;
793
795
  exponential2p: HTMLCanvasElement;
794
- gamma: HTMLCanvasElement;
795
- gamma3p: HTMLCanvasElement;
796
796
  largestExtremeValue: HTMLCanvasElement;
797
797
  logistic: HTMLCanvasElement;
798
798
  loglogistic: HTMLCanvasElement;
package/dist/index.js CHANGED
@@ -1566,6 +1566,19 @@ var Distributions = {
1566
1566
  };
1567
1567
  },
1568
1568
  p(KS, N) {
1569
+ let p = Distributions.Normal.Lilliefors.pChart(KS, N);
1570
+ if (p === 1) {
1571
+ p = Distributions.Normal.Lilliefors.pApprox(KS, N);
1572
+ }
1573
+ },
1574
+ pApprox(KS, N) {
1575
+ let b0 = 0.37872256037043;
1576
+ let b1 = 1.3074818507879;
1577
+ let b2 = 0.08861783849346;
1578
+ let A = -(b1 + N) + Math.sqrt(Math.pow(b1 + N, 2) - 4 * b2 * (b0 - Math.pow(KS, -2)));
1579
+ return -0.37782822932809 + 1.67819837908004 * A - 3.02959249450445 * Math.pow(A, 2) + 2.80015798142101 * Math.pow(A, 3) - 1.39874347510845 * Math.pow(A, 4) + 0.40466213484419 * Math.pow(A, 5) - 0.06353440854207 * Math.pow(A, 6) + 0.00287462087623 * Math.pow(A, 7) + 6965001311e-13 * Math.pow(A, 8) - 11872227037e-14 * Math.pow(A, 9) + 575586834e-14 * Math.pow(A, 10);
1580
+ },
1581
+ pChart(KS, N) {
1569
1582
  let pSelections = [];
1570
1583
  let pChart = [
1571
1584
  [0.3027, 0.3216, 0.3456, 0.3754, 0.4129],
@@ -1631,9 +1644,9 @@ var Distributions = {
1631
1644
  if (selectedValue === 0) {
1632
1645
  return 1;
1633
1646
  }
1634
- ;
1635
1647
  if (selectedValue === 5) {
1636
- return 0;
1648
+ console.log("KS too LOW");
1649
+ return "<0.01";
1637
1650
  }
1638
1651
  ;
1639
1652
  let p1 = pValues[selectedValue - 1];
@@ -2279,8 +2292,8 @@ function IndividualDistributionPlots(data) {
2279
2292
  boxCox: QQPlotChart(boxCoxData, "Normal BoxCox"),
2280
2293
  exponential: QQPlotChart(data, "Exponential"),
2281
2294
  exponential2p: QQPlotChart(data, "2-Parameter Exponential"),
2282
- gamma: QQPlotChart(data, "Gamma"),
2283
- gamma3p: QQPlotChart(data, "3-Parameter Gamma"),
2295
+ // gamma: QQPlotChart(data, 'Gamma'),
2296
+ // gamma3p: QQPlotChart(data, '3-Parameter Gamma'),
2284
2297
  largestExtremeValue: QQPlotChart(data, "Largest Extreme Value"),
2285
2298
  logistic: QQPlotChart(data, "Logistic"),
2286
2299
  loglogistic: QQPlotChart(data, "2-Parameter LogLogistic"),
@@ -2295,7 +2308,9 @@ function IndividualDistributionPlots(data) {
2295
2308
  }
2296
2309
  var QQPlot = {
2297
2310
  p(data, method = "Hazen") {
2298
- let orderedData = [...data].sort();
2311
+ let orderedData = [...data].sort(function(a, b) {
2312
+ return a - b;
2313
+ });
2299
2314
  let PValues = [];
2300
2315
  let N = orderedData.length;
2301
2316
  for (let i = 1; i <= N; i++) {
@@ -3582,8 +3597,6 @@ function QQPlotChart(data, distribution = "Normal") {
3582
3597
  let dataset = new DataSet(qqData[0].map((d, i) => {
3583
3598
  return new Point(QQDistributionModificationX(d, distribution, data), QQDistributionModification(qqData[1][i], distribution));
3584
3599
  }), "Data", new CanvasDrawSettings(GetThemeColor(0), GetThemeColor(0), 1, 0, 10));
3585
- let mean = Mean(data);
3586
- let std = StDev.S(data);
3587
3600
  let chartSettings = new ChartSettings();
3588
3601
  let customGridlines = [
3589
3602
  new CustomGridline(QQDistributionModification(0.999, distribution), "99.9", void 0, new EngFont("black", void 0, "22px")),
package/dist/index.mjs CHANGED
@@ -1479,6 +1479,19 @@ var Distributions = {
1479
1479
  };
1480
1480
  },
1481
1481
  p(KS, N) {
1482
+ let p = Distributions.Normal.Lilliefors.pChart(KS, N);
1483
+ if (p === 1) {
1484
+ p = Distributions.Normal.Lilliefors.pApprox(KS, N);
1485
+ }
1486
+ },
1487
+ pApprox(KS, N) {
1488
+ let b0 = 0.37872256037043;
1489
+ let b1 = 1.3074818507879;
1490
+ let b2 = 0.08861783849346;
1491
+ let A = -(b1 + N) + Math.sqrt(Math.pow(b1 + N, 2) - 4 * b2 * (b0 - Math.pow(KS, -2)));
1492
+ return -0.37782822932809 + 1.67819837908004 * A - 3.02959249450445 * Math.pow(A, 2) + 2.80015798142101 * Math.pow(A, 3) - 1.39874347510845 * Math.pow(A, 4) + 0.40466213484419 * Math.pow(A, 5) - 0.06353440854207 * Math.pow(A, 6) + 0.00287462087623 * Math.pow(A, 7) + 6965001311e-13 * Math.pow(A, 8) - 11872227037e-14 * Math.pow(A, 9) + 575586834e-14 * Math.pow(A, 10);
1493
+ },
1494
+ pChart(KS, N) {
1482
1495
  let pSelections = [];
1483
1496
  let pChart = [
1484
1497
  [0.3027, 0.3216, 0.3456, 0.3754, 0.4129],
@@ -1544,9 +1557,9 @@ var Distributions = {
1544
1557
  if (selectedValue === 0) {
1545
1558
  return 1;
1546
1559
  }
1547
- ;
1548
1560
  if (selectedValue === 5) {
1549
- return 0;
1561
+ console.log("KS too LOW");
1562
+ return "<0.01";
1550
1563
  }
1551
1564
  ;
1552
1565
  let p1 = pValues[selectedValue - 1];
@@ -2192,8 +2205,8 @@ function IndividualDistributionPlots(data) {
2192
2205
  boxCox: QQPlotChart(boxCoxData, "Normal BoxCox"),
2193
2206
  exponential: QQPlotChart(data, "Exponential"),
2194
2207
  exponential2p: QQPlotChart(data, "2-Parameter Exponential"),
2195
- gamma: QQPlotChart(data, "Gamma"),
2196
- gamma3p: QQPlotChart(data, "3-Parameter Gamma"),
2208
+ // gamma: QQPlotChart(data, 'Gamma'),
2209
+ // gamma3p: QQPlotChart(data, '3-Parameter Gamma'),
2197
2210
  largestExtremeValue: QQPlotChart(data, "Largest Extreme Value"),
2198
2211
  logistic: QQPlotChart(data, "Logistic"),
2199
2212
  loglogistic: QQPlotChart(data, "2-Parameter LogLogistic"),
@@ -2208,7 +2221,9 @@ function IndividualDistributionPlots(data) {
2208
2221
  }
2209
2222
  var QQPlot = {
2210
2223
  p(data, method = "Hazen") {
2211
- let orderedData = [...data].sort();
2224
+ let orderedData = [...data].sort(function(a, b) {
2225
+ return a - b;
2226
+ });
2212
2227
  let PValues = [];
2213
2228
  let N = orderedData.length;
2214
2229
  for (let i = 1; i <= N; i++) {
@@ -3495,8 +3510,6 @@ function QQPlotChart(data, distribution = "Normal") {
3495
3510
  let dataset = new DataSet(qqData[0].map((d, i) => {
3496
3511
  return new Point(QQDistributionModificationX(d, distribution, data), QQDistributionModification(qqData[1][i], distribution));
3497
3512
  }), "Data", new CanvasDrawSettings(GetThemeColor(0), GetThemeColor(0), 1, 0, 10));
3498
- let mean = Mean(data);
3499
- let std = StDev.S(data);
3500
3513
  let chartSettings = new ChartSettings();
3501
3514
  let customGridlines = [
3502
3515
  new CustomGridline(QQDistributionModification(0.999, distribution), "99.9", void 0, new EngFont("black", void 0, "22px")),
package/index.ts CHANGED
@@ -1648,6 +1648,19 @@ export const Distributions = {
1648
1648
  }
1649
1649
  },
1650
1650
  p(KS: number, N: number){
1651
+ let p = Distributions.Normal.Lilliefors.pChart(KS, N);
1652
+ if(p === 1){
1653
+ p = Distributions.Normal.Lilliefors.pApprox(KS, N)
1654
+ }
1655
+ },
1656
+ pApprox(KS: number, N: number){
1657
+ let b0 = 0.37872256037043;
1658
+ let b1 = 1.30748185078790;
1659
+ let b2 = 0.08861783849346;
1660
+ let A = (-(b1+N)+Math.sqrt(Math.pow(b1+N, 2)-4*b2*(b0-Math.pow(KS, -2))))
1661
+ return -.37782822932809+1.67819837908004*A-3.02959249450445*Math.pow(A,2)+2.80015798142101*Math.pow(A,3)-1.39874347510845*Math.pow(A,4)+0.40466213484419*Math.pow(A,5)-0.06353440854207*Math.pow(A,6) +0.00287462087623*Math.pow(A,7)+0.00069650013110*Math.pow(A,8)-0.00011872227037*Math.pow(A,9)+0.00000575586834*Math.pow(A,10)
1662
+ },
1663
+ pChart(KS: number, N: number){
1651
1664
  let pSelections: number[] = [];
1652
1665
  let pChart = [
1653
1666
  [0.3027,0.3216,0.3456,0.3754,0.4129],
@@ -1710,8 +1723,13 @@ export const Distributions = {
1710
1723
  selectedValue += 1
1711
1724
  }
1712
1725
  })
1713
- if(selectedValue === 0){return 1};
1714
- if(selectedValue === 5){return 0};
1726
+ if(selectedValue === 0){
1727
+ return 1
1728
+ }
1729
+ if(selectedValue === 5){
1730
+ console.log("KS too LOW")
1731
+ return "<0.01"
1732
+ };
1715
1733
  let p1 = pValues[selectedValue-1];
1716
1734
  let p2 = pValues[selectedValue];
1717
1735
  let KS1 = pSelections[selectedValue-1];
@@ -2466,8 +2484,8 @@ export function IndividualDistributionPlots(data: number[]){
2466
2484
  boxCox: QQPlotChart(boxCoxData, "Normal BoxCox"),
2467
2485
  exponential: QQPlotChart(data, 'Exponential'),
2468
2486
  exponential2p: QQPlotChart(data, '2-Parameter Exponential'),
2469
- gamma: QQPlotChart(data, 'Gamma'),
2470
- gamma3p: QQPlotChart(data, '3-Parameter Gamma'),
2487
+ // gamma: QQPlotChart(data, 'Gamma'),
2488
+ // gamma3p: QQPlotChart(data, '3-Parameter Gamma'),
2471
2489
  largestExtremeValue: QQPlotChart(data, 'Largest Extreme Value'),
2472
2490
  logistic: QQPlotChart(data, 'Logistic'),
2473
2491
  loglogistic: QQPlotChart(data, '2-Parameter LogLogistic'),
@@ -2484,7 +2502,7 @@ export function IndividualDistributionPlots(data: number[]){
2484
2502
 
2485
2503
  export const QQPlot = {
2486
2504
  p(data: number[], method: string = 'Hazen'){
2487
- let orderedData = [...data].sort();
2505
+ let orderedData = [...data].sort(function(a,b){return a-b});
2488
2506
  let PValues: number[] = [];
2489
2507
  let N = orderedData.length
2490
2508
  for(let i = 1; i <= N; i++){
@@ -3373,6 +3391,7 @@ function PlotPoint(ctx: any, value: Point, dataSetDisplay: CanvasDrawSettings, c
3373
3391
 
3374
3392
  let x = ConvertToCanvasPt(value.x, chartSettings.axis.x.min, chartSettings.axis.x.max, chartSettings.width - chartSettings.margins.left - chartSettings.margins.right - padding.left - padding.right, chartSettings.axis.x);
3375
3393
  let y = ConvertToCanvasPt(value.y, chartSettings.axis.y.max, chartSettings.axis.y.min, chartSettings.height - chartSettings.margins.top - chartSettings.margins.bottom - padding.top - padding.bottom, chartSettings.axis.y);
3394
+
3376
3395
  if(y >= 0 && y <= chartSettings.height - chartSettings.margins.bottom - chartSettings.margins.top && x >= 0 && x <= chartSettings.width - chartSettings.margins.right - chartSettings.margins.left){
3377
3396
  DrawPolygon(ctx, shape, x + chartSettings.margins.left + padding.left, y + chartSettings.margins.top + padding.top, shapeRadius);
3378
3397
  }
@@ -4075,8 +4094,6 @@ export function QQPlotChart(data: number[], distribution: string = 'Normal'){
4075
4094
  let qqData = QQPlot.p([...data]);
4076
4095
 
4077
4096
  let dataset = new DataSet(qqData[0].map((d, i) => {return new Point(QQDistributionModificationX(d, distribution, data), QQDistributionModification(qqData[1][i], distribution))}), 'Data', new CanvasDrawSettings(GetThemeColor(0), GetThemeColor(0), 1, 0, 10));
4078
- let mean = Mean(data);
4079
- let std = StDev.S(data);
4080
4097
 
4081
4098
  // Create Chart Settings
4082
4099
  let chartSettings = new ChartSettings();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qesuite",
3
- "version": "1.0.41",
3
+ "version": "1.0.43",
4
4
  "description": "Performs advanced statistical analysis of data. Specifically designed for engineering statistical analysis",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -0,0 +1,3 @@
1
+ - Added approximation method for evaluating p-value in Lilliefors test
2
+
3
+ - take a look at distribution identification make sure only graphs that are supported with AD and MLE are generated.
@@ -0,0 +1,2 @@
1
+ - separated both methods of p-value calculation in Lilliefors test.
2
+ - fixed bug in QQPlot that sorted negative values descending