@mark1russell7/rigor-statistics 0.1.19 → 0.1.21

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # @mark1russell7/rigor-statistics
2
2
 
3
- The statistics of measured work. It gives quantiles, bootstrap intervals, the sign test, the paired permutation test, Wilson intervals and the Holm correction. It gives the interval of a median from order statistics, and the central interval of a binomial count. It also gives least squares, rank correlation, the comparison with a baseline beyond the noise, and the Brier score of predictions. It fits response records that a browser can evaluate from plain JSON.
3
+ The statistics of measured work. It gives quantiles, bootstrap intervals, the sign test, the paired permutation test, Wilson intervals and the Holm correction. It gives the interval of a median from order statistics, and the central interval of a binomial count. It also gives least squares, rank correlation, the comparison with a baseline beyond the noise, and the Brier score and the log-loss of predictions. It rates items from pairwise results with Elo, Glicko-2 and a Bradley-Terry fit. It fits response records that a browser can evaluate from plain JSON.
4
4
 
5
5
  ```sh
6
6
  npm install @mark1russell7/rigor-statistics
@@ -100,6 +100,39 @@ A measure with `null` has no value. To tell why, declare the reasons in the fiel
100
100
 
101
101
  The default expansion has one product for each pair of levels of two dimensions. Two dimensions with 76 and 33 levels thus give 2508 products, and the limit `RESPONSE_MAX_TERMS` refuses them. With the option `interactions: "seen"`, a ridge fit keeps only the terms that are not 0 at one point or more. This choice looks only at the inputs of the points. A term with no point has the weight 0, so the choice does not change a prediction. The limit applies after the choice.
102
102
 
103
+ ## Rate items from pairwise results
104
+
105
+ A pairwise result is a comparison of two items: the first item wins, the second item wins, or a tie. Each function of this section is pure, so a log of results gives the same ratings each time.
106
+
107
+ ```ts
108
+ import { bradleyTerry, eloUpdate, glicko2Update, logLoss, pairProbabilities, strengthToRating } from "@mark1russell7/rigor-statistics";
109
+
110
+ // The fit of a full log: the items are indexes from 0.
111
+ const fit = bradleyTerry(3, [
112
+ { a: 0, b: 1, outcome: "a" },
113
+ { a: 1, b: 2, outcome: "tie" },
114
+ { a: 2, b: 0, outcome: "b", weight: 2 },
115
+ ]);
116
+ fit.strengths, fit.se; // the log-strength of each item, with its standard error
117
+ fit.tie; // the Davidson tie parameter
118
+ const p = pairProbabilities(fit.strengths[0], fit.strengths[1], fit.tie); // { a, b, tie }
119
+ strengthToRating(fit.strengths[0]); // 1500 + 400 * log10(e) * strength
120
+
121
+ // One result at a time.
122
+ eloUpdate(1500, 1500, 1, { k: 32 }); // { a: 1516, b: 1484, expected: 0.5 }
123
+ glicko2Update({ rating: 1500, rd: 200, volatility: 0.06 }, [{ rating: 1400, rd: 30, score: 1 }]);
124
+ logLoss([{ p: p.a, hit: true }]); // the probability of the observed outcome
125
+ ```
126
+
127
+ `bradleyTerry` gives the maximum a posteriori fit with a normal prior on each log-strength. The prior keeps an item with only wins finite. An item with no comparison gets the prior mean and the prior SD. A constant added to each strength changes no probability. Thus only the differences have a meaning, and the prior mean sets the center.
128
+
129
+ - The default tie model is the model of Davidson (1970). The probability of a tie is `nu / (exp(d / 2) + exp(-d / 2) + nu)`, with `d` the difference of the strengths.
130
+ - With the option `ties: "half"`, a tie counts as half a win and half a loss of each item, and `tie` is 0.
131
+ - The fit uses Newton steps with a line search. The negative log posterior is convex, so the steps go to its one minimum.
132
+ - The standard errors come from the inverse of the Hessian at the fit. They include the uncertainty of the tie parameter.
133
+
134
+ `glicko2Update` gives the update of one player after one rating period (Glickman, 2012). A test examines the worked example of the paper: 1500, 200 and 0.06 against three opponents give 1464.06, 151.52 and 0.05999. `glicko2Idle` gives the growth of the RD for a period with no games.
135
+
103
136
  ## The functions
104
137
 
105
138
  | Function | What it gives |
@@ -112,7 +145,7 @@ The default expansion has one product for each pair of levels of two dimensions.
112
145
  | `bootstrapTwo(a, b, statistic, options)` | A bootstrap interval of a statistic of two independent samples, for example two arms of a benchmark. Each run draws all of `a`, then all of `b`. |
113
146
  | `bootstrapMedianRatio(numerator, denominator, options)` | The interval of `median(numerator) / median(denominator)`. It is the uncertainty of the ratio, not the spread of the samples. |
114
147
  | `sampleTotalInterval(values, { population, scale })` | The interval of the total of a population from a uniform sample of `m` of its `n` items without replacement. The deviations get the finite population correction `sqrt(1 - m / n)`. `scale` is `n / m` by default. When `m` is `n`, the interval is the estimate. For a small `m`, the interval is too narrow: at `m = 8` of `n = 40`, the coverage is 0.865. For a total over pairs, use `uStatisticInterval`. |
115
- | `uStatisticInterval(totals, { order, population, method, level, range })` | The interval of a total over all sets of `r` units of a population, for example the crossings of all pairs. The input is the total of each unit of a sample without replacement. The estimate is `S * C(n, r) / C(m, r)`. The method `"conservative"` uses the Hoeffding bound of a U-statistic with `floor(m / r)` draws and the `range` of the kernel. It holds at each `m`. The method `"tight"` uses the jackknife variance times `1 - m / n`, and the t quantile with `m - 1` degrees of freedom. This variance is exact for a linear kernel and larger for others. When all the totals are equal, the method `"tight"` uses the method `"conservative"`, or it throws without `range`. The result gives the `method` that it used. At `m = 8`, the coverage of `"tight"` is 0.885 to 0.915 for a skewed kernel. The method `"auto"` needs `range`. It uses `"tight"` from `m = U_STATISTIC_TIGHT_MIN_SAMPLE`. No measured `m` gets 0.95 in each cell, so this constant is infinite. |
148
+ | `uStatisticInterval(totals, { order, population, method, level, range })` | The interval of a total over all sets of `r` units of a population, for example the crossings of all pairs. The input is the total of each unit of a sample without replacement. The estimate is `S * C(n, r) / C(m, r)`. The method `"conservative"` uses the Hoeffding bound of a U-statistic with `floor(m / r)` draws and the `range` of the kernel. It holds at each `m`. The method `"tight"` uses the jackknife variance times `1 - m / n`, and the t quantile with `m - 1` degrees of freedom. This variance is exact for a linear kernel and larger for others. When all the totals are equal, the method `"tight"` uses the method `"conservative"`, or it throws without `range`. The result gives the `method` that it used. At `m = 8`, the coverage of `"tight"` is 0.885 to 0.915 for a skewed kernel. The method `"auto"` needs `range`. It uses `"tight"` from `m = U_STATISTIC_TIGHT_MIN_SAMPLE`. The calibration study `u-statistic-interval` sets this constant with `coverageMinSample`. Until a run of the study gives a value, it is infinite. |
116
149
  | `leastSquares(x, y, { intercept })` | The ordinary least-squares fit of `y` on the rows of `x`, with a QR decomposition. It gives the coefficients, `residualSd`, `r2`, `n` and `k`. A singular design gives NaN coefficients. |
117
150
  | `bootstrapLeastSquares(x, y, options)` | One bootstrap interval for each coefficient of `leastSquares`, from the same draws of whole rows. A singular draw does not count. |
118
151
  | `ridgeSolve(gram, moment, lambda, { free })` | The ridge coefficients from the normal equations `X'X` and `X'y`, with a Cholesky factorization. The `free` coefficients have no penalty. A matrix that is not positive definite gives NaN coefficients. |
@@ -127,6 +160,8 @@ The default expansion has one product for each pair of levels of two dimensions.
127
160
  | `quantileSamples(p, level)` | The fewest independent values that give a quantile an upper bound. At the level 0.95: 72 values for p95, 368 for p99 and 3,688 for p99.9. |
128
161
  | `binomialInterval(n, p, level)`, `negativeBinomialInterval(successes, p, level)` | The central interval of a binomial count, and of a count of failures before `successes` successes. Each tail outside holds `(1 - level) / 2` or less. |
129
162
  | `holm(pValues, level)` | The Holm correction of a family of tests. |
163
+ | `binomialTest(k, n, p, side)` | The p of the exact one-sided binomial test of `k` successes in `n` trials. The side `"less"` gives `P(X <= k)`, and `"greater"` gives `P(X >= k)`. |
164
+ | `coverageMinSample(cells, { level, alpha, pooledLow })` | The smallest sample size `m` from which an interval method keeps its level, from the hits of seeded cells. A size qualifies when the cells with a sample of that size or more pass two tests. No cell rejects `level` in `binomialTest` after `holm` at `alpha`, and the `wilson` lower end of the pooled hits is `pooledLow` or more. The set is closed upward: the result is the smallest `m` such that each size of `m` or more qualifies. `blocking` gives the largest size that fails. When the largest size fails, the result is `Infinity`. Fix the bar before the run. |
130
165
  | `partialConjunction(pValues, need)` | The p of the claim that at least `need` of these tests have a real effect. |
131
166
  | `spearman`, `kendallTau`, `ranks` | The rank correlations, with mean ranks for ties. |
132
167
  | `compareRatios`, `noiseFloor`, `noiseVerdict` | The comparison with a baseline, the noise floor of the 5-seed rule with a margin of practical effect, and the state of a difference over the seeds. |
@@ -134,6 +169,12 @@ The default expansion has one product for each pair of levels of two dimensions.
134
169
  | `modeCount(values, { minShare, valleyRatio })` | The count of the modes of a sample, from a kernel density estimate. |
135
170
  | `smoothLawScores(values)`, `bestSmoothLaw(values)` | The mean log density of the uniform, normal, exponential, log-normal and Pareto laws at their fits, and the best of them. |
136
171
  | `brier`, `calibration` | The Brier score of predictions, and the hit rate of each stated level. |
172
+ | `logLoss(forecasts)` | The mean log-loss of predictions, with the natural log. A p of 0 for a hit gives Infinity. |
173
+ | `eloExpected(ra, rb, { scale, base })`, `eloUpdate(ra, rb, score, { k, scale, base })` | The expected score of the first item, and the ratings of a pair after one result. The defaults are 400, 10 and a `k` of 32. |
174
+ | `glicko2Update(player, games, { tau, tolerance })`, `glicko2Idle(player)` | The Glicko-2 rating, RD and volatility after one rating period, and after a period with no games. The default `tau` is 0.5. |
175
+ | `bradleyTerry(items, comparisons, options)` | The Bradley-Terry fit of pairwise comparisons, with a normal prior and Davidson ties. It gives the strengths, the standard errors, the tie parameter, the log-likelihood, the steps and `converged`. |
176
+ | `pairProbabilities(sa, sb, tie)` | The probabilities of a win of each item and of a tie, from two log-strengths and the tie parameter. |
177
+ | `strengthToRating(strength, { center, scale, base })`, `ratingToStrength(rating, options)` | The rating of a log-strength, `center + scale * strength / ln(base)`, and the inverse. |
137
178
  | `fitResponse(data, options)` | A record of the format `response-records/1`, with one model for each measure and held-out folds. |
138
179
  | `parseResponseRecord(value)` | The examination of unknown data. It gives the record, or one fault with a path for each error. |
139
180
  | `predictResponse(model, inputs)`, `heldOutError(record, measure)` | The value of a model at one set of inputs, and the error of the folds of a measure. |
package/build/index.d.ts CHANGED
@@ -938,6 +938,23 @@ interface CountInterval {
938
938
  * or less. The two tails are separate sums, so that a small upper tail keeps its digits.
939
939
  */
940
940
  export declare function binomialInterval(n: number, p: number, level?: number): CountInterval;
941
+ /** The side of `binomialTest`: `"less"` gives `P(X <= k)`, and `"greater"` gives `P(X >= k)`. */
942
+ type BinomialSide = "less" | "greater";
943
+ /**
944
+ * This function gives the p of the exact one-sided binomial test of `k` successes in `n` trials, with
945
+ * X ~ Binomial(n, p). The side `"less"` gives `P(X <= k)`. A small value rejects the claim "the chance is `p` or
946
+ * more". The side `"greater"` gives `P(X >= k)`. A small value rejects the claim "the chance is `p` or less".
947
+ *
948
+ * The sum starts at the largest term of the tail, so a small tail keeps its digits. At `p = 1/2`, the side
949
+ * `"greater"` is equal to the one-sided `signTest(k, n - k)`.
950
+ *
951
+ * @param k - The count of successes, a whole number from 0 to `n`.
952
+ * @param n - The count of trials, a whole number of 0 or more.
953
+ * @param p - The chance of a success under the claim, from 0 to 1.
954
+ * @param side - The side of the tail.
955
+ * @returns The p of the test, from 0 to 1.
956
+ */
957
+ export declare function binomialTest(k: number, n: number, p: number, side: BinomialSide): number;
941
958
  /**
942
959
  * The central interval of a negative binomial count. X is the count of failures before `successes` successes, and
943
960
  * `p` is the chance of a success at each try. `low` is the smallest k with P(X <= k) > (1 - level) / 2.
@@ -1043,6 +1060,12 @@ interface Forecast {
1043
1060
  }
1044
1061
  /** The Brier score: the mean of (p - outcome)^2. 0 is perfect, and 0.25 is a constant 0.5. Lower is better. */
1045
1062
  export declare function brier(forecasts: readonly Forecast[]): number;
1063
+ /**
1064
+ * The log-loss of predictions: the mean of `-ln(p)` for a hit and `-ln(1 - p)` for a miss. 0 is perfect, and
1065
+ * `ln(2)` is a constant 0.5. Lower is better. A p of 0 for a hit gives Infinity. For an outcome of three values,
1066
+ * give the probability of the observed outcome as `p`, with `hit` true.
1067
+ */
1068
+ export declare function logLoss(forecasts: readonly Forecast[]): number;
1046
1069
  /** The predictions of one stated level. */
1047
1070
  interface CalibrationLevel {
1048
1071
  readonly stated: number;
@@ -1090,12 +1113,92 @@ interface OptionFloorOptions {
1090
1113
  * @returns A whole number of 2 or more.
1091
1114
  */
1092
1115
  export declare function optionFloor(options: OptionFloorOptions): number;
1116
+ /** One cell of a coverage study: the hits of a method on the true value in `draws` seeded samples of size `sample`. */
1117
+ interface CoverageCell {
1118
+ /** The name of the cell, for example `"skewed 120/108"`. The result names the rejected cells with it. */
1119
+ readonly name: string;
1120
+ /** The sample size `m` of the cell, a whole number of 1 or more. */
1121
+ readonly sample: number;
1122
+ /** The count of samples whose interval holds the true value, a whole number from 0 to `draws`. */
1123
+ readonly hits: number;
1124
+ /** The count of samples of the cell, a whole number of 1 or more. */
1125
+ readonly draws: number;
1126
+ }
1127
+ /** The bar of `coverageMinSample`. Fix it before the run, and do not change it after the run. */
1128
+ interface CoverageBar {
1129
+ /** The coverage that the method claims, for example 0.95. Each cell has a one-sided exact binomial test of it. */
1130
+ readonly level: number;
1131
+ /** The level of the Holm family of the cell tests, for example 0.05. */
1132
+ readonly alpha: number;
1133
+ /** The smallest Wilson lower end of the pooled coverage, for example 0.94. */
1134
+ readonly pooledLow: number;
1135
+ /** The z of the Wilson interval. The default is `Z95`. */
1136
+ readonly z?: number;
1137
+ }
1138
+ /** The reason of one step: `"qualifies"`, or the test or tests that failed. */
1139
+ type CoverageReason = "qualifies" | "cell-rejected" | "pooled-low" | "cell-rejected-and-pooled-low";
1140
+ /** The result of the bar at one sample size `m`, over each cell with a sample of `m` or more. */
1141
+ interface CoverageStep {
1142
+ /** The sample size `m` of the step. */
1143
+ readonly sample: number;
1144
+ /** The count of cells with a sample of `m` or more. */
1145
+ readonly cells: number;
1146
+ /** The names of the cells that reject the coverage `level`, after the Holm correction. */
1147
+ readonly rejected: readonly string[];
1148
+ /** The smallest Holm-adjusted p of the cells of the step. */
1149
+ readonly smallestAdjusted: number;
1150
+ /** The sum of the hits of the cells of the step. */
1151
+ readonly hits: number;
1152
+ /** The sum of the draws of the cells of the step. */
1153
+ readonly draws: number;
1154
+ /** The Wilson interval of the pooled coverage `hits / draws`. */
1155
+ readonly pooled: Proportion;
1156
+ /** The sample size `m` passes the two tests of the bar. */
1157
+ readonly qualifies: boolean;
1158
+ readonly reason: CoverageReason;
1159
+ }
1160
+ /** The result of `coverageMinSample`. */
1161
+ interface CoverageMinSample {
1162
+ /**
1163
+ * The smallest sample size `m` of the cells such that each size of `m` or more passes the bar. It is infinite when
1164
+ * the largest size fails.
1165
+ */
1166
+ readonly minSample: number;
1167
+ /** The largest sample size that fails the bar. It blocks each smaller size. The result has no `blocking` when each size passes. */
1168
+ readonly blocking?: number;
1169
+ /** One step for each sample size of the cells, from the smallest to the largest. */
1170
+ readonly steps: readonly CoverageStep[];
1171
+ }
1172
+ /**
1173
+ * This function applies a fixed bar of coverage to the cells of a study. It gives the smallest sample size `m` from
1174
+ * which an interval method keeps its level. The method qualifies at `m` when the cells with a sample of `m` or more
1175
+ * pass two tests:
1176
+ *
1177
+ * 1. No cell rejects the coverage `level`. Each cell has the exact one-sided binomial test `P(X <= hits)`, with
1178
+ * X ~ Binomial(draws, level). The family of these tests gets the Holm correction at `alpha`.
1179
+ * 2. The Wilson lower end of the pooled coverage, the sum of the hits over the sum of the draws, is `pooledLow`
1180
+ * or more.
1181
+ *
1182
+ * Each step tells the result of the two tests at its `m`. A step does not depend on the steps of other sizes. At a
1183
+ * small `m`, the pool also holds the cells of the larger sizes. Thus a small `m` can pass while a larger `m` fails
1184
+ * alone, for example near `m = n`.
1185
+ *
1186
+ * Thus the set of sizes is closed upward. The result is the smallest `m` of the cells such that each size of `m` or
1187
+ * more qualifies. The field `blocking` gives the largest size that fails. When the largest size fails, the result is
1188
+ * infinite.
1189
+ *
1190
+ * @param cells - The hits and the draws of each cell. Each cell has its own sample size.
1191
+ * @param bar - The level, the alpha of the Holm family and the pooled lower end.
1192
+ * @returns The smallest size from which each size qualifies, the size that blocks, and the result at each size.
1193
+ */
1194
+ export declare function coverageMinSample(cells: readonly CoverageCell[], bar: CoverageBar): CoverageMinSample;
1093
1195
  /** The methods of `uStatisticInterval`. The method `"auto"` selects one of the other two for each sample. */
1094
1196
  type UStatisticMethod = "conservative" | "tight" | "auto";
1095
1197
  /**
1096
- * The smallest sample `m` at which the method `"auto"` uses the method `"tight"`. The value comes from the pinned
1097
- * counts of the tests. No measured `m` obeys the rule, so the value is infinite. The TSDoc of `uStatisticInterval`
1098
- * gives the rule and the counts.
1198
+ * The smallest sample `m` at which the method `"auto"` uses the method `"tight"`. The calibration study
1199
+ * `u-statistic-interval` gives the value with `coverageMinSample`. The value is the smallest `m` of the grid such that
1200
+ * each `m` of the grid from this value up passes the bar. Until a run of the study gives a value, the value is
1201
+ * infinite. The TSDoc of `uStatisticInterval` gives the bar of the study.
1099
1202
  */
1100
1203
  export declare const U_STATISTIC_TIGHT_MIN_SAMPLE: number;
1101
1204
  /** The options of `uStatisticInterval`. */
@@ -1196,10 +1299,20 @@ interface UStatisticInterval {
1196
1299
  * The method `"auto"` needs `range`. It uses the method `"tight"` when `m` is `U_STATISTIC_TIGHT_MIN_SAMPLE` or more
1197
1300
  * and the variance is more than 0. Otherwise, it uses the method `"conservative"`.
1198
1301
  *
1199
- * The rule for `U_STATISTIC_TIGHT_MIN_SAMPLE` is the smallest `m` of the table with 190 of 200 or more in each cell.
1200
- * No `m` of the table obeys the rule. The last `m` with a count below 190 is 108, the largest `m` of the table. The
1201
- * table has no larger `m`, so the constant is infinite. Thus the method `"auto"` uses the method `"conservative"` at
1202
- * each `m` less than `n`.
1302
+ * The calibration study `u-statistic-interval` sets `U_STATISTIC_TIGHT_MIN_SAMPLE`. Its bar was fixed before its run.
1303
+ * The study draws 1000 samples in each cell of the 3 kernels and the 17 cells of the table. The method `"tight"`
1304
+ * qualifies at `m` when the cells with a sample of `m` or more pass two tests.
1305
+ *
1306
+ * First, no cell rejects the coverage 0.95 in a one-sided exact binomial test at alpha 0.05, with the Holm
1307
+ * correction over these cells. Second, the Wilson lower end of the pooled coverage of these cells is 0.94 or more.
1308
+ * `coverageMinSample` applies this bar.
1309
+ *
1310
+ * The set of sizes is closed upward. The constant is the smallest `m` of the grid such that each `m` of the grid from
1311
+ * this value up qualifies. A small `m` pools the good cells of the larger sizes, so it can pass while a larger `m`
1312
+ * fails alone. The upward rule keeps the method `"auto"` away from a size that failed.
1313
+ *
1314
+ * When the largest `m` fails, the constant is infinite. Until a run of the study gives a value, the constant is infinite. Thus the method `"auto"`
1315
+ * uses the method `"conservative"` at each `m` less than `n`.
1203
1316
  *
1204
1317
  * With `range`, the interval of the mean stays in `[a, b]`, and each total is in the range of a sum of
1205
1318
  * `C(m - 1, r - 1)` kernel values.
@@ -1209,5 +1322,156 @@ interface UStatisticInterval {
1209
1322
  * @returns The estimate and the interval of the total, and of the mean of the kernel.
1210
1323
  */
1211
1324
  export declare function uStatisticInterval(totals: readonly number[], options: UStatisticOptions): UStatisticInterval;
1212
- export type { BootstrapOptions, CalibrationLevel, CategoricalDimension, CompareOptions, Comparison, ContinuousDimension, Corrected, CountInterval, Effect, Forecast, Interval, Kappa, LeastSquaresFit, LeastSquaresOptions, MedianInterval, ModeOptions, NoiseOptions, NoiseState, NoiseVerdict, OptionFloorOptions, OrdinalDimension, ParsedResponseRecord, PermutationOptions, PermutationResult, Proportion, QuantileInterval, QuantileMethod, 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, SmoothLaw, SmoothLawScore, Summary, TableResponseModel, TwoSamplePermutationOptions, TwoSamplePermutationResult, UStatisticInterval, UStatisticMean, UStatisticMethod, UStatisticOptions };
1325
+ /**
1326
+ * The ratings of pairwise results. This module gives the Elo update and the Glicko-2 update of one rating period. It
1327
+ * also gives the probabilities of a pair under the Bradley-Terry model with Davidson ties, and the conversion between
1328
+ * a log-strength and a rating. Each function is pure. It changes no input, and the same inputs give the same result.
1329
+ */
1330
+ /** The scale of a rating. A difference of `scale` points gives odds of `base` to 1. */
1331
+ interface RatingScale {
1332
+ /** The rating of the log-strength 0. The default is 1500. Elo uses only differences, so it does not read it. */
1333
+ readonly center?: number;
1334
+ /** The number of points that gives odds of `base` to 1. The default is 400. */
1335
+ readonly scale?: number;
1336
+ /** The base of the odds. The default is 10. */
1337
+ readonly base?: number;
1338
+ }
1339
+ /** The options of an Elo update. */
1340
+ interface EloOptions extends RatingScale {
1341
+ /** The largest change of a rating after one result (the K factor). The default is 32. */
1342
+ readonly k?: number;
1343
+ }
1344
+ /** The ratings of a pair after one result. */
1345
+ interface EloUpdate {
1346
+ /** The new rating of the first item. */
1347
+ readonly a: number;
1348
+ /** The new rating of the second item. */
1349
+ readonly b: number;
1350
+ /** The expected score of the first item before the result. */
1351
+ readonly expected: number;
1352
+ }
1353
+ /**
1354
+ * The expected score of the first item against the second item: `1 / (1 + base ** ((rb - ra) / scale))`. A win
1355
+ * counts 1, a tie 0.5 and a loss 0. The expected score of the second item is 1 minus this value.
1356
+ */
1357
+ export declare function eloExpected(ra: number, rb: number, options?: RatingScale): number;
1358
+ /**
1359
+ * The Elo update of a pair after one result. The `score` is the score of the first item: 1 for a win, 0.5 for a tie
1360
+ * and 0 for a loss. Each rating moves by `k` times the difference between the score and the expected score. Thus
1361
+ * the sum of the two ratings does not change.
1362
+ */
1363
+ export declare function eloUpdate(ra: number, rb: number, score: number, options?: EloOptions): EloUpdate;
1364
+ /** A Glicko-2 rating on the Glicko scale: the rating, the rating deviation (RD) and the volatility. */
1365
+ interface Glicko2Rating {
1366
+ readonly rating: number;
1367
+ /** The rating deviation, in rating points. It is above 0. */
1368
+ readonly rd: number;
1369
+ /** The volatility: the expected size of a change of the true strength in one rating period. It is above 0. */
1370
+ readonly volatility: number;
1371
+ }
1372
+ /** One game of a rating period: the rating and the RD of the opponent, and the score of the player. */
1373
+ interface Glicko2Game {
1374
+ readonly rating: number;
1375
+ readonly rd: number;
1376
+ /** The score of the player: 1 for a win, 0.5 for a tie and 0 for a loss. */
1377
+ readonly score: number;
1378
+ }
1379
+ /** The options of a Glicko-2 update. */
1380
+ interface Glicko2Options {
1381
+ /** The constraint on the change of the volatility over time (tau). The default is 0.5. Glickman uses 0.3 to 1.2. */
1382
+ readonly tau?: number;
1383
+ /** The tolerance of the iteration for the new volatility (epsilon). The default is 0.000001, as in the paper. */
1384
+ readonly tolerance?: number;
1385
+ }
1386
+ /**
1387
+ * The Glicko-2 update of one player after one rating period (Glickman, "Example of the Glicko-2 system", 2012). The
1388
+ * function uses the Illinois algorithm for the new volatility. The games use the ratings of the opponents from the
1389
+ * start of the period. An empty list of games gives `glicko2Idle(player)`.
1390
+ */
1391
+ export declare function glicko2Update(player: Glicko2Rating, games: readonly Glicko2Game[], options?: Glicko2Options): Glicko2Rating;
1392
+ /**
1393
+ * The Glicko-2 rating of a player after a rating period with no games. The rating and the volatility stay the same.
1394
+ * The RD grows to `sqrt(RD^2 + (173.7178 * volatility)^2)`.
1395
+ */
1396
+ export declare function glicko2Idle(player: Glicko2Rating): Glicko2Rating;
1397
+ /** The probabilities of the three outcomes of a pair. Their sum is 1. */
1398
+ interface PairProbabilities {
1399
+ /** The probability that the first item wins. */
1400
+ readonly a: number;
1401
+ /** The probability that the second item wins. */
1402
+ readonly b: number;
1403
+ /** The probability of a tie. It is 0 when the tie parameter is 0. */
1404
+ readonly tie: number;
1405
+ }
1406
+ /**
1407
+ * The probabilities of a pair under the Bradley-Terry model with Davidson (1970) ties. The inputs are the
1408
+ * log-strengths of the two items and the tie parameter `tie` of `bradleyTerry`. With `tie` 0, the probability that
1409
+ * the first item wins is `1 / (1 + exp(sb - sa))`. A constant added to the two strengths changes no probability.
1410
+ */
1411
+ export declare function pairProbabilities(sa: number, sb: number, tie?: number): PairProbabilities;
1412
+ /**
1413
+ * The rating of a log-strength: `center + scale * strength / ln(base)`. The defaults give
1414
+ * `1500 + 400 * log10(e) * strength`. Thus `eloExpected` of two ratings is the Bradley-Terry win probability.
1415
+ */
1416
+ export declare function strengthToRating(strength: number, options?: RatingScale): number;
1417
+ /** The log-strength of a rating. It is the inverse of `strengthToRating` with the same options. */
1418
+ export declare function ratingToStrength(rating: number, options?: RatingScale): number;
1419
+ /** The result of a comparison: the first item wins, the second item wins, or a tie. */
1420
+ type PairOutcome = "a" | "b" | "tie";
1421
+ /** One comparison of two items, by their indexes from 0. */
1422
+ interface PairComparison {
1423
+ readonly a: number;
1424
+ readonly b: number;
1425
+ readonly outcome: PairOutcome;
1426
+ /** The weight of the comparison. The default is 1. A weight of 2 counts as two equal comparisons. */
1427
+ readonly weight?: number;
1428
+ }
1429
+ /** The model of a tie. */
1430
+ type TieModel = "davidson" | "half";
1431
+ /** The options of `bradleyTerry`. */
1432
+ interface BradleyTerryOptions {
1433
+ /** The mean of the prior of each log-strength. The default is 0. */
1434
+ readonly priorMean?: number;
1435
+ /** The standard deviation of the prior of each log-strength. The default is 1. A smaller value pulls the strengths together. */
1436
+ readonly priorSd?: number;
1437
+ /**
1438
+ * The model of a tie. With `"davidson"` (the default), the fit also gives a tie parameter. With `"half"`, a tie
1439
+ * counts as half a win and half a loss of each item, and the tie parameter is 0.
1440
+ */
1441
+ readonly ties?: TieModel;
1442
+ /**
1443
+ * The standard deviation of the normal prior of the log of the tie parameter, with mean 0. The default is 10. The
1444
+ * prior is weak. It keeps the parameter finite when each comparison is a tie.
1445
+ */
1446
+ readonly tiePriorSd?: number;
1447
+ /** The largest number of Newton steps. The default is 100. */
1448
+ readonly maxIterations?: number;
1449
+ /** The fit stops when the full Newton step moves no parameter more than this value. The default is 1e-10. */
1450
+ readonly tolerance?: number;
1451
+ }
1452
+ /** The result of `bradleyTerry`. The lists have one value for each item, in the order of the indexes. */
1453
+ interface BradleyTerryFit {
1454
+ /** The log-strength of each item. An item with no comparison has the prior mean. */
1455
+ readonly strengths: number[];
1456
+ /**
1457
+ * The standard error of each log-strength: the square root of the diagonal of the inverse of the Hessian of the
1458
+ * negative log posterior. An item with no comparison has the prior SD.
1459
+ */
1460
+ readonly se: number[];
1461
+ /** The Davidson tie parameter. It is 0 with the model `"half"`, and when no comparison is a tie. */
1462
+ readonly tie: number;
1463
+ /** The log-likelihood of the comparisons at the fit, with no prior term. */
1464
+ readonly logLikelihood: number;
1465
+ /** The number of Newton steps. */
1466
+ readonly iterations: number;
1467
+ /** True when the last full Newton step moved no parameter more than the tolerance. */
1468
+ readonly converged: boolean;
1469
+ }
1470
+ /**
1471
+ * The Bradley-Terry fit of `comparisons` among `items` items. The function does not sort or change its inputs. An
1472
+ * empty list of comparisons gives the prior for each item. The function throws a RangeError for a bad index, a bad
1473
+ * outcome, a bad weight and a bad option.
1474
+ */
1475
+ export declare function bradleyTerry(items: number, comparisons: readonly PairComparison[], options?: BradleyTerryOptions): BradleyTerryFit;
1476
+ 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, SmoothLaw, SmoothLawScore, Summary, TableResponseModel, TieModel, TwoSamplePermutationOptions, TwoSamplePermutationResult, UStatisticInterval, UStatisticMean, UStatisticMethod, UStatisticOptions };
1213
1477
  //# sourceMappingURL=index.d.ts.map
@@ -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/tests.ts","../src/agreement.ts","../src/rank.ts","../src/discrete.ts","../src/compare.ts","../src/power.ts","../src/u-statistic.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;;;;;;UC3GrC;;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,UAA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WAEN;;WAEA;;WAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAyEK,mBAAmB,2BAA2B,SAAS,oBAAoB"}
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/tests.ts","../src/agreement.ts","../src/rank.ts","../src/discrete.ts","../src/compare.ts","../src/power.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;;;;;;UC3GrC;;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;;wB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