qesuite 1.0.8 → 1.0.9
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 +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +131 -1
- package/dist/index.mjs +128 -1
- package/index.ts +80 -5
- package/package.json +1 -1
- package/versions/1_0_9.md +10 -0
package/dist/index.d.mts
CHANGED
|
@@ -668,6 +668,8 @@ declare const Distributions: {
|
|
|
668
668
|
};
|
|
669
669
|
};
|
|
670
670
|
};
|
|
671
|
+
declare function MLE(data: number[], distribution: string): any;
|
|
672
|
+
declare function ParameterizedCDF(data: number[], distribution: string): (x: number) => any;
|
|
671
673
|
declare const GoodnessOfFit: {
|
|
672
674
|
AndersonDarling: {
|
|
673
675
|
/**
|
|
@@ -687,11 +689,12 @@ declare const GoodnessOfFit: {
|
|
|
687
689
|
* @param data The data to evaluate.
|
|
688
690
|
* @param cdf The cumulative distribution function to evaluate the data against.
|
|
689
691
|
*/
|
|
690
|
-
Test(data: number[], cdf: Function): {
|
|
692
|
+
Test(data: number[], cdf: Function | String): {
|
|
691
693
|
AD: number;
|
|
692
694
|
p: any;
|
|
693
695
|
};
|
|
694
696
|
};
|
|
697
|
+
Distributions: string[];
|
|
695
698
|
KolmogorovSmirnov: {
|
|
696
699
|
/**
|
|
697
700
|
* Returns the KolmogorovSmirnov Critical Value for goodness of fit testing based on the specified sample size and the specified confidence.
|
|
@@ -1120,5 +1123,6 @@ declare function GRR_Graphs(data: any, tolerance: number, name?: string): {
|
|
|
1120
1123
|
};
|
|
1121
1124
|
declare function GRR_ByPartChart(data: GRR_Data): HTMLCanvasElement;
|
|
1122
1125
|
declare function GRR_PartxOperatorChart(data: GRR_Data): HTMLCanvasElement;
|
|
1126
|
+
declare function CompileGRRObject(operators: any, parts: any, measurements: any): GRR_Data;
|
|
1123
1127
|
|
|
1124
|
-
export { AnovaTableTwoWay, AverageMovingRange, Beta, CanvasDrawSettings, Capability, CreateBoxandWhiskerGraph, CreateCapabilityHistogram, CreateCategoricalBarGraph, CreateContinuousBarGraph, CreateScatterPlot, CreateSplitGraph, CreateStackedChart, CreateSummaryChart, Distributions, ERF, EngFont, FixedPointIteration, G1, G1_Graphs, GRR, GRR_ByPartChart, GRR_Data, GRR_Graphs, GRR_Operator, GRR_PartxOperatorChart, GRR_Replication, GageEvaluation, Gamma, GetFunctionValues, GetHistogramDataset, GoodnessOfFit, IndividualDistributionIdentification, IndividualDistributionPlots, IndividualValuePlot, LastObservationsChart, Margin, MarkOutOfControl, Mean, Median, MovingRange, MovingRangeChart, NewtonRaphson, ObjectToArray, Point, QEAxisSettings, QEChart, QEChartSettings, QECustomGridline, QEDataCollection, QEDataSet, QELine, QESpecification, QQPlot, QQPlotChart, Range, RoundTO, SerializeData, SixPack, StDev, Sum, UnbiasingConstant, VarianceComponents };
|
|
1128
|
+
export { AnovaTableTwoWay, AverageMovingRange, Beta, CanvasDrawSettings, Capability, CompileGRRObject, CreateBoxandWhiskerGraph, CreateCapabilityHistogram, CreateCategoricalBarGraph, CreateContinuousBarGraph, CreateScatterPlot, CreateSplitGraph, CreateStackedChart, CreateSummaryChart, Distributions, ERF, EngFont, FixedPointIteration, G1, G1_Graphs, GRR, GRR_ByPartChart, GRR_Data, GRR_Graphs, GRR_Operator, GRR_PartxOperatorChart, GRR_Replication, GageEvaluation, Gamma, GetFunctionValues, GetHistogramDataset, GoodnessOfFit, IndividualDistributionIdentification, IndividualDistributionPlots, IndividualValuePlot, LastObservationsChart, MLE, Margin, MarkOutOfControl, Mean, Median, MovingRange, MovingRangeChart, NewtonRaphson, ObjectToArray, ParameterizedCDF, Point, QEAxisSettings, QEChart, QEChartSettings, QECustomGridline, QEDataCollection, QEDataSet, QELine, QESpecification, QQPlot, QQPlotChart, Range, RoundTO, SerializeData, SixPack, StDev, Sum, UnbiasingConstant, VarianceComponents };
|
package/dist/index.d.ts
CHANGED
|
@@ -668,6 +668,8 @@ declare const Distributions: {
|
|
|
668
668
|
};
|
|
669
669
|
};
|
|
670
670
|
};
|
|
671
|
+
declare function MLE(data: number[], distribution: string): any;
|
|
672
|
+
declare function ParameterizedCDF(data: number[], distribution: string): (x: number) => any;
|
|
671
673
|
declare const GoodnessOfFit: {
|
|
672
674
|
AndersonDarling: {
|
|
673
675
|
/**
|
|
@@ -687,11 +689,12 @@ declare const GoodnessOfFit: {
|
|
|
687
689
|
* @param data The data to evaluate.
|
|
688
690
|
* @param cdf The cumulative distribution function to evaluate the data against.
|
|
689
691
|
*/
|
|
690
|
-
Test(data: number[], cdf: Function): {
|
|
692
|
+
Test(data: number[], cdf: Function | String): {
|
|
691
693
|
AD: number;
|
|
692
694
|
p: any;
|
|
693
695
|
};
|
|
694
696
|
};
|
|
697
|
+
Distributions: string[];
|
|
695
698
|
KolmogorovSmirnov: {
|
|
696
699
|
/**
|
|
697
700
|
* Returns the KolmogorovSmirnov Critical Value for goodness of fit testing based on the specified sample size and the specified confidence.
|
|
@@ -1120,5 +1123,6 @@ declare function GRR_Graphs(data: any, tolerance: number, name?: string): {
|
|
|
1120
1123
|
};
|
|
1121
1124
|
declare function GRR_ByPartChart(data: GRR_Data): HTMLCanvasElement;
|
|
1122
1125
|
declare function GRR_PartxOperatorChart(data: GRR_Data): HTMLCanvasElement;
|
|
1126
|
+
declare function CompileGRRObject(operators: any, parts: any, measurements: any): GRR_Data;
|
|
1123
1127
|
|
|
1124
|
-
export { AnovaTableTwoWay, AverageMovingRange, Beta, CanvasDrawSettings, Capability, CreateBoxandWhiskerGraph, CreateCapabilityHistogram, CreateCategoricalBarGraph, CreateContinuousBarGraph, CreateScatterPlot, CreateSplitGraph, CreateStackedChart, CreateSummaryChart, Distributions, ERF, EngFont, FixedPointIteration, G1, G1_Graphs, GRR, GRR_ByPartChart, GRR_Data, GRR_Graphs, GRR_Operator, GRR_PartxOperatorChart, GRR_Replication, GageEvaluation, Gamma, GetFunctionValues, GetHistogramDataset, GoodnessOfFit, IndividualDistributionIdentification, IndividualDistributionPlots, IndividualValuePlot, LastObservationsChart, Margin, MarkOutOfControl, Mean, Median, MovingRange, MovingRangeChart, NewtonRaphson, ObjectToArray, Point, QEAxisSettings, QEChart, QEChartSettings, QECustomGridline, QEDataCollection, QEDataSet, QELine, QESpecification, QQPlot, QQPlotChart, Range, RoundTO, SerializeData, SixPack, StDev, Sum, UnbiasingConstant, VarianceComponents };
|
|
1128
|
+
export { AnovaTableTwoWay, AverageMovingRange, Beta, CanvasDrawSettings, Capability, CompileGRRObject, CreateBoxandWhiskerGraph, CreateCapabilityHistogram, CreateCategoricalBarGraph, CreateContinuousBarGraph, CreateScatterPlot, CreateSplitGraph, CreateStackedChart, CreateSummaryChart, Distributions, ERF, EngFont, FixedPointIteration, G1, G1_Graphs, GRR, GRR_ByPartChart, GRR_Data, GRR_Graphs, GRR_Operator, GRR_PartxOperatorChart, GRR_Replication, GageEvaluation, Gamma, GetFunctionValues, GetHistogramDataset, GoodnessOfFit, IndividualDistributionIdentification, IndividualDistributionPlots, IndividualValuePlot, LastObservationsChart, MLE, Margin, MarkOutOfControl, Mean, Median, MovingRange, MovingRangeChart, NewtonRaphson, ObjectToArray, ParameterizedCDF, Point, QEAxisSettings, QEChart, QEChartSettings, QECustomGridline, QEDataCollection, QEDataSet, QELine, QESpecification, QQPlot, QQPlotChart, Range, RoundTO, SerializeData, SixPack, StDev, Sum, UnbiasingConstant, VarianceComponents };
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ __export(QESuite_exports, {
|
|
|
24
24
|
Beta: () => Beta,
|
|
25
25
|
CanvasDrawSettings: () => CanvasDrawSettings,
|
|
26
26
|
Capability: () => Capability,
|
|
27
|
+
CompileGRRObject: () => CompileGRRObject,
|
|
27
28
|
CreateBoxandWhiskerGraph: () => CreateBoxandWhiskerGraph,
|
|
28
29
|
CreateCapabilityHistogram: () => CreateCapabilityHistogram,
|
|
29
30
|
CreateCategoricalBarGraph: () => CreateCategoricalBarGraph,
|
|
@@ -54,6 +55,7 @@ __export(QESuite_exports, {
|
|
|
54
55
|
IndividualDistributionPlots: () => IndividualDistributionPlots,
|
|
55
56
|
IndividualValuePlot: () => IndividualValuePlot,
|
|
56
57
|
LastObservationsChart: () => LastObservationsChart,
|
|
58
|
+
MLE: () => MLE,
|
|
57
59
|
Margin: () => Margin,
|
|
58
60
|
MarkOutOfControl: () => MarkOutOfControl,
|
|
59
61
|
Mean: () => Mean,
|
|
@@ -62,6 +64,7 @@ __export(QESuite_exports, {
|
|
|
62
64
|
MovingRangeChart: () => MovingRangeChart,
|
|
63
65
|
NewtonRaphson: () => NewtonRaphson,
|
|
64
66
|
ObjectToArray: () => ObjectToArray,
|
|
67
|
+
ParameterizedCDF: () => ParameterizedCDF,
|
|
65
68
|
Point: () => Point,
|
|
66
69
|
QEAxisSettings: () => QEAxisSettings,
|
|
67
70
|
QEChart: () => QEChart,
|
|
@@ -1627,6 +1630,63 @@ var Distributions = {
|
|
|
1627
1630
|
}
|
|
1628
1631
|
}
|
|
1629
1632
|
};
|
|
1633
|
+
function MLE(data, distribution) {
|
|
1634
|
+
if (distribution === "Normal" || distribution.toLowerCase().includes("extreme") || distribution === "Logistic") {
|
|
1635
|
+
return Distributions[distribution].MLE(data);
|
|
1636
|
+
}
|
|
1637
|
+
if (distribution === "Exponential") {
|
|
1638
|
+
return Distributions.Exponential.MLE.oneParameter(data);
|
|
1639
|
+
}
|
|
1640
|
+
if (distribution.toLowerCase().includes("2")) {
|
|
1641
|
+
return Distributions[distribution.substring(3)].MLE.twoParamerter(data);
|
|
1642
|
+
}
|
|
1643
|
+
if (distribution.toLowerCase().includes("3")) {
|
|
1644
|
+
return Distributions[distribution.substring(3)].MLE.threeParamerter(data);
|
|
1645
|
+
}
|
|
1646
|
+
return void 0;
|
|
1647
|
+
}
|
|
1648
|
+
function ParameterizedCDF(data, distribution) {
|
|
1649
|
+
let params = MLE(data, distribution);
|
|
1650
|
+
if (distribution.toLowerCase().includes("exponential")) {
|
|
1651
|
+
if (distribution.includes("2")) {
|
|
1652
|
+
return function cdf(x) {
|
|
1653
|
+
return Distributions.Exponential.cdf(x, params.scale, params.threshold);
|
|
1654
|
+
};
|
|
1655
|
+
}
|
|
1656
|
+
return function cdf(x) {
|
|
1657
|
+
return Distributions.Exponential.cdf(x, params.scale);
|
|
1658
|
+
};
|
|
1659
|
+
}
|
|
1660
|
+
if (distribution === "Normal" || distribution.toLowerCase().includes("extreme") || distribution === "Logistic") {
|
|
1661
|
+
return function cdf(x) {
|
|
1662
|
+
return Distributions[distribution].cdf(x, params.location, params.scale);
|
|
1663
|
+
};
|
|
1664
|
+
}
|
|
1665
|
+
if (distribution === "2P LogLogistic" || distribution === "2P LogNormal") {
|
|
1666
|
+
let dist = distribution.substring(3);
|
|
1667
|
+
return function cdf(x) {
|
|
1668
|
+
return Distributions[dist].cdf(x, params.location, params.scale);
|
|
1669
|
+
};
|
|
1670
|
+
}
|
|
1671
|
+
if (distribution.includes("3")) {
|
|
1672
|
+
let dist = distribution.substring(distribution.indexOf(" ") + 1);
|
|
1673
|
+
if (dist === "LogLogistic") {
|
|
1674
|
+
return function cdf(x) {
|
|
1675
|
+
return Distributions.LogLogistic.cdf(x, params.location, params.scale, params.threshold);
|
|
1676
|
+
};
|
|
1677
|
+
}
|
|
1678
|
+
if (dist === "Weibull") {
|
|
1679
|
+
return function cdf(x) {
|
|
1680
|
+
return Distributions.Weibull.cdf(x, params.scale, params.shape, params.than);
|
|
1681
|
+
};
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
if (distribution === "Weibull") {
|
|
1685
|
+
return function cdf(x) {
|
|
1686
|
+
return Distributions.Weibull.cdf(x, params.scale, params.shape);
|
|
1687
|
+
};
|
|
1688
|
+
}
|
|
1689
|
+
}
|
|
1630
1690
|
var GoodnessOfFit = {
|
|
1631
1691
|
AndersonDarling: {
|
|
1632
1692
|
/**
|
|
@@ -1677,7 +1737,13 @@ var GoodnessOfFit = {
|
|
|
1677
1737
|
* @param cdf The cumulative distribution function to evaluate the data against.
|
|
1678
1738
|
*/
|
|
1679
1739
|
Test(data, cdf) {
|
|
1680
|
-
let
|
|
1740
|
+
let CDF;
|
|
1741
|
+
if (typeof cdf === "string") {
|
|
1742
|
+
CDF = ParameterizedCDF(data, cdf);
|
|
1743
|
+
} else {
|
|
1744
|
+
CDF = cdf;
|
|
1745
|
+
}
|
|
1746
|
+
let AD = GoodnessOfFit.AndersonDarling.AD(data, CDF);
|
|
1681
1747
|
let p = GoodnessOfFit.AndersonDarling.p(AD, data.length);
|
|
1682
1748
|
return {
|
|
1683
1749
|
AD,
|
|
@@ -1685,6 +1751,18 @@ var GoodnessOfFit = {
|
|
|
1685
1751
|
};
|
|
1686
1752
|
}
|
|
1687
1753
|
},
|
|
1754
|
+
Distributions: [
|
|
1755
|
+
"Exponential",
|
|
1756
|
+
"2P Exponential",
|
|
1757
|
+
"LargestExtremeValue",
|
|
1758
|
+
"Logistic",
|
|
1759
|
+
"2P LogLogistic",
|
|
1760
|
+
"2P LogNormal",
|
|
1761
|
+
"Normal",
|
|
1762
|
+
"SmallestExtremeValue",
|
|
1763
|
+
"Weibull",
|
|
1764
|
+
"3P Weibull"
|
|
1765
|
+
],
|
|
1688
1766
|
KolmogorovSmirnov: {
|
|
1689
1767
|
/**
|
|
1690
1768
|
* Returns the KolmogorovSmirnov Critical Value for goodness of fit testing based on the specified sample size and the specified confidence.
|
|
@@ -3610,6 +3688,55 @@ function GRR_PartxOperatorChart(data) {
|
|
|
3610
3688
|
chartSettings.hasLegend = true;
|
|
3611
3689
|
return CreateScatterPlot(dataSets, "Part * Operator Interaction", chartSettings);
|
|
3612
3690
|
}
|
|
3691
|
+
function CompileGRRObject(operators, parts, measurements) {
|
|
3692
|
+
let arrayOfSmallerObjects = [];
|
|
3693
|
+
if (!(operators.length === parts.length && operators.length === measurements.length)) {
|
|
3694
|
+
return;
|
|
3695
|
+
}
|
|
3696
|
+
operators.forEach((o, i) => {
|
|
3697
|
+
arrayOfSmallerObjects.push({ operator: o, part: parts[i], measurement: measurements[i] });
|
|
3698
|
+
});
|
|
3699
|
+
let sortedByOperators = SplitObjectArrayByProp(arrayOfSmallerObjects, "operator");
|
|
3700
|
+
let thenSortedByParts = [];
|
|
3701
|
+
sortedByOperators.forEach((s) => {
|
|
3702
|
+
let entriesByPart = SplitObjectArrayByProp(s.entries, "part");
|
|
3703
|
+
let obj = {
|
|
3704
|
+
operator: s.selector,
|
|
3705
|
+
entriesByPart
|
|
3706
|
+
};
|
|
3707
|
+
thenSortedByParts.push(obj);
|
|
3708
|
+
});
|
|
3709
|
+
let grrData = new GRR_Data([]);
|
|
3710
|
+
thenSortedByParts.forEach((t) => {
|
|
3711
|
+
let numberOfReps = t.entriesByPart[0].entries.length;
|
|
3712
|
+
let grrOp = new GRR_Operator([], t.operator);
|
|
3713
|
+
for (let i = 0; i < numberOfReps; i++) {
|
|
3714
|
+
let newRep = new GRR_Replication([]);
|
|
3715
|
+
t.entriesByPart.forEach((e) => {
|
|
3716
|
+
newRep.parts.push(e.entries[i].measurement);
|
|
3717
|
+
});
|
|
3718
|
+
grrOp.replications.push(newRep);
|
|
3719
|
+
}
|
|
3720
|
+
grrData.operators.push(grrOp);
|
|
3721
|
+
});
|
|
3722
|
+
return grrData;
|
|
3723
|
+
}
|
|
3724
|
+
function SplitObjectArrayByProp(array, prop) {
|
|
3725
|
+
let newArray = [];
|
|
3726
|
+
array.forEach((a) => {
|
|
3727
|
+
let propValue = a[prop];
|
|
3728
|
+
let newObj = newArray.find((entry) => entry.selector === propValue);
|
|
3729
|
+
if (newObj) {
|
|
3730
|
+
newObj.entries.push(a);
|
|
3731
|
+
} else {
|
|
3732
|
+
newArray.push({
|
|
3733
|
+
selector: propValue,
|
|
3734
|
+
entries: [a]
|
|
3735
|
+
});
|
|
3736
|
+
}
|
|
3737
|
+
});
|
|
3738
|
+
return newArray;
|
|
3739
|
+
}
|
|
3613
3740
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3614
3741
|
0 && (module.exports = {
|
|
3615
3742
|
AnovaTableTwoWay,
|
|
@@ -3617,6 +3744,7 @@ function GRR_PartxOperatorChart(data) {
|
|
|
3617
3744
|
Beta,
|
|
3618
3745
|
CanvasDrawSettings,
|
|
3619
3746
|
Capability,
|
|
3747
|
+
CompileGRRObject,
|
|
3620
3748
|
CreateBoxandWhiskerGraph,
|
|
3621
3749
|
CreateCapabilityHistogram,
|
|
3622
3750
|
CreateCategoricalBarGraph,
|
|
@@ -3647,6 +3775,7 @@ function GRR_PartxOperatorChart(data) {
|
|
|
3647
3775
|
IndividualDistributionPlots,
|
|
3648
3776
|
IndividualValuePlot,
|
|
3649
3777
|
LastObservationsChart,
|
|
3778
|
+
MLE,
|
|
3650
3779
|
Margin,
|
|
3651
3780
|
MarkOutOfControl,
|
|
3652
3781
|
Mean,
|
|
@@ -3655,6 +3784,7 @@ function GRR_PartxOperatorChart(data) {
|
|
|
3655
3784
|
MovingRangeChart,
|
|
3656
3785
|
NewtonRaphson,
|
|
3657
3786
|
ObjectToArray,
|
|
3787
|
+
ParameterizedCDF,
|
|
3658
3788
|
Point,
|
|
3659
3789
|
QEAxisSettings,
|
|
3660
3790
|
QEChart,
|
package/dist/index.mjs
CHANGED
|
@@ -1543,6 +1543,63 @@ var Distributions = {
|
|
|
1543
1543
|
}
|
|
1544
1544
|
}
|
|
1545
1545
|
};
|
|
1546
|
+
function MLE(data, distribution) {
|
|
1547
|
+
if (distribution === "Normal" || distribution.toLowerCase().includes("extreme") || distribution === "Logistic") {
|
|
1548
|
+
return Distributions[distribution].MLE(data);
|
|
1549
|
+
}
|
|
1550
|
+
if (distribution === "Exponential") {
|
|
1551
|
+
return Distributions.Exponential.MLE.oneParameter(data);
|
|
1552
|
+
}
|
|
1553
|
+
if (distribution.toLowerCase().includes("2")) {
|
|
1554
|
+
return Distributions[distribution.substring(3)].MLE.twoParamerter(data);
|
|
1555
|
+
}
|
|
1556
|
+
if (distribution.toLowerCase().includes("3")) {
|
|
1557
|
+
return Distributions[distribution.substring(3)].MLE.threeParamerter(data);
|
|
1558
|
+
}
|
|
1559
|
+
return void 0;
|
|
1560
|
+
}
|
|
1561
|
+
function ParameterizedCDF(data, distribution) {
|
|
1562
|
+
let params = MLE(data, distribution);
|
|
1563
|
+
if (distribution.toLowerCase().includes("exponential")) {
|
|
1564
|
+
if (distribution.includes("2")) {
|
|
1565
|
+
return function cdf(x) {
|
|
1566
|
+
return Distributions.Exponential.cdf(x, params.scale, params.threshold);
|
|
1567
|
+
};
|
|
1568
|
+
}
|
|
1569
|
+
return function cdf(x) {
|
|
1570
|
+
return Distributions.Exponential.cdf(x, params.scale);
|
|
1571
|
+
};
|
|
1572
|
+
}
|
|
1573
|
+
if (distribution === "Normal" || distribution.toLowerCase().includes("extreme") || distribution === "Logistic") {
|
|
1574
|
+
return function cdf(x) {
|
|
1575
|
+
return Distributions[distribution].cdf(x, params.location, params.scale);
|
|
1576
|
+
};
|
|
1577
|
+
}
|
|
1578
|
+
if (distribution === "2P LogLogistic" || distribution === "2P LogNormal") {
|
|
1579
|
+
let dist = distribution.substring(3);
|
|
1580
|
+
return function cdf(x) {
|
|
1581
|
+
return Distributions[dist].cdf(x, params.location, params.scale);
|
|
1582
|
+
};
|
|
1583
|
+
}
|
|
1584
|
+
if (distribution.includes("3")) {
|
|
1585
|
+
let dist = distribution.substring(distribution.indexOf(" ") + 1);
|
|
1586
|
+
if (dist === "LogLogistic") {
|
|
1587
|
+
return function cdf(x) {
|
|
1588
|
+
return Distributions.LogLogistic.cdf(x, params.location, params.scale, params.threshold);
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
if (dist === "Weibull") {
|
|
1592
|
+
return function cdf(x) {
|
|
1593
|
+
return Distributions.Weibull.cdf(x, params.scale, params.shape, params.than);
|
|
1594
|
+
};
|
|
1595
|
+
}
|
|
1596
|
+
}
|
|
1597
|
+
if (distribution === "Weibull") {
|
|
1598
|
+
return function cdf(x) {
|
|
1599
|
+
return Distributions.Weibull.cdf(x, params.scale, params.shape);
|
|
1600
|
+
};
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1546
1603
|
var GoodnessOfFit = {
|
|
1547
1604
|
AndersonDarling: {
|
|
1548
1605
|
/**
|
|
@@ -1593,7 +1650,13 @@ var GoodnessOfFit = {
|
|
|
1593
1650
|
* @param cdf The cumulative distribution function to evaluate the data against.
|
|
1594
1651
|
*/
|
|
1595
1652
|
Test(data, cdf) {
|
|
1596
|
-
let
|
|
1653
|
+
let CDF;
|
|
1654
|
+
if (typeof cdf === "string") {
|
|
1655
|
+
CDF = ParameterizedCDF(data, cdf);
|
|
1656
|
+
} else {
|
|
1657
|
+
CDF = cdf;
|
|
1658
|
+
}
|
|
1659
|
+
let AD = GoodnessOfFit.AndersonDarling.AD(data, CDF);
|
|
1597
1660
|
let p = GoodnessOfFit.AndersonDarling.p(AD, data.length);
|
|
1598
1661
|
return {
|
|
1599
1662
|
AD,
|
|
@@ -1601,6 +1664,18 @@ var GoodnessOfFit = {
|
|
|
1601
1664
|
};
|
|
1602
1665
|
}
|
|
1603
1666
|
},
|
|
1667
|
+
Distributions: [
|
|
1668
|
+
"Exponential",
|
|
1669
|
+
"2P Exponential",
|
|
1670
|
+
"LargestExtremeValue",
|
|
1671
|
+
"Logistic",
|
|
1672
|
+
"2P LogLogistic",
|
|
1673
|
+
"2P LogNormal",
|
|
1674
|
+
"Normal",
|
|
1675
|
+
"SmallestExtremeValue",
|
|
1676
|
+
"Weibull",
|
|
1677
|
+
"3P Weibull"
|
|
1678
|
+
],
|
|
1604
1679
|
KolmogorovSmirnov: {
|
|
1605
1680
|
/**
|
|
1606
1681
|
* Returns the KolmogorovSmirnov Critical Value for goodness of fit testing based on the specified sample size and the specified confidence.
|
|
@@ -3526,12 +3601,62 @@ function GRR_PartxOperatorChart(data) {
|
|
|
3526
3601
|
chartSettings.hasLegend = true;
|
|
3527
3602
|
return CreateScatterPlot(dataSets, "Part * Operator Interaction", chartSettings);
|
|
3528
3603
|
}
|
|
3604
|
+
function CompileGRRObject(operators, parts, measurements) {
|
|
3605
|
+
let arrayOfSmallerObjects = [];
|
|
3606
|
+
if (!(operators.length === parts.length && operators.length === measurements.length)) {
|
|
3607
|
+
return;
|
|
3608
|
+
}
|
|
3609
|
+
operators.forEach((o, i) => {
|
|
3610
|
+
arrayOfSmallerObjects.push({ operator: o, part: parts[i], measurement: measurements[i] });
|
|
3611
|
+
});
|
|
3612
|
+
let sortedByOperators = SplitObjectArrayByProp(arrayOfSmallerObjects, "operator");
|
|
3613
|
+
let thenSortedByParts = [];
|
|
3614
|
+
sortedByOperators.forEach((s) => {
|
|
3615
|
+
let entriesByPart = SplitObjectArrayByProp(s.entries, "part");
|
|
3616
|
+
let obj = {
|
|
3617
|
+
operator: s.selector,
|
|
3618
|
+
entriesByPart
|
|
3619
|
+
};
|
|
3620
|
+
thenSortedByParts.push(obj);
|
|
3621
|
+
});
|
|
3622
|
+
let grrData = new GRR_Data([]);
|
|
3623
|
+
thenSortedByParts.forEach((t) => {
|
|
3624
|
+
let numberOfReps = t.entriesByPart[0].entries.length;
|
|
3625
|
+
let grrOp = new GRR_Operator([], t.operator);
|
|
3626
|
+
for (let i = 0; i < numberOfReps; i++) {
|
|
3627
|
+
let newRep = new GRR_Replication([]);
|
|
3628
|
+
t.entriesByPart.forEach((e) => {
|
|
3629
|
+
newRep.parts.push(e.entries[i].measurement);
|
|
3630
|
+
});
|
|
3631
|
+
grrOp.replications.push(newRep);
|
|
3632
|
+
}
|
|
3633
|
+
grrData.operators.push(grrOp);
|
|
3634
|
+
});
|
|
3635
|
+
return grrData;
|
|
3636
|
+
}
|
|
3637
|
+
function SplitObjectArrayByProp(array, prop) {
|
|
3638
|
+
let newArray = [];
|
|
3639
|
+
array.forEach((a) => {
|
|
3640
|
+
let propValue = a[prop];
|
|
3641
|
+
let newObj = newArray.find((entry) => entry.selector === propValue);
|
|
3642
|
+
if (newObj) {
|
|
3643
|
+
newObj.entries.push(a);
|
|
3644
|
+
} else {
|
|
3645
|
+
newArray.push({
|
|
3646
|
+
selector: propValue,
|
|
3647
|
+
entries: [a]
|
|
3648
|
+
});
|
|
3649
|
+
}
|
|
3650
|
+
});
|
|
3651
|
+
return newArray;
|
|
3652
|
+
}
|
|
3529
3653
|
export {
|
|
3530
3654
|
AnovaTableTwoWay,
|
|
3531
3655
|
AverageMovingRange,
|
|
3532
3656
|
Beta,
|
|
3533
3657
|
CanvasDrawSettings,
|
|
3534
3658
|
Capability,
|
|
3659
|
+
CompileGRRObject,
|
|
3535
3660
|
CreateBoxandWhiskerGraph,
|
|
3536
3661
|
CreateCapabilityHistogram,
|
|
3537
3662
|
CreateCategoricalBarGraph,
|
|
@@ -3562,6 +3687,7 @@ export {
|
|
|
3562
3687
|
IndividualDistributionPlots,
|
|
3563
3688
|
IndividualValuePlot,
|
|
3564
3689
|
LastObservationsChart,
|
|
3690
|
+
MLE,
|
|
3565
3691
|
Margin,
|
|
3566
3692
|
MarkOutOfControl,
|
|
3567
3693
|
Mean,
|
|
@@ -3570,6 +3696,7 @@ export {
|
|
|
3570
3696
|
MovingRangeChart,
|
|
3571
3697
|
NewtonRaphson,
|
|
3572
3698
|
ObjectToArray,
|
|
3699
|
+
ParameterizedCDF,
|
|
3573
3700
|
Point,
|
|
3574
3701
|
QEAxisSettings,
|
|
3575
3702
|
QEChart,
|
package/index.ts
CHANGED
|
@@ -1683,6 +1683,63 @@ export const Distributions = {
|
|
|
1683
1683
|
}
|
|
1684
1684
|
}
|
|
1685
1685
|
|
|
1686
|
+
export function MLE(data: number[], distribution: string){
|
|
1687
|
+
if(distribution === "Normal" || distribution.toLowerCase().includes("extreme") || distribution === "Logistic"){
|
|
1688
|
+
return Distributions[distribution].MLE(data);
|
|
1689
|
+
}
|
|
1690
|
+
if(distribution === "Exponential"){
|
|
1691
|
+
return Distributions.Exponential.MLE.oneParameter(data);
|
|
1692
|
+
}
|
|
1693
|
+
if(distribution.toLowerCase().includes('2')){
|
|
1694
|
+
return Distributions[distribution.substring(3)].MLE.twoParamerter(data);
|
|
1695
|
+
}
|
|
1696
|
+
if(distribution.toLowerCase().includes('3')){
|
|
1697
|
+
return Distributions[distribution.substring(3)].MLE.threeParamerter(data);
|
|
1698
|
+
}
|
|
1699
|
+
return undefined
|
|
1700
|
+
}
|
|
1701
|
+
|
|
1702
|
+
export function ParameterizedCDF(data: number[], distribution: string){
|
|
1703
|
+
let params = MLE(data, distribution);
|
|
1704
|
+
|
|
1705
|
+
// Exponential Distributions
|
|
1706
|
+
if(distribution.toLowerCase().includes("exponential")){
|
|
1707
|
+
if(distribution.includes("2")){
|
|
1708
|
+
return function cdf(x: number){return Distributions.Exponential.cdf(x, params.scale, params.threshold)}
|
|
1709
|
+
}
|
|
1710
|
+
return function cdf(x: number){return Distributions.Exponential.cdf(x, params.scale)}
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
// Location, Scale distributions
|
|
1714
|
+
if(distribution === "Normal" || distribution.toLowerCase().includes("extreme") || distribution === "Logistic"){
|
|
1715
|
+
return function cdf(x: number){return Distributions[distribution].cdf(x, params.location, params.scale)};
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
if(distribution === "2P LogLogistic" || distribution === "2P LogNormal"){
|
|
1719
|
+
let dist = distribution.substring(3);
|
|
1720
|
+
return function cdf(x: number){return Distributions[dist].cdf(x, params.location, params.scale)};
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
// 3 Parameters
|
|
1724
|
+
if(distribution.includes("3")){
|
|
1725
|
+
let dist = distribution.substring(distribution.indexOf(" ") + 1);
|
|
1726
|
+
// Location, Scale, Threshold
|
|
1727
|
+
if(dist === "LogLogistic"){
|
|
1728
|
+
return function cdf(x: number){return Distributions.LogLogistic.cdf(x, params.location, params.scale, params.threshold)}
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
// Scale, Shape, Threshold
|
|
1732
|
+
if(dist === "Weibull"){
|
|
1733
|
+
return function cdf(x: number){return Distributions.Weibull.cdf(x, params.scale, params.shape, params.than)}
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1737
|
+
// Scale, Shape
|
|
1738
|
+
if(distribution === "Weibull"){
|
|
1739
|
+
return function cdf(x: number){return Distributions.Weibull.cdf(x, params.scale, params.shape)}
|
|
1740
|
+
}
|
|
1741
|
+
}
|
|
1742
|
+
|
|
1686
1743
|
export const GoodnessOfFit = {
|
|
1687
1744
|
AndersonDarling: {
|
|
1688
1745
|
/**
|
|
@@ -1706,7 +1763,7 @@ export const GoodnessOfFit = {
|
|
|
1706
1763
|
let AD_TS = -N - S;
|
|
1707
1764
|
|
|
1708
1765
|
return AD_TS
|
|
1709
|
-
},
|
|
1766
|
+
},
|
|
1710
1767
|
/**
|
|
1711
1768
|
* Evaluates the p-value of the Anderson-Darling goodness of fit test based on the specified Anderson-Darling test statistic and sample size.
|
|
1712
1769
|
* @param AD The Anderson-Darling Test Statistic derived from performing the Anderson-Darling Goodness of Fit Test
|
|
@@ -1735,8 +1792,14 @@ export const GoodnessOfFit = {
|
|
|
1735
1792
|
* @param data The data to evaluate.
|
|
1736
1793
|
* @param cdf The cumulative distribution function to evaluate the data against.
|
|
1737
1794
|
*/
|
|
1738
|
-
Test(data: number[], cdf: Function){
|
|
1739
|
-
let
|
|
1795
|
+
Test(data: number[], cdf: Function | String){
|
|
1796
|
+
let CDF: any;
|
|
1797
|
+
if(typeof cdf === "string"){
|
|
1798
|
+
CDF = ParameterizedCDF(data, cdf)
|
|
1799
|
+
}else{
|
|
1800
|
+
CDF = cdf
|
|
1801
|
+
}
|
|
1802
|
+
let AD = GoodnessOfFit.AndersonDarling.AD(data, CDF);
|
|
1740
1803
|
let p = GoodnessOfFit.AndersonDarling.p(AD, data.length);
|
|
1741
1804
|
|
|
1742
1805
|
return {
|
|
@@ -1744,8 +1807,20 @@ export const GoodnessOfFit = {
|
|
|
1744
1807
|
p: p
|
|
1745
1808
|
}
|
|
1746
1809
|
|
|
1747
|
-
}
|
|
1810
|
+
},
|
|
1748
1811
|
},
|
|
1812
|
+
Distributions: [
|
|
1813
|
+
"Exponential",
|
|
1814
|
+
"2P Exponential",
|
|
1815
|
+
"LargestExtremeValue",
|
|
1816
|
+
"Logistic",
|
|
1817
|
+
"2P LogLogistic",
|
|
1818
|
+
"2P LogNormal",
|
|
1819
|
+
"Normal",
|
|
1820
|
+
"SmallestExtremeValue",
|
|
1821
|
+
"Weibull",
|
|
1822
|
+
"3P Weibull"
|
|
1823
|
+
],
|
|
1749
1824
|
KolmogorovSmirnov: {
|
|
1750
1825
|
/**
|
|
1751
1826
|
* Returns the KolmogorovSmirnov Critical Value for goodness of fit testing based on the specified sample size and the specified confidence.
|
|
@@ -4099,7 +4174,7 @@ export function GRR_PartxOperatorChart(data: GRR_Data){
|
|
|
4099
4174
|
return CreateScatterPlot(dataSets ,'Part * Operator Interaction', chartSettings)
|
|
4100
4175
|
}
|
|
4101
4176
|
|
|
4102
|
-
function CompileGRRObject(operators, parts, measurements){
|
|
4177
|
+
export function CompileGRRObject(operators, parts, measurements){
|
|
4103
4178
|
let arrayOfSmallerObjects: any[] = [];
|
|
4104
4179
|
if(!(operators.length === parts.length && operators.length === measurements.length)){return}
|
|
4105
4180
|
|
package/package.json
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
Added two new functions to Distributions Module
|
|
2
|
+
|
|
3
|
+
- MLE
|
|
4
|
+
- ParameterizedCDF
|
|
5
|
+
|
|
6
|
+
Added ability for GoodnessOfFit.AndersonDarling.Test to receive distribution as a string and perform analysis.
|
|
7
|
+
|
|
8
|
+
Added GoodnessOfFit.Distributions const array to easily access supported distributions
|
|
9
|
+
|
|
10
|
+
Added export for CompileGRRObject function
|