qesuite 1.0.9 → 1.0.10
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 +17 -69
- package/dist/index.d.ts +17 -69
- package/dist/index.js +54 -119
- package/dist/index.mjs +54 -119
- package/index.ts +155 -106
- package/package.json +1 -1
- package/versions/1_0_10.md +11 -0
package/dist/index.d.mts
CHANGED
|
@@ -216,7 +216,7 @@ declare function SixPack(data: number[], specification: QESpecification, title?:
|
|
|
216
216
|
MovingRange: HTMLCanvasElement;
|
|
217
217
|
NormalProbability: HTMLCanvasElement;
|
|
218
218
|
LastObservations: HTMLCanvasElement;
|
|
219
|
-
Summary: HTMLCanvasElement;
|
|
219
|
+
Summary: void | HTMLCanvasElement;
|
|
220
220
|
};
|
|
221
221
|
};
|
|
222
222
|
declare function IndividualValuePlot(data: number[], title?: string, historicalMean?: number): HTMLCanvasElement;
|
|
@@ -694,7 +694,18 @@ declare const GoodnessOfFit: {
|
|
|
694
694
|
p: any;
|
|
695
695
|
};
|
|
696
696
|
};
|
|
697
|
-
Distributions:
|
|
697
|
+
Distributions: {
|
|
698
|
+
Exponential: string;
|
|
699
|
+
Exponential2P: string;
|
|
700
|
+
LargestExtremeValue: string;
|
|
701
|
+
Logistic: string;
|
|
702
|
+
LogLogistic2P: string;
|
|
703
|
+
LogNormal2P: string;
|
|
704
|
+
Normal: string;
|
|
705
|
+
SmallestExtremeValue: string;
|
|
706
|
+
Weibull: string;
|
|
707
|
+
toArray(): string[];
|
|
708
|
+
};
|
|
698
709
|
KolmogorovSmirnov: {
|
|
699
710
|
/**
|
|
700
711
|
* Returns the KolmogorovSmirnov Critical Value for goodness of fit testing based on the specified sample size and the specified confidence.
|
|
@@ -709,15 +720,7 @@ declare const GoodnessOfFit: {
|
|
|
709
720
|
* @param data The data to evaluate.
|
|
710
721
|
*/
|
|
711
722
|
declare function IndividualDistributionIdentification(data: number[]): {
|
|
712
|
-
|
|
713
|
-
AD: number;
|
|
714
|
-
p: any;
|
|
715
|
-
parameters: {
|
|
716
|
-
location: number;
|
|
717
|
-
scale: number;
|
|
718
|
-
};
|
|
719
|
-
};
|
|
720
|
-
boxCox: {
|
|
723
|
+
BoxCox: {
|
|
721
724
|
AD: number;
|
|
722
725
|
p: any;
|
|
723
726
|
parameters: {
|
|
@@ -726,64 +729,9 @@ declare function IndividualDistributionIdentification(data: number[]): {
|
|
|
726
729
|
scale: number;
|
|
727
730
|
};
|
|
728
731
|
};
|
|
729
|
-
exponential: {
|
|
730
|
-
AD: number;
|
|
731
|
-
p: any;
|
|
732
|
-
parameters: {
|
|
733
|
-
scale: number;
|
|
734
|
-
};
|
|
735
|
-
};
|
|
736
|
-
exponential2p: {
|
|
737
|
-
AD: number;
|
|
738
|
-
p: any;
|
|
739
|
-
parameters: {
|
|
740
|
-
scale: number;
|
|
741
|
-
threshold: number;
|
|
742
|
-
};
|
|
743
|
-
};
|
|
744
|
-
LargestExtremeValue: {
|
|
745
|
-
AD: number;
|
|
746
|
-
p: any;
|
|
747
|
-
parameters: {
|
|
748
|
-
location: number;
|
|
749
|
-
scale: number;
|
|
750
|
-
};
|
|
751
|
-
};
|
|
752
|
-
logistic: {
|
|
753
|
-
AD: number;
|
|
754
|
-
p: any;
|
|
755
|
-
parameters: {
|
|
756
|
-
location: number;
|
|
757
|
-
scale: number;
|
|
758
|
-
};
|
|
759
|
-
};
|
|
760
|
-
loglogistic: {
|
|
761
|
-
AD: number;
|
|
762
|
-
p: any;
|
|
763
|
-
parameters: {
|
|
764
|
-
location: number;
|
|
765
|
-
scale: number;
|
|
766
|
-
};
|
|
767
|
-
};
|
|
768
|
-
lognormal: {
|
|
769
|
-
AD: number;
|
|
770
|
-
p: any;
|
|
771
|
-
parameters: {
|
|
772
|
-
location: number;
|
|
773
|
-
scale: number;
|
|
774
|
-
};
|
|
775
|
-
};
|
|
776
|
-
SmallestExtremeValue: {
|
|
777
|
-
AD: number;
|
|
778
|
-
p: any;
|
|
779
|
-
parameters: {
|
|
780
|
-
location: number;
|
|
781
|
-
scale: number;
|
|
782
|
-
};
|
|
783
|
-
};
|
|
784
732
|
};
|
|
785
733
|
declare function IndividualDistributionPlots(data: number[]): {
|
|
786
|
-
summary: HTMLCanvasElement;
|
|
734
|
+
summary: void | HTMLCanvasElement;
|
|
787
735
|
normal: HTMLCanvasElement;
|
|
788
736
|
boxCox: HTMLCanvasElement;
|
|
789
737
|
exponential: HTMLCanvasElement;
|
|
@@ -963,7 +911,7 @@ declare function CreateSplitGraph(charts: QEChart[], title: string, chartSetting
|
|
|
963
911
|
* @param title Chart Title
|
|
964
912
|
* @param chartSettings Chart settings
|
|
965
913
|
*/
|
|
966
|
-
declare function CreateSummaryChart(charts: HTMLCanvasElement[], title: string): HTMLCanvasElement;
|
|
914
|
+
declare function CreateSummaryChart(charts: HTMLCanvasElement[], title: string): void | HTMLCanvasElement;
|
|
967
915
|
/**
|
|
968
916
|
* Create a scatter plot
|
|
969
917
|
* @param data An array of data sets to plot
|
|
@@ -1112,7 +1060,7 @@ declare function GRR_Graphs(data: any, tolerance: number, name?: string): {
|
|
|
1112
1060
|
GageEvaluation: any;
|
|
1113
1061
|
};
|
|
1114
1062
|
charts: {
|
|
1115
|
-
Summary: HTMLCanvasElement;
|
|
1063
|
+
Summary: void | HTMLCanvasElement;
|
|
1116
1064
|
VarComp: HTMLCanvasElement;
|
|
1117
1065
|
ByPart: HTMLCanvasElement;
|
|
1118
1066
|
R: HTMLCanvasElement;
|
package/dist/index.d.ts
CHANGED
|
@@ -216,7 +216,7 @@ declare function SixPack(data: number[], specification: QESpecification, title?:
|
|
|
216
216
|
MovingRange: HTMLCanvasElement;
|
|
217
217
|
NormalProbability: HTMLCanvasElement;
|
|
218
218
|
LastObservations: HTMLCanvasElement;
|
|
219
|
-
Summary: HTMLCanvasElement;
|
|
219
|
+
Summary: void | HTMLCanvasElement;
|
|
220
220
|
};
|
|
221
221
|
};
|
|
222
222
|
declare function IndividualValuePlot(data: number[], title?: string, historicalMean?: number): HTMLCanvasElement;
|
|
@@ -694,7 +694,18 @@ declare const GoodnessOfFit: {
|
|
|
694
694
|
p: any;
|
|
695
695
|
};
|
|
696
696
|
};
|
|
697
|
-
Distributions:
|
|
697
|
+
Distributions: {
|
|
698
|
+
Exponential: string;
|
|
699
|
+
Exponential2P: string;
|
|
700
|
+
LargestExtremeValue: string;
|
|
701
|
+
Logistic: string;
|
|
702
|
+
LogLogistic2P: string;
|
|
703
|
+
LogNormal2P: string;
|
|
704
|
+
Normal: string;
|
|
705
|
+
SmallestExtremeValue: string;
|
|
706
|
+
Weibull: string;
|
|
707
|
+
toArray(): string[];
|
|
708
|
+
};
|
|
698
709
|
KolmogorovSmirnov: {
|
|
699
710
|
/**
|
|
700
711
|
* Returns the KolmogorovSmirnov Critical Value for goodness of fit testing based on the specified sample size and the specified confidence.
|
|
@@ -709,15 +720,7 @@ declare const GoodnessOfFit: {
|
|
|
709
720
|
* @param data The data to evaluate.
|
|
710
721
|
*/
|
|
711
722
|
declare function IndividualDistributionIdentification(data: number[]): {
|
|
712
|
-
|
|
713
|
-
AD: number;
|
|
714
|
-
p: any;
|
|
715
|
-
parameters: {
|
|
716
|
-
location: number;
|
|
717
|
-
scale: number;
|
|
718
|
-
};
|
|
719
|
-
};
|
|
720
|
-
boxCox: {
|
|
723
|
+
BoxCox: {
|
|
721
724
|
AD: number;
|
|
722
725
|
p: any;
|
|
723
726
|
parameters: {
|
|
@@ -726,64 +729,9 @@ declare function IndividualDistributionIdentification(data: number[]): {
|
|
|
726
729
|
scale: number;
|
|
727
730
|
};
|
|
728
731
|
};
|
|
729
|
-
exponential: {
|
|
730
|
-
AD: number;
|
|
731
|
-
p: any;
|
|
732
|
-
parameters: {
|
|
733
|
-
scale: number;
|
|
734
|
-
};
|
|
735
|
-
};
|
|
736
|
-
exponential2p: {
|
|
737
|
-
AD: number;
|
|
738
|
-
p: any;
|
|
739
|
-
parameters: {
|
|
740
|
-
scale: number;
|
|
741
|
-
threshold: number;
|
|
742
|
-
};
|
|
743
|
-
};
|
|
744
|
-
LargestExtremeValue: {
|
|
745
|
-
AD: number;
|
|
746
|
-
p: any;
|
|
747
|
-
parameters: {
|
|
748
|
-
location: number;
|
|
749
|
-
scale: number;
|
|
750
|
-
};
|
|
751
|
-
};
|
|
752
|
-
logistic: {
|
|
753
|
-
AD: number;
|
|
754
|
-
p: any;
|
|
755
|
-
parameters: {
|
|
756
|
-
location: number;
|
|
757
|
-
scale: number;
|
|
758
|
-
};
|
|
759
|
-
};
|
|
760
|
-
loglogistic: {
|
|
761
|
-
AD: number;
|
|
762
|
-
p: any;
|
|
763
|
-
parameters: {
|
|
764
|
-
location: number;
|
|
765
|
-
scale: number;
|
|
766
|
-
};
|
|
767
|
-
};
|
|
768
|
-
lognormal: {
|
|
769
|
-
AD: number;
|
|
770
|
-
p: any;
|
|
771
|
-
parameters: {
|
|
772
|
-
location: number;
|
|
773
|
-
scale: number;
|
|
774
|
-
};
|
|
775
|
-
};
|
|
776
|
-
SmallestExtremeValue: {
|
|
777
|
-
AD: number;
|
|
778
|
-
p: any;
|
|
779
|
-
parameters: {
|
|
780
|
-
location: number;
|
|
781
|
-
scale: number;
|
|
782
|
-
};
|
|
783
|
-
};
|
|
784
732
|
};
|
|
785
733
|
declare function IndividualDistributionPlots(data: number[]): {
|
|
786
|
-
summary: HTMLCanvasElement;
|
|
734
|
+
summary: void | HTMLCanvasElement;
|
|
787
735
|
normal: HTMLCanvasElement;
|
|
788
736
|
boxCox: HTMLCanvasElement;
|
|
789
737
|
exponential: HTMLCanvasElement;
|
|
@@ -963,7 +911,7 @@ declare function CreateSplitGraph(charts: QEChart[], title: string, chartSetting
|
|
|
963
911
|
* @param title Chart Title
|
|
964
912
|
* @param chartSettings Chart settings
|
|
965
913
|
*/
|
|
966
|
-
declare function CreateSummaryChart(charts: HTMLCanvasElement[], title: string): HTMLCanvasElement;
|
|
914
|
+
declare function CreateSummaryChart(charts: HTMLCanvasElement[], title: string): void | HTMLCanvasElement;
|
|
967
915
|
/**
|
|
968
916
|
* Create a scatter plot
|
|
969
917
|
* @param data An array of data sets to plot
|
|
@@ -1112,7 +1060,7 @@ declare function GRR_Graphs(data: any, tolerance: number, name?: string): {
|
|
|
1112
1060
|
GageEvaluation: any;
|
|
1113
1061
|
};
|
|
1114
1062
|
charts: {
|
|
1115
|
-
Summary: HTMLCanvasElement;
|
|
1063
|
+
Summary: void | HTMLCanvasElement;
|
|
1116
1064
|
VarComp: HTMLCanvasElement;
|
|
1117
1065
|
ByPart: HTMLCanvasElement;
|
|
1118
1066
|
R: HTMLCanvasElement;
|
package/dist/index.js
CHANGED
|
@@ -1751,18 +1751,28 @@ var GoodnessOfFit = {
|
|
|
1751
1751
|
};
|
|
1752
1752
|
}
|
|
1753
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
|
-
|
|
1754
|
+
Distributions: {
|
|
1755
|
+
Exponential: "Exponential",
|
|
1756
|
+
Exponential2P: "2P Exponential",
|
|
1757
|
+
LargestExtremeValue: "LargestExtremeValue",
|
|
1758
|
+
Logistic: "Logistic",
|
|
1759
|
+
LogLogistic2P: "2P LogLogistic",
|
|
1760
|
+
LogNormal2P: "2P LogNormal",
|
|
1761
|
+
Normal: "Normal",
|
|
1762
|
+
SmallestExtremeValue: "SmallestExtremeValue",
|
|
1763
|
+
Weibull: "Weibull",
|
|
1764
|
+
// Weibull3p: "3P Weibull",
|
|
1765
|
+
toArray() {
|
|
1766
|
+
let returnArray = [];
|
|
1767
|
+
for (const p in GoodnessOfFit.Distributions) {
|
|
1768
|
+
let dist = GoodnessOfFit.Distributions[p];
|
|
1769
|
+
if (typeof dist === "string") {
|
|
1770
|
+
returnArray.push(dist);
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
return returnArray;
|
|
1774
|
+
}
|
|
1775
|
+
},
|
|
1766
1776
|
KolmogorovSmirnov: {
|
|
1767
1777
|
/**
|
|
1768
1778
|
* Returns the KolmogorovSmirnov Critical Value for goodness of fit testing based on the specified sample size and the specified confidence.
|
|
@@ -1818,112 +1828,27 @@ var GoodnessOfFit = {
|
|
|
1818
1828
|
function IndividualDistributionIdentification(data) {
|
|
1819
1829
|
const boxCoxLambda = Distributions.Normal.BoxCox.lambda.mtb(data);
|
|
1820
1830
|
let boxCoxData = Distributions.Normal.BoxCox.transform.mtb(data, boxCoxLambda);
|
|
1821
|
-
let
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
|
|
1825
|
-
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
...Distributions.Normal.MLE(data)
|
|
1829
|
-
},
|
|
1830
|
-
exponential: {
|
|
1831
|
-
...Distributions.Exponential.MLE.oneParameter(data)
|
|
1832
|
-
},
|
|
1833
|
-
exponential2p: {
|
|
1834
|
-
...Distributions.Exponential.MLE.twoParamerter(data)
|
|
1835
|
-
},
|
|
1836
|
-
gamma: {
|
|
1837
|
-
...Distributions.Gamma.MLE.twoParameter(data)
|
|
1838
|
-
},
|
|
1839
|
-
gamma3p: {
|
|
1840
|
-
...Distributions.Gamma.MLE.twoParameter(data.map((d) => {
|
|
1841
|
-
return d - 5;
|
|
1842
|
-
}))
|
|
1843
|
-
},
|
|
1844
|
-
largestExtremeValue: {
|
|
1845
|
-
...Distributions.LargestExtremeValue.MLE(data)
|
|
1846
|
-
},
|
|
1847
|
-
logistic: {
|
|
1848
|
-
...Distributions.Logistic.MLE(data)
|
|
1849
|
-
},
|
|
1850
|
-
loglogistic: {
|
|
1851
|
-
...Distributions.LogLogistic.MLE.twoParameter(data)
|
|
1852
|
-
},
|
|
1853
|
-
lognormal: {
|
|
1854
|
-
...Distributions.LogNormal.MLE.twoParameter(data)
|
|
1855
|
-
},
|
|
1856
|
-
smallestExtremeValue: {
|
|
1857
|
-
...Distributions.SmallestExtremeValue.MLE(data)
|
|
1858
|
-
},
|
|
1859
|
-
weibull: {
|
|
1860
|
-
...Distributions.Weibull.MLE.twoParameter(data)
|
|
1861
|
-
}
|
|
1862
|
-
// weibull3p: {
|
|
1863
|
-
// ...Weibull.MLE.threeParameter(data)
|
|
1864
|
-
// },
|
|
1865
|
-
};
|
|
1866
|
-
let returnObject = {
|
|
1867
|
-
normal: {
|
|
1868
|
-
parameters: parameters.normal,
|
|
1869
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x) => {
|
|
1870
|
-
return Distributions.Normal.cdf(x, parameters.normal.location, parameters.normal.scale);
|
|
1871
|
-
})
|
|
1872
|
-
},
|
|
1873
|
-
boxCox: {
|
|
1874
|
-
parameters: parameters.boxCox,
|
|
1831
|
+
let returnerObj = {
|
|
1832
|
+
BoxCox: {
|
|
1833
|
+
parameters: {
|
|
1834
|
+
lambda: boxCoxLambda,
|
|
1835
|
+
location: Mean(boxCoxData),
|
|
1836
|
+
scale: StDev.S(boxCoxData)
|
|
1837
|
+
},
|
|
1875
1838
|
...GoodnessOfFit.AndersonDarling.Test(boxCoxData, (x) => {
|
|
1876
|
-
return Distributions.Normal.cdf(x,
|
|
1877
|
-
})
|
|
1878
|
-
},
|
|
1879
|
-
exponential: {
|
|
1880
|
-
parameters: parameters.exponential,
|
|
1881
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x) => {
|
|
1882
|
-
return Distributions.Exponential.cdf(x, parameters.exponential.scale);
|
|
1883
|
-
})
|
|
1884
|
-
},
|
|
1885
|
-
exponential2p: {
|
|
1886
|
-
parameters: parameters.exponential2p,
|
|
1887
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x) => {
|
|
1888
|
-
return Distributions.Exponential.cdf(x, parameters.exponential2p.scale, parameters.exponential2p.threshold);
|
|
1889
|
-
})
|
|
1890
|
-
},
|
|
1891
|
-
// gamma: {
|
|
1892
|
-
// parameters: parameters.gamma,
|
|
1893
|
-
// ...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.Gamma.cdf()}),
|
|
1894
|
-
// },
|
|
1895
|
-
LargestExtremeValue: {
|
|
1896
|
-
parameters: parameters.largestExtremeValue,
|
|
1897
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x) => {
|
|
1898
|
-
return Distributions.LargestExtremeValue.cdf(x, parameters.largestExtremeValue.location, parameters.largestExtremeValue.scale);
|
|
1899
|
-
})
|
|
1900
|
-
},
|
|
1901
|
-
logistic: {
|
|
1902
|
-
parameters: parameters.logistic,
|
|
1903
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x) => {
|
|
1904
|
-
return Distributions.Logistic.cdf(x, parameters.logistic.location, parameters.logistic.scale);
|
|
1905
|
-
})
|
|
1906
|
-
},
|
|
1907
|
-
loglogistic: {
|
|
1908
|
-
parameters: parameters.loglogistic,
|
|
1909
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x) => {
|
|
1910
|
-
return Distributions.LogLogistic.cdf(x, parameters.loglogistic.location, parameters.loglogistic.scale);
|
|
1911
|
-
})
|
|
1912
|
-
},
|
|
1913
|
-
lognormal: {
|
|
1914
|
-
parameters: parameters.lognormal,
|
|
1915
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x) => {
|
|
1916
|
-
return Distributions.LogNormal.cdf(x, parameters.lognormal.location, parameters.lognormal.scale);
|
|
1917
|
-
})
|
|
1918
|
-
},
|
|
1919
|
-
SmallestExtremeValue: {
|
|
1920
|
-
parameters: parameters.smallestExtremeValue,
|
|
1921
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x) => {
|
|
1922
|
-
return Distributions.SmallestExtremeValue.cdf(x, parameters.smallestExtremeValue.location, parameters.smallestExtremeValue.scale);
|
|
1839
|
+
return Distributions.Normal.cdf(x, this.boxCox.location, this.boxCox.scale);
|
|
1923
1840
|
})
|
|
1924
1841
|
}
|
|
1925
1842
|
};
|
|
1926
|
-
|
|
1843
|
+
console.log(returnerObj);
|
|
1844
|
+
GoodnessOfFit.Distributions.toArray().forEach((d) => {
|
|
1845
|
+
returnerObj[d] = {
|
|
1846
|
+
parameters: MLE(data, d),
|
|
1847
|
+
...GoodnessOfFit.AndersonDarling.Test(data, d)
|
|
1848
|
+
};
|
|
1849
|
+
});
|
|
1850
|
+
console.log(returnerObj);
|
|
1851
|
+
return returnerObj;
|
|
1927
1852
|
}
|
|
1928
1853
|
function IndividualDistributionPlots(data) {
|
|
1929
1854
|
const boxCoxLambda = Distributions.Normal.BoxCox.lambda.mtb(data);
|
|
@@ -2195,6 +2120,19 @@ function CreateCanvas(width, height) {
|
|
|
2195
2120
|
canvas.width = width;
|
|
2196
2121
|
return canvas;
|
|
2197
2122
|
}
|
|
2123
|
+
function AddSolidBackground(canvas, color) {
|
|
2124
|
+
let newCanvas = CreateCanvas(canvas.width, canvas.height);
|
|
2125
|
+
let newCtx = newCanvas.getContext("2d");
|
|
2126
|
+
if (newCtx) {
|
|
2127
|
+
newCtx.beginPath();
|
|
2128
|
+
newCtx.fillStyle = color;
|
|
2129
|
+
newCtx.fillRect(0, 0, newCanvas.height, newCanvas.width);
|
|
2130
|
+
newCtx.closePath();
|
|
2131
|
+
newCtx.beginPath();
|
|
2132
|
+
newCtx.drawImage(canvas, 0, 0);
|
|
2133
|
+
newCtx.closePath();
|
|
2134
|
+
}
|
|
2135
|
+
}
|
|
2198
2136
|
function AddPlotArea(ctx, chartSettings) {
|
|
2199
2137
|
let width = chartSettings.width - chartSettings.margins.left - chartSettings.margins.right;
|
|
2200
2138
|
let height = chartSettings.height - chartSettings.margins.top - chartSettings.margins.bottom;
|
|
@@ -2888,10 +2826,6 @@ function CreateSummaryChart(charts, title) {
|
|
|
2888
2826
|
if (!ctx) {
|
|
2889
2827
|
return canvas;
|
|
2890
2828
|
}
|
|
2891
|
-
ctx.beginPath();
|
|
2892
|
-
ctx.fillStyle = "white";
|
|
2893
|
-
ctx.fillRect(0, 0, width, height);
|
|
2894
|
-
ctx.closePath();
|
|
2895
2829
|
let fontsize = 96;
|
|
2896
2830
|
ctx.font = `${fontsize}px calibri`;
|
|
2897
2831
|
ctx.textAlign = "center";
|
|
@@ -2912,7 +2846,8 @@ function CreateSummaryChart(charts, title) {
|
|
|
2912
2846
|
ctx.drawImage(charts[2 * i + 1], width / 2 + padding, y, width / 2, height / rowCount - padding);
|
|
2913
2847
|
}
|
|
2914
2848
|
}
|
|
2915
|
-
|
|
2849
|
+
let newCanvas = AddSolidBackground(canvas, "white");
|
|
2850
|
+
return newCanvas;
|
|
2916
2851
|
}
|
|
2917
2852
|
function getLines(ctx, text, maxWidth) {
|
|
2918
2853
|
var words = text.split(" ");
|
package/dist/index.mjs
CHANGED
|
@@ -1664,18 +1664,28 @@ var GoodnessOfFit = {
|
|
|
1664
1664
|
};
|
|
1665
1665
|
}
|
|
1666
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
|
-
|
|
1667
|
+
Distributions: {
|
|
1668
|
+
Exponential: "Exponential",
|
|
1669
|
+
Exponential2P: "2P Exponential",
|
|
1670
|
+
LargestExtremeValue: "LargestExtremeValue",
|
|
1671
|
+
Logistic: "Logistic",
|
|
1672
|
+
LogLogistic2P: "2P LogLogistic",
|
|
1673
|
+
LogNormal2P: "2P LogNormal",
|
|
1674
|
+
Normal: "Normal",
|
|
1675
|
+
SmallestExtremeValue: "SmallestExtremeValue",
|
|
1676
|
+
Weibull: "Weibull",
|
|
1677
|
+
// Weibull3p: "3P Weibull",
|
|
1678
|
+
toArray() {
|
|
1679
|
+
let returnArray = [];
|
|
1680
|
+
for (const p in GoodnessOfFit.Distributions) {
|
|
1681
|
+
let dist = GoodnessOfFit.Distributions[p];
|
|
1682
|
+
if (typeof dist === "string") {
|
|
1683
|
+
returnArray.push(dist);
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
return returnArray;
|
|
1687
|
+
}
|
|
1688
|
+
},
|
|
1679
1689
|
KolmogorovSmirnov: {
|
|
1680
1690
|
/**
|
|
1681
1691
|
* Returns the KolmogorovSmirnov Critical Value for goodness of fit testing based on the specified sample size and the specified confidence.
|
|
@@ -1731,112 +1741,27 @@ var GoodnessOfFit = {
|
|
|
1731
1741
|
function IndividualDistributionIdentification(data) {
|
|
1732
1742
|
const boxCoxLambda = Distributions.Normal.BoxCox.lambda.mtb(data);
|
|
1733
1743
|
let boxCoxData = Distributions.Normal.BoxCox.transform.mtb(data, boxCoxLambda);
|
|
1734
|
-
let
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
...Distributions.Normal.MLE(data)
|
|
1742
|
-
},
|
|
1743
|
-
exponential: {
|
|
1744
|
-
...Distributions.Exponential.MLE.oneParameter(data)
|
|
1745
|
-
},
|
|
1746
|
-
exponential2p: {
|
|
1747
|
-
...Distributions.Exponential.MLE.twoParamerter(data)
|
|
1748
|
-
},
|
|
1749
|
-
gamma: {
|
|
1750
|
-
...Distributions.Gamma.MLE.twoParameter(data)
|
|
1751
|
-
},
|
|
1752
|
-
gamma3p: {
|
|
1753
|
-
...Distributions.Gamma.MLE.twoParameter(data.map((d) => {
|
|
1754
|
-
return d - 5;
|
|
1755
|
-
}))
|
|
1756
|
-
},
|
|
1757
|
-
largestExtremeValue: {
|
|
1758
|
-
...Distributions.LargestExtremeValue.MLE(data)
|
|
1759
|
-
},
|
|
1760
|
-
logistic: {
|
|
1761
|
-
...Distributions.Logistic.MLE(data)
|
|
1762
|
-
},
|
|
1763
|
-
loglogistic: {
|
|
1764
|
-
...Distributions.LogLogistic.MLE.twoParameter(data)
|
|
1765
|
-
},
|
|
1766
|
-
lognormal: {
|
|
1767
|
-
...Distributions.LogNormal.MLE.twoParameter(data)
|
|
1768
|
-
},
|
|
1769
|
-
smallestExtremeValue: {
|
|
1770
|
-
...Distributions.SmallestExtremeValue.MLE(data)
|
|
1771
|
-
},
|
|
1772
|
-
weibull: {
|
|
1773
|
-
...Distributions.Weibull.MLE.twoParameter(data)
|
|
1774
|
-
}
|
|
1775
|
-
// weibull3p: {
|
|
1776
|
-
// ...Weibull.MLE.threeParameter(data)
|
|
1777
|
-
// },
|
|
1778
|
-
};
|
|
1779
|
-
let returnObject = {
|
|
1780
|
-
normal: {
|
|
1781
|
-
parameters: parameters.normal,
|
|
1782
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x) => {
|
|
1783
|
-
return Distributions.Normal.cdf(x, parameters.normal.location, parameters.normal.scale);
|
|
1784
|
-
})
|
|
1785
|
-
},
|
|
1786
|
-
boxCox: {
|
|
1787
|
-
parameters: parameters.boxCox,
|
|
1744
|
+
let returnerObj = {
|
|
1745
|
+
BoxCox: {
|
|
1746
|
+
parameters: {
|
|
1747
|
+
lambda: boxCoxLambda,
|
|
1748
|
+
location: Mean(boxCoxData),
|
|
1749
|
+
scale: StDev.S(boxCoxData)
|
|
1750
|
+
},
|
|
1788
1751
|
...GoodnessOfFit.AndersonDarling.Test(boxCoxData, (x) => {
|
|
1789
|
-
return Distributions.Normal.cdf(x,
|
|
1790
|
-
})
|
|
1791
|
-
},
|
|
1792
|
-
exponential: {
|
|
1793
|
-
parameters: parameters.exponential,
|
|
1794
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x) => {
|
|
1795
|
-
return Distributions.Exponential.cdf(x, parameters.exponential.scale);
|
|
1796
|
-
})
|
|
1797
|
-
},
|
|
1798
|
-
exponential2p: {
|
|
1799
|
-
parameters: parameters.exponential2p,
|
|
1800
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x) => {
|
|
1801
|
-
return Distributions.Exponential.cdf(x, parameters.exponential2p.scale, parameters.exponential2p.threshold);
|
|
1802
|
-
})
|
|
1803
|
-
},
|
|
1804
|
-
// gamma: {
|
|
1805
|
-
// parameters: parameters.gamma,
|
|
1806
|
-
// ...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.Gamma.cdf()}),
|
|
1807
|
-
// },
|
|
1808
|
-
LargestExtremeValue: {
|
|
1809
|
-
parameters: parameters.largestExtremeValue,
|
|
1810
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x) => {
|
|
1811
|
-
return Distributions.LargestExtremeValue.cdf(x, parameters.largestExtremeValue.location, parameters.largestExtremeValue.scale);
|
|
1812
|
-
})
|
|
1813
|
-
},
|
|
1814
|
-
logistic: {
|
|
1815
|
-
parameters: parameters.logistic,
|
|
1816
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x) => {
|
|
1817
|
-
return Distributions.Logistic.cdf(x, parameters.logistic.location, parameters.logistic.scale);
|
|
1818
|
-
})
|
|
1819
|
-
},
|
|
1820
|
-
loglogistic: {
|
|
1821
|
-
parameters: parameters.loglogistic,
|
|
1822
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x) => {
|
|
1823
|
-
return Distributions.LogLogistic.cdf(x, parameters.loglogistic.location, parameters.loglogistic.scale);
|
|
1824
|
-
})
|
|
1825
|
-
},
|
|
1826
|
-
lognormal: {
|
|
1827
|
-
parameters: parameters.lognormal,
|
|
1828
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x) => {
|
|
1829
|
-
return Distributions.LogNormal.cdf(x, parameters.lognormal.location, parameters.lognormal.scale);
|
|
1830
|
-
})
|
|
1831
|
-
},
|
|
1832
|
-
SmallestExtremeValue: {
|
|
1833
|
-
parameters: parameters.smallestExtremeValue,
|
|
1834
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x) => {
|
|
1835
|
-
return Distributions.SmallestExtremeValue.cdf(x, parameters.smallestExtremeValue.location, parameters.smallestExtremeValue.scale);
|
|
1752
|
+
return Distributions.Normal.cdf(x, this.boxCox.location, this.boxCox.scale);
|
|
1836
1753
|
})
|
|
1837
1754
|
}
|
|
1838
1755
|
};
|
|
1839
|
-
|
|
1756
|
+
console.log(returnerObj);
|
|
1757
|
+
GoodnessOfFit.Distributions.toArray().forEach((d) => {
|
|
1758
|
+
returnerObj[d] = {
|
|
1759
|
+
parameters: MLE(data, d),
|
|
1760
|
+
...GoodnessOfFit.AndersonDarling.Test(data, d)
|
|
1761
|
+
};
|
|
1762
|
+
});
|
|
1763
|
+
console.log(returnerObj);
|
|
1764
|
+
return returnerObj;
|
|
1840
1765
|
}
|
|
1841
1766
|
function IndividualDistributionPlots(data) {
|
|
1842
1767
|
const boxCoxLambda = Distributions.Normal.BoxCox.lambda.mtb(data);
|
|
@@ -2108,6 +2033,19 @@ function CreateCanvas(width, height) {
|
|
|
2108
2033
|
canvas.width = width;
|
|
2109
2034
|
return canvas;
|
|
2110
2035
|
}
|
|
2036
|
+
function AddSolidBackground(canvas, color) {
|
|
2037
|
+
let newCanvas = CreateCanvas(canvas.width, canvas.height);
|
|
2038
|
+
let newCtx = newCanvas.getContext("2d");
|
|
2039
|
+
if (newCtx) {
|
|
2040
|
+
newCtx.beginPath();
|
|
2041
|
+
newCtx.fillStyle = color;
|
|
2042
|
+
newCtx.fillRect(0, 0, newCanvas.height, newCanvas.width);
|
|
2043
|
+
newCtx.closePath();
|
|
2044
|
+
newCtx.beginPath();
|
|
2045
|
+
newCtx.drawImage(canvas, 0, 0);
|
|
2046
|
+
newCtx.closePath();
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2111
2049
|
function AddPlotArea(ctx, chartSettings) {
|
|
2112
2050
|
let width = chartSettings.width - chartSettings.margins.left - chartSettings.margins.right;
|
|
2113
2051
|
let height = chartSettings.height - chartSettings.margins.top - chartSettings.margins.bottom;
|
|
@@ -2801,10 +2739,6 @@ function CreateSummaryChart(charts, title) {
|
|
|
2801
2739
|
if (!ctx) {
|
|
2802
2740
|
return canvas;
|
|
2803
2741
|
}
|
|
2804
|
-
ctx.beginPath();
|
|
2805
|
-
ctx.fillStyle = "white";
|
|
2806
|
-
ctx.fillRect(0, 0, width, height);
|
|
2807
|
-
ctx.closePath();
|
|
2808
2742
|
let fontsize = 96;
|
|
2809
2743
|
ctx.font = `${fontsize}px calibri`;
|
|
2810
2744
|
ctx.textAlign = "center";
|
|
@@ -2825,7 +2759,8 @@ function CreateSummaryChart(charts, title) {
|
|
|
2825
2759
|
ctx.drawImage(charts[2 * i + 1], width / 2 + padding, y, width / 2, height / rowCount - padding);
|
|
2826
2760
|
}
|
|
2827
2761
|
}
|
|
2828
|
-
|
|
2762
|
+
let newCanvas = AddSolidBackground(canvas, "white");
|
|
2763
|
+
return newCanvas;
|
|
2829
2764
|
}
|
|
2830
2765
|
function getLines(ctx, text, maxWidth) {
|
|
2831
2766
|
var words = text.split(" ");
|
package/index.ts
CHANGED
|
@@ -1809,18 +1809,28 @@ export const GoodnessOfFit = {
|
|
|
1809
1809
|
|
|
1810
1810
|
},
|
|
1811
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
|
-
|
|
1812
|
+
Distributions: {
|
|
1813
|
+
Exponential: "Exponential",
|
|
1814
|
+
Exponential2P: "2P Exponential",
|
|
1815
|
+
LargestExtremeValue: "LargestExtremeValue",
|
|
1816
|
+
Logistic: "Logistic",
|
|
1817
|
+
LogLogistic2P: "2P LogLogistic",
|
|
1818
|
+
LogNormal2P: "2P LogNormal",
|
|
1819
|
+
Normal: "Normal",
|
|
1820
|
+
SmallestExtremeValue: "SmallestExtremeValue",
|
|
1821
|
+
Weibull: "Weibull",
|
|
1822
|
+
// Weibull3p: "3P Weibull",
|
|
1823
|
+
toArray(){
|
|
1824
|
+
let returnArray: string[] = [];
|
|
1825
|
+
for(const p in GoodnessOfFit.Distributions){
|
|
1826
|
+
let dist = GoodnessOfFit.Distributions[p]
|
|
1827
|
+
if(typeof dist === 'string'){
|
|
1828
|
+
returnArray.push(dist);
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
return returnArray;
|
|
1832
|
+
}
|
|
1833
|
+
},
|
|
1824
1834
|
KolmogorovSmirnov: {
|
|
1825
1835
|
/**
|
|
1826
1836
|
* Returns the KolmogorovSmirnov Critical Value for goodness of fit testing based on the specified sample size and the specified confidence.
|
|
@@ -1885,96 +1895,121 @@ export function IndividualDistributionIdentification(data: number[]){
|
|
|
1885
1895
|
const boxCoxLambda = Distributions.Normal.BoxCox.lambda.mtb(data)
|
|
1886
1896
|
let boxCoxData = Distributions.Normal.BoxCox.transform.mtb(data, boxCoxLambda);
|
|
1887
1897
|
|
|
1888
|
-
|
|
1889
|
-
let
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
...Distributions.Normal.
|
|
1897
|
-
},
|
|
1898
|
-
exponential: {
|
|
1899
|
-
...Distributions.Exponential.MLE.oneParameter(data)
|
|
1900
|
-
},
|
|
1901
|
-
exponential2p: {
|
|
1902
|
-
...Distributions.Exponential.MLE.twoParamerter(data)
|
|
1903
|
-
},
|
|
1904
|
-
gamma: {
|
|
1905
|
-
...Distributions.Gamma.MLE.twoParameter(data)
|
|
1906
|
-
},
|
|
1907
|
-
gamma3p: {
|
|
1908
|
-
...Distributions.Gamma.MLE.twoParameter(data.map(d => {return d - 5}))
|
|
1909
|
-
},
|
|
1910
|
-
largestExtremeValue: {
|
|
1911
|
-
...Distributions.LargestExtremeValue.MLE(data)
|
|
1912
|
-
},
|
|
1913
|
-
logistic: {
|
|
1914
|
-
...Distributions.Logistic.MLE(data)
|
|
1915
|
-
},
|
|
1916
|
-
loglogistic: {
|
|
1917
|
-
...Distributions.LogLogistic.MLE.twoParameter(data)
|
|
1918
|
-
},
|
|
1919
|
-
lognormal: {
|
|
1920
|
-
...Distributions.LogNormal.MLE.twoParameter(data)
|
|
1921
|
-
},
|
|
1922
|
-
smallestExtremeValue: {
|
|
1923
|
-
...Distributions.SmallestExtremeValue.MLE(data)
|
|
1924
|
-
},
|
|
1925
|
-
weibull: {
|
|
1926
|
-
...Distributions.Weibull.MLE.twoParameter(data)
|
|
1927
|
-
},
|
|
1928
|
-
// weibull3p: {
|
|
1929
|
-
// ...Weibull.MLE.threeParameter(data)
|
|
1930
|
-
// },
|
|
1931
|
-
}
|
|
1932
|
-
|
|
1933
|
-
// Calculate AD Statistics
|
|
1934
|
-
let returnObject = {
|
|
1935
|
-
normal: {
|
|
1936
|
-
parameters: parameters.normal,
|
|
1937
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.Normal.cdf(x, parameters.normal.location, parameters.normal.scale)})
|
|
1938
|
-
},
|
|
1939
|
-
boxCox: {
|
|
1940
|
-
parameters: parameters.boxCox,
|
|
1941
|
-
...GoodnessOfFit.AndersonDarling.Test(boxCoxData, (x: number) => {return Distributions.Normal.cdf(x, parameters.boxCox.location, parameters.boxCox.scale)})
|
|
1942
|
-
},
|
|
1943
|
-
exponential: {
|
|
1944
|
-
parameters: parameters.exponential,
|
|
1945
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.Exponential.cdf(x, parameters.exponential.scale)})
|
|
1946
|
-
},
|
|
1947
|
-
exponential2p: {
|
|
1948
|
-
parameters: parameters.exponential2p,
|
|
1949
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.Exponential.cdf(x, parameters.exponential2p.scale, parameters.exponential2p.threshold)})
|
|
1950
|
-
},
|
|
1951
|
-
// gamma: {
|
|
1952
|
-
// parameters: parameters.gamma,
|
|
1953
|
-
// ...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.Gamma.cdf()}),
|
|
1954
|
-
// },
|
|
1955
|
-
LargestExtremeValue: {
|
|
1956
|
-
parameters: parameters.largestExtremeValue,
|
|
1957
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.LargestExtremeValue.cdf(x, parameters.largestExtremeValue.location, parameters.largestExtremeValue.scale)})
|
|
1958
|
-
},
|
|
1959
|
-
logistic: {
|
|
1960
|
-
parameters: parameters.logistic,
|
|
1961
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.Logistic.cdf(x, parameters.logistic.location, parameters.logistic.scale)})
|
|
1962
|
-
},
|
|
1963
|
-
loglogistic: {
|
|
1964
|
-
parameters: parameters.loglogistic,
|
|
1965
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.LogLogistic.cdf(x, parameters.loglogistic.location, parameters.loglogistic.scale)})
|
|
1966
|
-
},
|
|
1967
|
-
lognormal: {
|
|
1968
|
-
parameters: parameters.lognormal,
|
|
1969
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.LogNormal.cdf(x, parameters.lognormal.location, parameters.lognormal.scale)})
|
|
1970
|
-
},
|
|
1971
|
-
SmallestExtremeValue: {
|
|
1972
|
-
parameters: parameters.smallestExtremeValue,
|
|
1973
|
-
...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.SmallestExtremeValue.cdf(x, parameters.smallestExtremeValue.location, parameters.smallestExtremeValue.scale)})
|
|
1898
|
+
|
|
1899
|
+
let returnerObj = {
|
|
1900
|
+
BoxCox: {
|
|
1901
|
+
parameters: {
|
|
1902
|
+
lambda: boxCoxLambda,
|
|
1903
|
+
location: Mean(boxCoxData),
|
|
1904
|
+
scale: StDev.S(boxCoxData)
|
|
1905
|
+
},
|
|
1906
|
+
...GoodnessOfFit.AndersonDarling.Test(boxCoxData, (x: number) => {return Distributions.Normal.cdf(x, this.boxCox.location, this.boxCox.scale)})
|
|
1974
1907
|
}
|
|
1975
1908
|
}
|
|
1909
|
+
console.log(returnerObj)
|
|
1910
|
+
GoodnessOfFit.Distributions.toArray().forEach(d => {
|
|
1911
|
+
returnerObj[d] = {
|
|
1912
|
+
parameters: MLE(data, d),
|
|
1913
|
+
...GoodnessOfFit.AndersonDarling.Test(data, d)
|
|
1914
|
+
}
|
|
1915
|
+
})
|
|
1916
|
+
console.log(returnerObj)
|
|
1917
|
+
|
|
1918
|
+
|
|
1919
|
+
// // Estimate parameters
|
|
1920
|
+
// let parameters = {
|
|
1921
|
+
// boxCox: {
|
|
1922
|
+
// lambda: boxCoxLambda,
|
|
1923
|
+
// location: Mean(boxCoxData),
|
|
1924
|
+
// scale: StDev.S(boxCoxData)
|
|
1925
|
+
// },
|
|
1926
|
+
// normal: {
|
|
1927
|
+
// ...Distributions.Normal.MLE(data)
|
|
1928
|
+
// },
|
|
1929
|
+
// exponential: {
|
|
1930
|
+
// ...Distributions.Exponential.MLE.oneParameter(data)
|
|
1931
|
+
// },
|
|
1932
|
+
// exponential2p: {
|
|
1933
|
+
// ...Distributions.Exponential.MLE.twoParamerter(data)
|
|
1934
|
+
// },
|
|
1935
|
+
// gamma: {
|
|
1936
|
+
// ...Distributions.Gamma.MLE.twoParameter(data)
|
|
1937
|
+
// },
|
|
1938
|
+
// gamma3p: {
|
|
1939
|
+
// ...Distributions.Gamma.MLE.twoParameter(data.map(d => {return d - 5}))
|
|
1940
|
+
// },
|
|
1941
|
+
// largestExtremeValue: {
|
|
1942
|
+
// ...Distributions.LargestExtremeValue.MLE(data)
|
|
1943
|
+
// },
|
|
1944
|
+
// logistic: {
|
|
1945
|
+
// ...Distributions.Logistic.MLE(data)
|
|
1946
|
+
// },
|
|
1947
|
+
// loglogistic: {
|
|
1948
|
+
// ...Distributions.LogLogistic.MLE.twoParameter(data)
|
|
1949
|
+
// },
|
|
1950
|
+
// lognormal: {
|
|
1951
|
+
// ...Distributions.LogNormal.MLE.twoParameter(data)
|
|
1952
|
+
// },
|
|
1953
|
+
// smallestExtremeValue: {
|
|
1954
|
+
// ...Distributions.SmallestExtremeValue.MLE(data)
|
|
1955
|
+
// },
|
|
1956
|
+
// weibull: {
|
|
1957
|
+
// ...Distributions.Weibull.MLE.twoParameter(data)
|
|
1958
|
+
// },
|
|
1959
|
+
// // weibull3p: {
|
|
1960
|
+
// // ...Weibull.MLE.threeParameter(data)
|
|
1961
|
+
// // },
|
|
1962
|
+
// }
|
|
1963
|
+
|
|
1964
|
+
// // Calculate AD Statistics
|
|
1965
|
+
// let returnObject = {
|
|
1966
|
+
// Normal: {
|
|
1967
|
+
// parameters: parameters.normal,
|
|
1968
|
+
// ...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.Normal.cdf(x, parameters.normal.location, parameters.normal.scale)})
|
|
1969
|
+
// },
|
|
1970
|
+
// BoxCox: {
|
|
1971
|
+
// parameters: parameters.boxCox,
|
|
1972
|
+
// ...GoodnessOfFit.AndersonDarling.Test(boxCoxData, (x: number) => {return Distributions.Normal.cdf(x, parameters.boxCox.location, parameters.boxCox.scale)})
|
|
1973
|
+
// },
|
|
1974
|
+
// Exponential: {
|
|
1975
|
+
// parameters: parameters.exponential,
|
|
1976
|
+
// ...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.Exponential.cdf(x, parameters.exponential.scale)})
|
|
1977
|
+
// },
|
|
1978
|
+
// Exponential2p: {
|
|
1979
|
+
// parameters: parameters.exponential2p,
|
|
1980
|
+
// ...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.Exponential.cdf(x, parameters.exponential2p.scale, parameters.exponential2p.threshold)})
|
|
1981
|
+
// },
|
|
1982
|
+
// // gamma: {
|
|
1983
|
+
// // parameters: parameters.gamma,
|
|
1984
|
+
// // ...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.Gamma.cdf()}),
|
|
1985
|
+
// // },
|
|
1986
|
+
// LargestExtremeValue: {
|
|
1987
|
+
// parameters: parameters.largestExtremeValue,
|
|
1988
|
+
// ...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.LargestExtremeValue.cdf(x, parameters.largestExtremeValue.location, parameters.largestExtremeValue.scale)})
|
|
1989
|
+
// },
|
|
1990
|
+
// Logistic: {
|
|
1991
|
+
// parameters: parameters.logistic,
|
|
1992
|
+
// ...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.Logistic.cdf(x, parameters.logistic.location, parameters.logistic.scale)})
|
|
1993
|
+
// },
|
|
1994
|
+
// LogLogistic: {
|
|
1995
|
+
// parameters: parameters.loglogistic,
|
|
1996
|
+
// ...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.LogLogistic.cdf(x, parameters.loglogistic.location, parameters.loglogistic.scale)})
|
|
1997
|
+
// },
|
|
1998
|
+
// Lognormal: {
|
|
1999
|
+
// parameters: parameters.lognormal,
|
|
2000
|
+
// ...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.LogNormal.cdf(x, parameters.lognormal.location, parameters.lognormal.scale)})
|
|
2001
|
+
// },
|
|
2002
|
+
// SmallestExtremeValue: {
|
|
2003
|
+
// parameters: parameters.smallestExtremeValue,
|
|
2004
|
+
// ...GoodnessOfFit.AndersonDarling.Test(data, (x: number) => {return Distributions.SmallestExtremeValue.cdf(x, parameters.smallestExtremeValue.location, parameters.smallestExtremeValue.scale)})
|
|
2005
|
+
// },
|
|
2006
|
+
// Weibull: {
|
|
2007
|
+
// parameters: parameters.weibull,
|
|
2008
|
+
// ...GoodnessOfFit.AndersonDarling.Test(data, "Weibull")
|
|
2009
|
+
// }
|
|
2010
|
+
// }
|
|
1976
2011
|
|
|
1977
|
-
return
|
|
2012
|
+
return returnerObj
|
|
1978
2013
|
}
|
|
1979
2014
|
|
|
1980
2015
|
export function IndividualDistributionPlots(data: number[]){
|
|
@@ -2306,6 +2341,24 @@ function CreateCanvas(width: number, height: number){
|
|
|
2306
2341
|
return canvas;
|
|
2307
2342
|
}
|
|
2308
2343
|
|
|
2344
|
+
function AddSolidBackground(canvas: HTMLCanvasElement, color: string){
|
|
2345
|
+
let newCanvas = CreateCanvas(canvas.width, canvas.height);
|
|
2346
|
+
let newCtx = newCanvas.getContext("2d");
|
|
2347
|
+
|
|
2348
|
+
if(newCtx){
|
|
2349
|
+
// Draw Background
|
|
2350
|
+
newCtx.beginPath();
|
|
2351
|
+
newCtx.fillStyle = color
|
|
2352
|
+
newCtx.fillRect(0, 0, newCanvas.height, newCanvas.width);
|
|
2353
|
+
newCtx.closePath();
|
|
2354
|
+
|
|
2355
|
+
// Overlay Previous Image
|
|
2356
|
+
newCtx.beginPath();
|
|
2357
|
+
newCtx.drawImage(canvas, 0, 0)
|
|
2358
|
+
newCtx.closePath();
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
|
|
2309
2362
|
|
|
2310
2363
|
function AddPlotArea(ctx: any, chartSettings: QEChartSettings){
|
|
2311
2364
|
let width = chartSettings.width - chartSettings.margins.left - chartSettings.margins.right;
|
|
@@ -3169,13 +3222,8 @@ export function CreateSummaryChart(charts: HTMLCanvasElement[], title: string){
|
|
|
3169
3222
|
let height = (750 + padding) * rowCount;
|
|
3170
3223
|
let canvas = CreateCanvas(width + padding, height + 250);
|
|
3171
3224
|
let ctx = canvas.getContext('2d');
|
|
3172
|
-
|
|
3225
|
+
|
|
3173
3226
|
if(!ctx){return canvas}
|
|
3174
|
-
// Draw white background
|
|
3175
|
-
ctx.beginPath();
|
|
3176
|
-
ctx.fillStyle = 'white';
|
|
3177
|
-
ctx.fillRect(0,0,width, height);
|
|
3178
|
-
ctx.closePath();
|
|
3179
3227
|
|
|
3180
3228
|
let fontsize = 96;
|
|
3181
3229
|
ctx.font = `${fontsize}px calibri`;
|
|
@@ -3200,7 +3248,8 @@ export function CreateSummaryChart(charts: HTMLCanvasElement[], title: string){
|
|
|
3200
3248
|
}
|
|
3201
3249
|
}
|
|
3202
3250
|
|
|
3203
|
-
|
|
3251
|
+
let newCanvas = AddSolidBackground(canvas, 'white');
|
|
3252
|
+
return newCanvas;
|
|
3204
3253
|
}
|
|
3205
3254
|
|
|
3206
3255
|
function getLines(ctx: any, text: string, maxWidth: number) {
|
package/package.json
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
standardized distribution cases to be uppercase. Allowing for uniformity with distributions named after statisticians (Weibull, BoxCox)
|
|
2
|
+
|
|
3
|
+
Changed GoodnessOfFit.Distributions from an array to an object for ease of use in program, added method .toArray(); which returns all of the distributions as an array
|
|
4
|
+
|
|
5
|
+
Changed IndividualDistributionIdentification() to iterate through all supported distributions using the modified AndersonDarling.Test() method which takes distributions as inputes. This change was made to allow consistent support for distributions in future versions.
|
|
6
|
+
|
|
7
|
+
Added new function to Graph Module
|
|
8
|
+
|
|
9
|
+
- AddSolidBackground
|
|
10
|
+
|
|
11
|
+
Removed the draw white background section in CreateSummaryChart() due to bug in creating canvas and replaced with the new AddSolidBackground function
|