qesuite 1.0.70 → 1.0.72

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
@@ -404,7 +404,7 @@ declare const Capability: {
404
404
  * @param spec The specification to evaluate the capability against.
405
405
  * @param title [OPTIONAL] Title of the chart. DEFAULT = Process Capability Six Pack Report
406
406
  */
407
- SixPack(data: number[], spec: Specification, title?: string): {
407
+ SixPack(data: number[], spec: Specification, title?: string, target?: number, subgroupSize?: number, confidenceInterval?: number, sides?: number, method?: string, w?: number, unbiasingConstant?: boolean): {
408
408
  charts: {
409
409
  IndividualValue: HTMLCanvasElement;
410
410
  CapabilityHistogram: HTMLCanvasElement;
@@ -475,8 +475,8 @@ declare const Capability: {
475
475
  declare function IndividualValuePlot(data: number[], title?: string, historicalMean?: number): HTMLCanvasElement;
476
476
  declare function MovingRangeChart(data: number[], title?: string, w?: number): HTMLCanvasElement;
477
477
  declare function LastObservationsChart(data: number[], N: number, title?: string): HTMLCanvasElement;
478
- declare function CreateCapabilityHistogram(data: number[], specification: Specification): HTMLCanvasElement;
479
- declare function CreateCapabilityPlot(data: number[], specification: Specification): HTMLCanvasElement;
478
+ declare function CreateCapabilityHistogram(data: number[], specification: Specification, target?: number, subgroupSize?: number, confidenceInterval?: number, sides?: number, method?: string, w?: number, UnbiasingConstant?: boolean): HTMLCanvasElement;
479
+ declare function CreateCapabilityPlot(data: number[], specification: Specification, target?: number, subgroupSize?: number, confidenceInterval?: number, sides?: number, method?: string, w?: number, UnbiasingConstant?: boolean): HTMLCanvasElement;
480
480
  /** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
481
481
  */
482
482
  declare function PlochhammerSymbol(x: any, n: any): number;
package/dist/index.d.ts CHANGED
@@ -404,7 +404,7 @@ declare const Capability: {
404
404
  * @param spec The specification to evaluate the capability against.
405
405
  * @param title [OPTIONAL] Title of the chart. DEFAULT = Process Capability Six Pack Report
406
406
  */
407
- SixPack(data: number[], spec: Specification, title?: string): {
407
+ SixPack(data: number[], spec: Specification, title?: string, target?: number, subgroupSize?: number, confidenceInterval?: number, sides?: number, method?: string, w?: number, unbiasingConstant?: boolean): {
408
408
  charts: {
409
409
  IndividualValue: HTMLCanvasElement;
410
410
  CapabilityHistogram: HTMLCanvasElement;
@@ -475,8 +475,8 @@ declare const Capability: {
475
475
  declare function IndividualValuePlot(data: number[], title?: string, historicalMean?: number): HTMLCanvasElement;
476
476
  declare function MovingRangeChart(data: number[], title?: string, w?: number): HTMLCanvasElement;
477
477
  declare function LastObservationsChart(data: number[], N: number, title?: string): HTMLCanvasElement;
478
- declare function CreateCapabilityHistogram(data: number[], specification: Specification): HTMLCanvasElement;
479
- declare function CreateCapabilityPlot(data: number[], specification: Specification): HTMLCanvasElement;
478
+ declare function CreateCapabilityHistogram(data: number[], specification: Specification, target?: number, subgroupSize?: number, confidenceInterval?: number, sides?: number, method?: string, w?: number, UnbiasingConstant?: boolean): HTMLCanvasElement;
479
+ declare function CreateCapabilityPlot(data: number[], specification: Specification, target?: number, subgroupSize?: number, confidenceInterval?: number, sides?: number, method?: string, w?: number, UnbiasingConstant?: boolean): HTMLCanvasElement;
480
480
  /** ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
481
481
  */
482
482
  declare function PlochhammerSymbol(x: any, n: any): number;
package/dist/index.js CHANGED
@@ -168,7 +168,7 @@ var Specification = class {
168
168
  full_tolerance;
169
169
  // methods
170
170
  ParseSpec(spec) {
171
- let string = spec.replace(/\,/g, ".").toUpperCase().replace(/MIN/g, ">").replace(/MAX/g, "<").replace(/\-\-/g, "\u2014");
171
+ let string = spec.replace(/\,/g, ".").toUpperCase().replace(/MIN/g, ">").replace(/MAX/g, "<").replace(/\-\-/g, "\u2014").replace("+-", "\xB1").replace("+/-", "\xB1");
172
172
  let nominal;
173
173
  let USL;
174
174
  let LSL;
@@ -1293,13 +1293,13 @@ var Capability = {
1293
1293
  * @param spec The specification to evaluate the capability against.
1294
1294
  * @param title [OPTIONAL] Title of the chart. DEFAULT = Process Capability Six Pack Report
1295
1295
  */
1296
- SixPack(data, spec, title) {
1296
+ SixPack(data, spec, title, target, subgroupSize, confidenceInterval, sides = -1, method, w, unbiasingConstant) {
1297
1297
  let individualValuePlot = IndividualValuePlot(data, "Individual Value");
1298
1298
  let movingRangeChart = MovingRangeChart(data, "Moving Range Chart");
1299
1299
  let normalProbabilityplot = QQPlotChart(data);
1300
1300
  let lastObservations = LastObservationsChart(data, 25, "Last 25 Observations");
1301
- let capabilityHistogram = CreateCapabilityHistogram(data, spec);
1302
- let capabilityPlot = CreateCapabilityPlot(data, spec);
1301
+ let capabilityHistogram = CreateCapabilityHistogram(data, spec, target, subgroupSize, confidenceInterval, sides, method, w, unbiasingConstant);
1302
+ let capabilityPlot = CreateCapabilityPlot(data, spec, target, subgroupSize, confidenceInterval, sides, method, w, unbiasingConstant);
1303
1303
  return {
1304
1304
  charts: {
1305
1305
  IndividualValue: individualValuePlot,
@@ -1316,7 +1316,6 @@ var Capability = {
1316
1316
  if (confidenceInterval == void 0) {
1317
1317
  sides = void 0;
1318
1318
  }
1319
- console.log(confidenceInterval, sides);
1320
1319
  let results = Capability.Analysis(data, spec, target, subgroupSize, confidenceInterval, sides, method, w, UnbiasingConstant2);
1321
1320
  let mean = Mean(data);
1322
1321
  let std = StDev.S(data);
@@ -1643,7 +1642,7 @@ function LastObservationsChart(data, N, title) {
1643
1642
  }));
1644
1643
  return CreateScatterPlot([dataset], title, chartSettings);
1645
1644
  }
1646
- function CreateCapabilityHistogram(data, specification) {
1645
+ function CreateCapabilityHistogram(data, specification, target, subgroupSize, confidenceInterval, sides = -1, method, w, UnbiasingConstant2) {
1647
1646
  let chartSettings = new ChartSettings();
1648
1647
  if (specification.LSL) {
1649
1648
  chartSettings.axis.x.customGridlines.push(new CustomGridline(specification.LSL, "LSL", new CanvasDrawSettings("maroon", "maroon", 3), new EngFont("maroon"), true, false, true));
@@ -1659,8 +1658,9 @@ function CreateCapabilityHistogram(data, specification) {
1659
1658
  let scaleFactor = Math.max(...histogramData.values.map((v) => {
1660
1659
  return v.y;
1661
1660
  })) / Distributions.Normal.pdf(0);
1661
+ let stdev_w = StDev.W(data, subgroupSize, method, w, UnbiasingConstant2);
1662
1662
  const withinFunction = (x) => {
1663
- return scaleFactor * Distributions.Normal.pdf((x - mean) / StDev.W(data));
1663
+ return scaleFactor * Distributions.Normal.pdf((x - mean) / stdev_w);
1664
1664
  };
1665
1665
  const overallFunction = (x) => {
1666
1666
  return scaleFactor * Distributions.Normal.pdf((x - mean) / std);
@@ -1682,8 +1682,8 @@ function CreateCapabilityHistogram(data, specification) {
1682
1682
  chartSettings.hasLegend = true;
1683
1683
  return CreateStackedChart([histogram, overall, within], "Capability Histogram", chartSettings);
1684
1684
  }
1685
- function CreateCapabilityPlot(data, specification) {
1686
- let capability = Capability.Analysis(data, specification);
1685
+ function CreateCapabilityPlot(data, specification, target, subgroupSize, confidenceInterval, sides = -1, method, w, UnbiasingConstant2) {
1686
+ let capability = Capability.Analysis(data, specification, target, subgroupSize, confidenceInterval, sides, method, w, UnbiasingConstant2);
1687
1687
  let chartSettings = new ChartSettings();
1688
1688
  chartSettings.width = 1300;
1689
1689
  let canvas = CreateCanvas(chartSettings.width, chartSettings.height);
@@ -1696,7 +1696,7 @@ function CreateCapabilityPlot(data, specification) {
1696
1696
  let withinInfo = [
1697
1697
  {
1698
1698
  key: "StDev",
1699
- value: StDev.W(data, 2)
1699
+ value: StDev.W(data, subgroupSize, method, w, UnbiasingConstant2)
1700
1700
  },
1701
1701
  {
1702
1702
  key: "Cp",
@@ -8785,6 +8785,9 @@ var StDev = {
8785
8785
  grouped[si].push(d);
8786
8786
  i += 1;
8787
8787
  });
8788
+ if (subgroup === 2 && data.length % 2) {
8789
+ method = "RBAR";
8790
+ }
8788
8791
  if (method.toUpperCase() == "RBAR") {
8789
8792
  let ranges = [];
8790
8793
  grouped.forEach((g) => {
package/dist/index.mjs CHANGED
@@ -42,7 +42,7 @@ var Specification = class {
42
42
  full_tolerance;
43
43
  // methods
44
44
  ParseSpec(spec) {
45
- let string = spec.replace(/\,/g, ".").toUpperCase().replace(/MIN/g, ">").replace(/MAX/g, "<").replace(/\-\-/g, "\u2014");
45
+ let string = spec.replace(/\,/g, ".").toUpperCase().replace(/MIN/g, ">").replace(/MAX/g, "<").replace(/\-\-/g, "\u2014").replace("+-", "\xB1").replace("+/-", "\xB1");
46
46
  let nominal;
47
47
  let USL;
48
48
  let LSL;
@@ -1167,13 +1167,13 @@ var Capability = {
1167
1167
  * @param spec The specification to evaluate the capability against.
1168
1168
  * @param title [OPTIONAL] Title of the chart. DEFAULT = Process Capability Six Pack Report
1169
1169
  */
1170
- SixPack(data, spec, title) {
1170
+ SixPack(data, spec, title, target, subgroupSize, confidenceInterval, sides = -1, method, w, unbiasingConstant) {
1171
1171
  let individualValuePlot = IndividualValuePlot(data, "Individual Value");
1172
1172
  let movingRangeChart = MovingRangeChart(data, "Moving Range Chart");
1173
1173
  let normalProbabilityplot = QQPlotChart(data);
1174
1174
  let lastObservations = LastObservationsChart(data, 25, "Last 25 Observations");
1175
- let capabilityHistogram = CreateCapabilityHistogram(data, spec);
1176
- let capabilityPlot = CreateCapabilityPlot(data, spec);
1175
+ let capabilityHistogram = CreateCapabilityHistogram(data, spec, target, subgroupSize, confidenceInterval, sides, method, w, unbiasingConstant);
1176
+ let capabilityPlot = CreateCapabilityPlot(data, spec, target, subgroupSize, confidenceInterval, sides, method, w, unbiasingConstant);
1177
1177
  return {
1178
1178
  charts: {
1179
1179
  IndividualValue: individualValuePlot,
@@ -1190,7 +1190,6 @@ var Capability = {
1190
1190
  if (confidenceInterval == void 0) {
1191
1191
  sides = void 0;
1192
1192
  }
1193
- console.log(confidenceInterval, sides);
1194
1193
  let results = Capability.Analysis(data, spec, target, subgroupSize, confidenceInterval, sides, method, w, UnbiasingConstant2);
1195
1194
  let mean = Mean(data);
1196
1195
  let std = StDev.S(data);
@@ -1517,7 +1516,7 @@ function LastObservationsChart(data, N, title) {
1517
1516
  }));
1518
1517
  return CreateScatterPlot([dataset], title, chartSettings);
1519
1518
  }
1520
- function CreateCapabilityHistogram(data, specification) {
1519
+ function CreateCapabilityHistogram(data, specification, target, subgroupSize, confidenceInterval, sides = -1, method, w, UnbiasingConstant2) {
1521
1520
  let chartSettings = new ChartSettings();
1522
1521
  if (specification.LSL) {
1523
1522
  chartSettings.axis.x.customGridlines.push(new CustomGridline(specification.LSL, "LSL", new CanvasDrawSettings("maroon", "maroon", 3), new EngFont("maroon"), true, false, true));
@@ -1533,8 +1532,9 @@ function CreateCapabilityHistogram(data, specification) {
1533
1532
  let scaleFactor = Math.max(...histogramData.values.map((v) => {
1534
1533
  return v.y;
1535
1534
  })) / Distributions.Normal.pdf(0);
1535
+ let stdev_w = StDev.W(data, subgroupSize, method, w, UnbiasingConstant2);
1536
1536
  const withinFunction = (x) => {
1537
- return scaleFactor * Distributions.Normal.pdf((x - mean) / StDev.W(data));
1537
+ return scaleFactor * Distributions.Normal.pdf((x - mean) / stdev_w);
1538
1538
  };
1539
1539
  const overallFunction = (x) => {
1540
1540
  return scaleFactor * Distributions.Normal.pdf((x - mean) / std);
@@ -1556,8 +1556,8 @@ function CreateCapabilityHistogram(data, specification) {
1556
1556
  chartSettings.hasLegend = true;
1557
1557
  return CreateStackedChart([histogram, overall, within], "Capability Histogram", chartSettings);
1558
1558
  }
1559
- function CreateCapabilityPlot(data, specification) {
1560
- let capability = Capability.Analysis(data, specification);
1559
+ function CreateCapabilityPlot(data, specification, target, subgroupSize, confidenceInterval, sides = -1, method, w, UnbiasingConstant2) {
1560
+ let capability = Capability.Analysis(data, specification, target, subgroupSize, confidenceInterval, sides, method, w, UnbiasingConstant2);
1561
1561
  let chartSettings = new ChartSettings();
1562
1562
  chartSettings.width = 1300;
1563
1563
  let canvas = CreateCanvas(chartSettings.width, chartSettings.height);
@@ -1570,7 +1570,7 @@ function CreateCapabilityPlot(data, specification) {
1570
1570
  let withinInfo = [
1571
1571
  {
1572
1572
  key: "StDev",
1573
- value: StDev.W(data, 2)
1573
+ value: StDev.W(data, subgroupSize, method, w, UnbiasingConstant2)
1574
1574
  },
1575
1575
  {
1576
1576
  key: "Cp",
@@ -8659,6 +8659,9 @@ var StDev = {
8659
8659
  grouped[si].push(d);
8660
8660
  i += 1;
8661
8661
  });
8662
+ if (subgroup === 2 && data.length % 2) {
8663
+ method = "RBAR";
8664
+ }
8662
8665
  if (method.toUpperCase() == "RBAR") {
8663
8666
  let ranges = [];
8664
8667
  grouped.forEach((g) => {
package/index.ts CHANGED
@@ -52,7 +52,7 @@ export class Specification{
52
52
  ParseSpec(spec: string) {
53
53
  // This function parses specs and returns an array of values, in this order:
54
54
  // Nominal, USL, LSL, Units, Tolerance(if UT and LT differ then {UT, LT})
55
- let string = spec.replace(/\,/g, ".").toUpperCase().replace(/MIN/g, ">").replace(/MAX/g, "<").replace(/\-\-/g,"—");
55
+ let string = spec.replace(/\,/g, ".").toUpperCase().replace(/MIN/g, ">").replace(/MAX/g, "<").replace(/\-\-/g,"—").replace("+-", "±").replace("+/-", "±");
56
56
  let nominal;
57
57
  let USL;
58
58
  let LSL;
@@ -1308,14 +1308,14 @@ PPU(data: number[], spec: Specification) {
1308
1308
  * @param spec The specification to evaluate the capability against.
1309
1309
  * @param title [OPTIONAL] Title of the chart. DEFAULT = Process Capability Six Pack Report
1310
1310
  */
1311
- SixPack(data: number[], spec: Specification, title?: string){
1311
+ SixPack(data: number[], spec: Specification, title?: string, target?: number, subgroupSize?: number, confidenceInterval?: number, sides: number = -1, method?: string, w?: number, unbiasingConstant?: boolean){
1312
1312
 
1313
1313
  let individualValuePlot = IndividualValuePlot(data, 'Individual Value');
1314
1314
  let movingRangeChart = MovingRangeChart(data, 'Moving Range Chart');
1315
1315
  let normalProbabilityplot = QQPlotChart(data);
1316
1316
  let lastObservations = LastObservationsChart(data, 25, 'Last 25 Observations');
1317
- let capabilityHistogram = CreateCapabilityHistogram(data, spec);
1318
- let capabilityPlot = CreateCapabilityPlot(data, spec);
1317
+ let capabilityHistogram = CreateCapabilityHistogram(data, spec, target, subgroupSize, confidenceInterval, sides, method, w, unbiasingConstant);
1318
+ let capabilityPlot = CreateCapabilityPlot(data, spec, target, subgroupSize, confidenceInterval, sides, method, w, unbiasingConstant);
1319
1319
 
1320
1320
  return {
1321
1321
  charts: {
@@ -1332,7 +1332,6 @@ SixPack(data: number[], spec: Specification, title?: string){
1332
1332
  },
1333
1333
  Report(data: number[], spec: Specification, target?: number, subgroupSize?: number, confidenceInterval?: number, sides: any = -1, method?: string, w?: number, UnbiasingConstant?: boolean){
1334
1334
  if(confidenceInterval == undefined){sides = undefined}
1335
- console.log(confidenceInterval, sides)
1336
1335
  let results: any = Capability.Analysis(data, spec, target, subgroupSize, confidenceInterval, sides, method, w, UnbiasingConstant);
1337
1336
  let mean = Mean(data);
1338
1337
  let std = StDev.S(data);
@@ -1708,7 +1707,7 @@ export function LastObservationsChart(data: number[], N: number, title?: string)
1708
1707
 
1709
1708
  }
1710
1709
 
1711
- export function CreateCapabilityHistogram(data: number[], specification: Specification){
1710
+ export function CreateCapabilityHistogram(data: number[], specification: Specification, target?: number, subgroupSize?: number, confidenceInterval?: number, sides: number = -1, method?: string, w?: number, UnbiasingConstant?: boolean){
1712
1711
  let chartSettings = new ChartSettings();
1713
1712
 
1714
1713
  if(specification.LSL){chartSettings.axis.x.customGridlines.push(new CustomGridline(specification.LSL, 'LSL', new CanvasDrawSettings('maroon', 'maroon', 3), new EngFont('maroon'), true, false, true))}
@@ -1726,7 +1725,8 @@ export function CreateCapabilityHistogram(data: number[], specification: Specifi
1726
1725
  // Scale normal distributions to match histogram
1727
1726
  let scaleFactor = Math.max(...histogramData.values.map(v => {return v.y}))/Distributions.Normal.pdf(0);
1728
1727
 
1729
- const withinFunction = (x: number) => {return scaleFactor * Distributions.Normal.pdf((x - mean) / StDev.W(data))}
1728
+ let stdev_w = StDev.W(data, subgroupSize, method, w, UnbiasingConstant);
1729
+ const withinFunction = (x: number) => {return scaleFactor * Distributions.Normal.pdf((x - mean) / stdev_w)}
1730
1730
  const overallFunction = (x: number) => {return scaleFactor * Distributions.Normal.pdf((x - mean) / std)}
1731
1731
 
1732
1732
  // Create overall curve data set
@@ -1753,9 +1753,9 @@ export function CreateCapabilityHistogram(data: number[], specification: Specifi
1753
1753
  return CreateStackedChart([histogram, overall, within], 'Capability Histogram', chartSettings)
1754
1754
  }
1755
1755
 
1756
- export function CreateCapabilityPlot(data: number[], specification: Specification){
1756
+ export function CreateCapabilityPlot(data: number[], specification: Specification, target?: number, subgroupSize?: number, confidenceInterval?: number, sides: number = -1, method?: string, w?: number, UnbiasingConstant?: boolean){
1757
1757
  // Calculate Capability Indices
1758
- let capability = Capability.Analysis(data, specification);
1758
+ let capability = Capability.Analysis(data, specification, target, subgroupSize, confidenceInterval, sides, method, w, UnbiasingConstant);
1759
1759
 
1760
1760
  // Create Chart
1761
1761
  let chartSettings = new ChartSettings();
@@ -1771,7 +1771,7 @@ export function CreateCapabilityPlot(data: number[], specification: Specificatio
1771
1771
  let withinInfo = [
1772
1772
  {
1773
1773
  key: "StDev",
1774
- value: StDev.W(data, 2)
1774
+ value: StDev.W(data, subgroupSize, method, w, UnbiasingConstant)
1775
1775
  },
1776
1776
  {
1777
1777
  key: "Cp",
@@ -9229,7 +9229,9 @@ export const StDev = {
9229
9229
  grouped[si].push(d);
9230
9230
  i += 1
9231
9231
  })
9232
-
9232
+ if(subgroup === 2 && data.length%2){
9233
+ method = "RBAR"
9234
+ }
9233
9235
  if(method.toUpperCase() == "RBAR"){
9234
9236
  // RBar Method
9235
9237
  let ranges:any = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qesuite",
3
- "version": "1.0.70",
3
+ "version": "1.0.72",
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 @@
1
+ - added a replacement of +- and +/- with ± on parse spec
@@ -0,0 +1,2 @@
1
+ - added within standard deviations options to Capability charts
2
+ - force to RBAR method if subgroup size === 2 && sample size is odd