@mark1russell7/rigor-statistics 0.1.24 → 0.1.25
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/README.md +2 -0
- package/build/index.d.ts +43 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +71 -1
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -160,6 +160,7 @@ logLoss([{ p: p.a, hit: true }]); // the probability of the obser
|
|
|
160
160
|
| Function | What it gives |
|
|
161
161
|
| --- | --- |
|
|
162
162
|
| `mean`, `sd`, `median`, `summarize` | The descriptive statistics. `sd` is the sample standard deviation. |
|
|
163
|
+
| `runningOf`, `addToRunning`, `mergeRunning`, `runningMean`, `runningSd` | A running summary of a stream: the count, the sum, the extremes and the spread, one value at a time. `mergeRunning` joins the summaries of two parts. `runningMean` gives exactly `mean` of the values. |
|
|
163
164
|
| `quantile(values, p, method)`, `quantileSorted` | The `p` quantile, with the `"linear"` method (type 7, the default), the `"nearest-rank"` method (type 1) or the `"higher"` method (`sorted[Math.ceil(p * (n - 1))]`, as NumPy). |
|
|
164
165
|
| `bootstrap(data, statistic, options)` | A percentile bootstrap interval of any statistic. The options are `runs`, `level` or `ends`, `seed`, `method` and `against`. |
|
|
165
166
|
| The option `against` | The interval also gives `pAbove` and `pBelow`, the bootstrap p of each side of the value, from the same draws. The smallest p is 1 / (`finite` + 1). Give `holm` enough runs: with m tests at level a, `runs` is more than m / a. |
|
|
@@ -299,6 +300,7 @@ The tests prove that these functions give the same numbers as the copies in the
|
|
|
299
300
|
| `spearman` of the highways backtest, `kendallTau` of highways | `spearman`, `kendallTau` |
|
|
300
301
|
| `medianInterval` of the harness and kind of systems | `medianInterval(sortedValues)`, with `low` and `high` |
|
|
301
302
|
| The binomial band of `targetConnections` and `negativeBinomial` of the cells of systems | `binomialInterval(n, p, cover)` and `negativeBinomialInterval(successes, p, cover)` |
|
|
303
|
+
| `summarizingNumber` of collections (`count`, `sum`, `min`, `max`, `average`) | `addToRunning` in the accumulator, then `n`, `sum`, `min`, `max` and `runningMean`. The average was `sum / count`, so the bits stay. |
|
|
302
304
|
|
|
303
305
|
A copy that gives NaN, 0 or `undefined` for an empty list must test the list at the call, because these functions throw.
|
|
304
306
|
|
package/build/index.d.ts
CHANGED
|
@@ -45,6 +45,48 @@ interface Summary {
|
|
|
45
45
|
readonly iqr: number;
|
|
46
46
|
}
|
|
47
47
|
export declare function summarize(values: readonly number[]): Summary;
|
|
48
|
+
/**
|
|
49
|
+
* The running summary: the count, the sum, the extremes and the spread of a stream of values, one value at a time.
|
|
50
|
+
* A collector, a reducer or a parallel job adds each value, or merges two summaries. The summary agrees with the
|
|
51
|
+
* functions of a list: `runningMean` gives exactly `mean` of the values, and `runningSd` gives `sd` to a tolerance.
|
|
52
|
+
*/
|
|
53
|
+
/**
|
|
54
|
+
* A running summary of the values that were added. The record is immutable, so a fold can keep each step. The empty
|
|
55
|
+
* summary is `EMPTY_RUNNING`.
|
|
56
|
+
*/
|
|
57
|
+
interface RunningSummary {
|
|
58
|
+
/** The count of the values. */
|
|
59
|
+
readonly n: number;
|
|
60
|
+
/** The sum of the values, added in their order. */
|
|
61
|
+
readonly sum: number;
|
|
62
|
+
/** The smallest value, or `Infinity` for no value. */
|
|
63
|
+
readonly min: number;
|
|
64
|
+
/** The largest value, or `-Infinity` for no value. */
|
|
65
|
+
readonly max: number;
|
|
66
|
+
/** The sum of the squares of the differences from the mean (Welford). `runningSd` reads it. */
|
|
67
|
+
readonly m2: number;
|
|
68
|
+
}
|
|
69
|
+
/** The summary of no value. It is the unit of `mergeRunning`. */
|
|
70
|
+
export declare const EMPTY_RUNNING: RunningSummary;
|
|
71
|
+
/**
|
|
72
|
+
* This function gives the summary with one more value. It throws a RangeError for NaN, as the functions of a list do.
|
|
73
|
+
* The mean of each step is `sum / n`, so the mean of the fold is the mean of the list.
|
|
74
|
+
*/
|
|
75
|
+
export declare function addToRunning(s: RunningSummary, value: number): RunningSummary;
|
|
76
|
+
/** This function gives the summary of the values of a list or another iterable, in their order. */
|
|
77
|
+
export declare function runningOf(values: Iterable<number>): RunningSummary;
|
|
78
|
+
/**
|
|
79
|
+
* This function gives the summary of the values of two summaries (Chan, Golub and LeVeque, 1979). Thus parallel jobs
|
|
80
|
+
* can each summarize a part. The sum of the merge adds the two sums, so it can differ from the fold in the last bits.
|
|
81
|
+
*/
|
|
82
|
+
export declare function mergeRunning(a: RunningSummary, b: RunningSummary): RunningSummary;
|
|
83
|
+
/** This function gives the mean of the values: `sum / n`. It throws a RangeError for the empty summary. */
|
|
84
|
+
export declare function runningMean(s: RunningSummary): number;
|
|
85
|
+
/**
|
|
86
|
+
* This function gives the sample standard deviation of the values (the divisor is n - 1). It needs 2 values or more.
|
|
87
|
+
* Equal values give exactly 0, as `sd` gives. A rounding error cannot make the result NaN.
|
|
88
|
+
*/
|
|
89
|
+
export declare function runningSd(s: RunningSummary): number;
|
|
48
90
|
/**
|
|
49
91
|
* Ordinary least squares with a Householder QR decomposition. The QR decomposition does not square the condition
|
|
50
92
|
* number of the design, as the normal equations do. A design without full rank gives NaN coefficients and does not
|
|
@@ -1610,5 +1652,5 @@ interface BradleyTerryFit {
|
|
|
1610
1652
|
* outcome, a bad weight and a bad option.
|
|
1611
1653
|
*/
|
|
1612
1654
|
export declare function bradleyTerry(items: number, comparisons: readonly PairComparison[], options?: BradleyTerryOptions): BradleyTerryFit;
|
|
1613
|
-
export type { BinomialSide, BootstrapOptions, BradleyTerryFit, BradleyTerryOptions, CalibrationLevel, CategoricalDimension, CompareOptions, Comparison, ContinuousDimension, Corrected, CountInterval, CoverageBar, CoverageCell, CoverageMinSample, CoverageReason, CoverageStep, Effect, EloOptions, EloUpdate, Forecast, Glicko2Game, Glicko2Options, Glicko2Rating, Interval, Kappa, LeastSquaresFit, LeastSquaresOptions, MedianInterval, ModeOptions, NoiseOptions, NoiseState, NoiseVerdict, OptionFloorOptions, OrdinalDimension, PairComparison, PairOutcome, PairProbabilities, ParsedResponseRecord, PermutationOptions, PermutationResult, Proportion, QuantileInterval, QuantileMethod, RatingScale, ResponseAbsentPoint, ResponseBand, ResponseCurvePoint, ResponseData, ResponseDimension, ResponseDimensionBase, ResponseFactor, ResponseFault, ResponseFitOptions, ResponseFold, ResponseFoldError, ResponseHeldOutError, ResponseInputValue, ResponseMeasure, ResponseModel, ResponseModelBase, ResponsePoint, ResponseReason, ResponseRecord, ResponseSlice, ResponseSliceOptions, ResponseSlicePoint, ResponseSurface, ResponseSurfaceAbsentPoint, ResponseSurfaceOptions, ResponseSurfacePoint, ResponseTableCell, ResponseValue, ResponseViewOptions, ResponseWhen, RidgeInput, RidgeInputBase, RidgeLevelInput, RidgeNumberInput, RidgeOptions, RidgeRankInput, RidgeResponseModel, RidgeTerm, SampleTotalOptions, SideP, SignFlipOptions, SignFlipResult, SmoothLaw, SmoothLawScore, SobolIndex, SobolIndices, SobolOptions, Summary, TableResponseModel, TieModel, TwoSamplePermutationOptions, TwoSamplePermutationResult, UStatisticInterval, UStatisticMean, UStatisticMethod, UStatisticOptions };
|
|
1655
|
+
export type { BinomialSide, BootstrapOptions, BradleyTerryFit, BradleyTerryOptions, CalibrationLevel, CategoricalDimension, CompareOptions, Comparison, ContinuousDimension, Corrected, CountInterval, CoverageBar, CoverageCell, CoverageMinSample, CoverageReason, CoverageStep, Effect, EloOptions, EloUpdate, Forecast, Glicko2Game, Glicko2Options, Glicko2Rating, Interval, Kappa, LeastSquaresFit, LeastSquaresOptions, MedianInterval, ModeOptions, NoiseOptions, NoiseState, NoiseVerdict, OptionFloorOptions, OrdinalDimension, PairComparison, PairOutcome, PairProbabilities, ParsedResponseRecord, PermutationOptions, PermutationResult, Proportion, QuantileInterval, QuantileMethod, RatingScale, ResponseAbsentPoint, ResponseBand, ResponseCurvePoint, ResponseData, ResponseDimension, ResponseDimensionBase, ResponseFactor, ResponseFault, ResponseFitOptions, ResponseFold, ResponseFoldError, ResponseHeldOutError, ResponseInputValue, ResponseMeasure, ResponseModel, ResponseModelBase, ResponsePoint, ResponseReason, ResponseRecord, ResponseSlice, ResponseSliceOptions, ResponseSlicePoint, ResponseSurface, ResponseSurfaceAbsentPoint, ResponseSurfaceOptions, ResponseSurfacePoint, ResponseTableCell, ResponseValue, ResponseViewOptions, ResponseWhen, RidgeInput, RidgeInputBase, RidgeLevelInput, RidgeNumberInput, RidgeOptions, RidgeRankInput, RidgeResponseModel, RidgeTerm, RunningSummary, SampleTotalOptions, SideP, SignFlipOptions, SignFlipResult, SmoothLaw, SmoothLawScore, SobolIndex, SobolIndices, SobolOptions, Summary, TableResponseModel, TieModel, TwoSamplePermutationOptions, TwoSamplePermutationResult, UStatisticInterval, UStatisticMean, UStatisticMethod, UStatisticOptions };
|
|
1614
1656
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/describe.ts","../src/regression.ts","../src/bootstrap.ts","../src/distribution.ts","../src/ridge.ts","../src/response.ts","../src/response-parse.ts","../src/response-fit.ts","../src/response-sobol.ts","../src/tests.ts","../src/agreement.ts","../src/rank.ts","../src/discrete.ts","../src/compare.ts","../src/power.ts","../src/normal.ts","../src/coverage.ts","../src/u-statistic.ts","../src/rating.ts","../src/bradley-terry.ts"],"mappings":";;;;;;;KAOY;;wBAmBI,OAAO;wBAIP,KAAK;;;;;wBAgBL,GAAG;;;;;;;wBAgBH,eAAe,iCAAiC,WAAW,SAAQ;;wBAkBnE,SAAS,2BAA2B,WAAW,SAAQ;;;;;wBASvD,OAAO;;UAQN;WACN;WACA;;WAEA;WACA;;WAEA;WACA;;WAEA;WACA;;WAEA;;wBAGK,UAAU,4BAA4B;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/describe.ts","../src/running.ts","../src/regression.ts","../src/bootstrap.ts","../src/distribution.ts","../src/ridge.ts","../src/response.ts","../src/response-parse.ts","../src/response-fit.ts","../src/response-sobol.ts","../src/tests.ts","../src/agreement.ts","../src/rank.ts","../src/discrete.ts","../src/compare.ts","../src/power.ts","../src/normal.ts","../src/coverage.ts","../src/u-statistic.ts","../src/rating.ts","../src/bradley-terry.ts"],"mappings":";;;;;;;KAOY;;wBAmBI,OAAO;wBAIP,KAAK;;;;;wBAgBL,GAAG;;;;;;;wBAgBH,eAAe,iCAAiC,WAAW,SAAQ;;wBAkBnE,SAAS,2BAA2B,WAAW,SAAQ;;;;;wBASvD,OAAO;;UAQN;WACN;WACA;;WAEA;WACA;;WAEA;WACA;;WAEA;WACA;;WAEA;;wBAGK,UAAU,4BAA4B;;;;;;;;;;UCvGrC;;WAEN;;WAEA;;WAEA;;WAEA;;WAEA;;;qBAIE,eAAe;;;;;wBAMZ,aAAa,GAAG,gBAAgB,gBAAgB;;wBAWhD,UAAU,QAAQ,mBAAmB;;;;;wBAUrC,aAAa,GAAG,gBAAgB,GAAG,iBAAiB;;wBAepD,YAAY,GAAG;;;;;wBASf,UAAU,GAAG;;;;;;UCrEZ;;WAEN;;UAGM;;WAEN;;WAEA;;;;;WAKA;;WAEA;;WAEA;;;;;;;;;;;wBAkBK,aAAa,mCAAmC,sBAAsB,UAAS,sBAA2B;UC7BzG;;WAEN;;WAEA;;WAEA;;WAEA,SAAS;;;;;;WAMT;;;;;WAKA;;;UAIM;;WAEN;;WAEA;;WAEA;;UAGM,iBAAiB,QAAQ;;WAE/B;WACA;WACA;WACA;WACA;;WAEA;;WAEA;;;;;;wBAOK,UAAU,GAAG,eAAe,KAAK,YAAY,iBAAiB,gBAAgB,UAAS,mBAAwB;;;;;;;;wBAsB/G,aAAa,GAAG,GAC9B,YAAY,KACZ,YAAY,KACZ,YAAY,YAAY,KAAK,YAAY,gBACzC,UAAS,mBACR;;;;;;wBAwBa,qBAAqB,8BAA8B,gCAAgC,UAAS,mBAAwB;;;;;;;wBAUpH,sBACd,mCACA,sBACA,UAAS,mBAAmB,sBAC3B;;wBAoGa,gBAAgB,2B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AAe,gBAAgB,eAAe,UAAS,iBAAsB;;;;;wBAuEnG,YAAY,QAAQ,gBAAgB;;UAQnC;;WAEN;;WAEA;;WAEA;;;;;;;wBAuBK,kBAAkB,YAAY,YAAY,eAAU;;;;;wBAWpD,iBAAiB,kBAAkB,UAAS;;wBAO5C,iBAAiB,gBAAgB,UAAS;;KCtO9C;;UAGK;WACN;WACA;WACA,SAAS;;WAET;;;KAIC;;UAGK;;WAEN;;WAEA;;;;;WAKA,OAAO;;;;;WAKP;;WAEA;;WAEA;;;UAIM;;WAEN;;;;;WAKA;;WAEA;;WAEA;;WAEA;;WAEA;;;;;;;wBA6CK,aAAa,eAAe,sBAAsB,kBAAkB,UAAS,sBAA2B"}
|
package/build/index.js
CHANGED
|
@@ -84,6 +84,76 @@ function summarize(values) {
|
|
|
84
84
|
iqr: q3 - q1
|
|
85
85
|
};
|
|
86
86
|
}
|
|
87
|
+
// src/running.ts
|
|
88
|
+
/** The summary of no value. It is the unit of `mergeRunning`. */
|
|
89
|
+
const EMPTY_RUNNING = Object.freeze({
|
|
90
|
+
n: 0,
|
|
91
|
+
sum: 0,
|
|
92
|
+
min: Infinity,
|
|
93
|
+
max: -Infinity,
|
|
94
|
+
m2: 0
|
|
95
|
+
});
|
|
96
|
+
/**
|
|
97
|
+
* This function gives the summary with one more value. It throws a RangeError for NaN, as the functions of a list do.
|
|
98
|
+
* The mean of each step is `sum / n`, so the mean of the fold is the mean of the list.
|
|
99
|
+
*/
|
|
100
|
+
function addToRunning(s, value) {
|
|
101
|
+
if (Number.isNaN(value)) throw new RangeError("addToRunning: the value is NaN.");
|
|
102
|
+
const sum = s.sum + value;
|
|
103
|
+
if (s.n === 0) return {
|
|
104
|
+
n: 1,
|
|
105
|
+
sum,
|
|
106
|
+
min: value,
|
|
107
|
+
max: value,
|
|
108
|
+
m2: 0
|
|
109
|
+
};
|
|
110
|
+
const n = s.n + 1;
|
|
111
|
+
const m2 = s.m2 + (value - s.sum / s.n) * (value - sum / n);
|
|
112
|
+
return {
|
|
113
|
+
n,
|
|
114
|
+
sum,
|
|
115
|
+
min: Math.min(s.min, value),
|
|
116
|
+
max: Math.max(s.max, value),
|
|
117
|
+
m2
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/** This function gives the summary of the values of a list or another iterable, in their order. */
|
|
121
|
+
function runningOf(values) {
|
|
122
|
+
let s = EMPTY_RUNNING;
|
|
123
|
+
for (const v of values) s = addToRunning(s, v);
|
|
124
|
+
return s;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* This function gives the summary of the values of two summaries (Chan, Golub and LeVeque, 1979). Thus parallel jobs
|
|
128
|
+
* can each summarize a part. The sum of the merge adds the two sums, so it can differ from the fold in the last bits.
|
|
129
|
+
*/
|
|
130
|
+
function mergeRunning(a, b) {
|
|
131
|
+
if (a.n === 0) return b;
|
|
132
|
+
if (b.n === 0) return a;
|
|
133
|
+
const n = a.n + b.n;
|
|
134
|
+
const delta = b.sum / b.n - a.sum / a.n;
|
|
135
|
+
return {
|
|
136
|
+
n,
|
|
137
|
+
sum: a.sum + b.sum,
|
|
138
|
+
min: Math.min(a.min, b.min),
|
|
139
|
+
max: Math.max(a.max, b.max),
|
|
140
|
+
m2: a.m2 + b.m2 + delta * delta * a.n / n * b.n
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
/** This function gives the mean of the values: `sum / n`. It throws a RangeError for the empty summary. */
|
|
144
|
+
function runningMean(s) {
|
|
145
|
+
if (s.n === 0) throw new RangeError("runningMean: the summary is empty.");
|
|
146
|
+
return s.sum / s.n;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* This function gives the sample standard deviation of the values (the divisor is n - 1). It needs 2 values or more.
|
|
150
|
+
* Equal values give exactly 0, as `sd` gives. A rounding error cannot make the result NaN.
|
|
151
|
+
*/
|
|
152
|
+
function runningSd(s) {
|
|
153
|
+
if (s.n < 2) throw new RangeError("runningSd: the summary needs 2 values or more.");
|
|
154
|
+
if (s.min === s.max) return 0;
|
|
155
|
+
return Math.sqrt(Math.max(0, s.m2) / (s.n - 1));
|
|
156
|
+
}
|
|
87
157
|
// src/regression.ts
|
|
88
158
|
/**
|
|
89
159
|
* The relative tolerance of the rank test. A column is dependent when the part of it that is orthogonal to the
|
|
@@ -4097,6 +4167,6 @@ function inverseDiagonal(hessian, k) {
|
|
|
4097
4167
|
}
|
|
4098
4168
|
return out;
|
|
4099
4169
|
}
|
|
4100
|
-
export { KENDALL_EXACT, RESPONSE_LAMBDAS, RESPONSE_MAX_POWER, RESPONSE_MAX_TERMS, RESPONSE_RECORDS_SCHEMA, SIGN_FLIP_EXACT_LIMIT, SIGN_FLIP_EXACT_MAX, U_STATISTIC_TIGHT_MIN_SAMPLE, Z95, bestSmoothLaw, binomialInterval, binomialTest, bootstrap, bootstrapClusters, bootstrapLeastSquares, bootstrapMedian, bootstrapMedianRatio, bootstrapStrata, bootstrapTwo, bradleyTerry, brier, calibration, cohenKappa, compareRatios, coverageMinSample, eloExpected, eloUpdate, fitResponse, glicko2Idle, glicko2Update, heldOutError, heldOutErrorAt, holm, kendallTau, leastSquares, logLoss, mean, median, medianInterval, modeCount, negativeBinomialInterval, noiseFloor, noiseVerdict, normalCdf, normalQuantile, optionFloor, pairProbabilities, pairedPermutation, parseResponseRecord, partialConjunction, predictResponse, quantile, quantileInterval, quantileSamples, quantileSorted, ranks, ratingToStrength, responseCells, ridgeSolve, sampleTotalInterval, sd, signFlipTest, signTest, signTestPower, sliceResponse, smoothLawScores, sobolIndices, sorted, spearman, strengthToRating, summarize, surfaceResponse, tQuantile, twoSamplePermutation, uStatisticInterval, whenHolds, wilson, wilsonSampleSize };
|
|
4170
|
+
export { EMPTY_RUNNING, KENDALL_EXACT, RESPONSE_LAMBDAS, RESPONSE_MAX_POWER, RESPONSE_MAX_TERMS, RESPONSE_RECORDS_SCHEMA, SIGN_FLIP_EXACT_LIMIT, SIGN_FLIP_EXACT_MAX, U_STATISTIC_TIGHT_MIN_SAMPLE, Z95, addToRunning, bestSmoothLaw, binomialInterval, binomialTest, bootstrap, bootstrapClusters, bootstrapLeastSquares, bootstrapMedian, bootstrapMedianRatio, bootstrapStrata, bootstrapTwo, bradleyTerry, brier, calibration, cohenKappa, compareRatios, coverageMinSample, eloExpected, eloUpdate, fitResponse, glicko2Idle, glicko2Update, heldOutError, heldOutErrorAt, holm, kendallTau, leastSquares, logLoss, mean, median, medianInterval, mergeRunning, modeCount, negativeBinomialInterval, noiseFloor, noiseVerdict, normalCdf, normalQuantile, optionFloor, pairProbabilities, pairedPermutation, parseResponseRecord, partialConjunction, predictResponse, quantile, quantileInterval, quantileSamples, quantileSorted, ranks, ratingToStrength, responseCells, ridgeSolve, runningMean, runningOf, runningSd, sampleTotalInterval, sd, signFlipTest, signTest, signTestPower, sliceResponse, smoothLawScores, sobolIndices, sorted, spearman, strengthToRating, summarize, surfaceResponse, tQuantile, twoSamplePermutation, uStatisticInterval, whenHolds, wilson, wilsonSampleSize };
|
|
4101
4171
|
|
|
4102
4172
|
//# sourceMappingURL=index.js.map
|