@compstats/core 0.3.0 → 0.4.0
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/CHANGELOG.md +71 -0
- package/README.md +117 -116
- package/dist/3d.js +1120 -122
- package/dist/3d.js.map +16 -9
- package/dist/core/arith.d.ts.map +1 -1
- package/dist/core/linalg/cov.d.ts +50 -0
- package/dist/core/linalg/cov.d.ts.map +1 -0
- package/dist/core/linalg/eigen.d.ts +53 -0
- package/dist/core/linalg/eigen.d.ts.map +1 -0
- package/dist/core/linalg/lm.d.ts +78 -0
- package/dist/core/linalg/lm.d.ts.map +1 -0
- package/dist/core/linalg/lu.d.ts +154 -0
- package/dist/core/linalg/lu.d.ts.map +1 -0
- package/dist/core/linalg/matrix.d.ts +131 -0
- package/dist/core/linalg/matrix.d.ts.map +1 -0
- package/dist/core/linalg/modelMatrix.d.ts +69 -0
- package/dist/core/linalg/modelMatrix.d.ts.map +1 -0
- package/dist/core/linalg/namedVector.d.ts +37 -0
- package/dist/core/linalg/namedVector.d.ts.map +1 -0
- package/dist/core/linalg/ops.d.ts +120 -0
- package/dist/core/linalg/ops.d.ts.map +1 -0
- package/dist/core/linalg/prcomp.d.ts +66 -0
- package/dist/core/linalg/prcomp.d.ts.map +1 -0
- package/dist/core/linalg/qr.d.ts +134 -0
- package/dist/core/linalg/qr.d.ts.map +1 -0
- package/dist/core/linalg/vector.d.ts +68 -0
- package/dist/core/linalg/vector.d.ts.map +1 -0
- package/dist/core/moderation.d.ts +6 -3
- package/dist/core/moderation.d.ts.map +1 -1
- package/dist/core/ols.d.ts +4 -7
- package/dist/core/ols.d.ts.map +1 -1
- package/dist/data/moderationData.d.ts +2 -2
- package/dist/data/pcaDegenerate.d.ts +1 -1
- package/dist/index.js +1455 -863
- package/dist/index.js.map +16 -10
- package/dist/linalg.d.ts +36 -0
- package/dist/linalg.d.ts.map +1 -0
- package/dist/linalg.js +1860 -0
- package/dist/linalg.js.map +24 -0
- package/dist/plot/moderation3d.d.ts +1 -1
- package/dist/plot/scatter3d.d.ts +1 -1
- package/package.json +7 -2
package/dist/index.js.map
CHANGED
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
|
-
"sources": ["../src/core/precision.ts", "../src/core/arith.ts", "../src/core/kde.ts", "../src/core/pretty.ts", "../src/core/histogram.ts", "../src/core/rng.ts", "../src/core/sampling.ts", "../src/core/frame.ts", "../src/core/
|
|
3
|
+
"sources": ["../src/core/precision.ts", "../src/core/arith.ts", "../src/core/kde.ts", "../src/core/pretty.ts", "../src/core/histogram.ts", "../src/core/rng.ts", "../src/core/sampling.ts", "../src/core/frame.ts", "../src/core/special.ts", "../src/core/tdist.ts", "../src/core/linalg/matrix.ts", "../src/core/linalg/modelMatrix.ts", "../src/core/linalg/namedVector.ts", "../src/core/linalg/ops.ts", "../src/core/linalg/qr.ts", "../src/core/linalg/lm.ts", "../src/core/moderation.ts", "../src/core/regression.ts", "../src/core/matrix.ts", "../src/core/pca.ts", "../src/core/ols.ts", "../src/core/logit.ts", "../src/core/ttest.ts", "../src/data/moderationData.ts", "../src/data/pcaDegenerate.ts", "../src/plot/target.ts", "../src/plot/axes.ts", "../src/plot/draw.ts", "../src/plot/matrixInverse.ts", "../src/plot/format.ts", "../src/plot/logit.ts", "../src/plot/sampleCi.ts", "../src/plot/sampling.ts", "../src/plot/pca.ts", "../src/plot/regression.ts", "../src/plot/tTest.ts", "../src/interactive/target.ts", "../src/interactive/controls.ts", "../src/interactive/matrixInverse.ts", "../src/interactive/sampling.ts", "../src/interactive/tTest.ts", "../src/interactive/logit.ts", "../src/interactive/pca.ts", "../src/interactive/regression.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
5
|
"/**\n * Report the machine precision of the runtime.\n *\n * The value is the smallest number x such that 1 + x is not equal to 1.\n * It is the equivalent of `.Machine$double.eps` in R.\n *\n * @returns The double-precision epsilon.\n */\nexport function machinePrecision(): number {\n return Number.EPSILON;\n}\n",
|
|
6
|
-
"/**\n * Shared array arithmetic for the core modules.\n *\n * Use these helpers with `map` instead of index-based loops. See the\n * iteration convention in CLAUDE.md.\n */\n\n/** Add all values. Return 0 for an empty array. */\nexport function sum(values: readonly number[]): number {\n return values.reduce((total, value) => total + value, 0);\n}\n\n/** Return the arithmetic mean. Return NaN for an empty array. */\nexport function mean(values: readonly number[]): number {\n return sum(values) / values.length;\n}\n\n/**\n * Return the smallest and the largest value, as R's `range()` does.\n *\n * Written as a fold rather than `Math.min(...values)`, which overflows the\n * call stack on a long column.\n *\n * @param values The observations.\n * @returns The lowest and the highest value. An empty array returns\n * [Infinity, -Infinity], the shape of R's `range(numeric(0))`.\n *\n * A comparison keeps the accumulator when it is false, so a NaN entry is\n * skipped rather than carried through. No caller supports NaN input: the\n * modules that call this either drop the non-finite values first or state\n * that they do not handle R's NA.\n */\nexport function extent(values: readonly number[]): [number, number] {\n return values.reduce<[number, number]>(\n ([low, high], value) => [\n value < low ? value : low,\n value > high ? value : high,\n ],\n [Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY],\n );\n}\n\n/**\n * Map a negative zero to a positive one.\n *\n * A computed zero can come out of an algorithm with a sign that R's own\n * zeros never carry: of 1498 zero entries of a matrix inverse over a sweep of\n * 20000 slider settings, R gives a positive zero every time.\n */\nexport function withoutNegativeZero(value: number): number {\n return value === 0 ? 0 : value;\n}\n\n/** Reject a count that is not a non-negative integer. */\nexport function requireCount(value: number, name: string): void {\n if (!Number.isInteger(value) || value < 0) {\n throw new RangeError(`${name} must be a non-negative integer, got ${value}`);\n }\n}\n\n/**\n * Combine two arrays element by element.\n *\n * Stop at the end of the shorter array.\n */\nexport function zipWith<A, B, C>(\n as: readonly A[],\n bs: readonly B[],\n combine: (a: A, b: B) => C,\n): C[] {\n const length = Math.min(as.length, bs.length);\n // The slice bounds the index, so the access cannot be undefined.\n return as.slice(0, length).map((a, index) => combine(a, bs[index] as B));\n}\n\n/**\n * Return the standard deviation, with the n − 1 denominator of R's `sd()`.\n *\n * @param values The observations.\n * @returns The standard deviation, or NaN below two values. R returns NA\n * there, with a warning that a library cannot give.\n */\nexport function sd(values: readonly number[]): number {\n if (values.length < 2) {\n return Number.NaN;\n }\n\n const center = mean(values);\n const squares = values.map((value) => (value - center) * (value - center));\n return Math.sqrt(sum(squares) / (values.length - 1));\n}\n\n/**\n * Return the mean absolute deviation, `mean(|x - mean(x)|)`.\n *\n * R base has no function for this. R's `mad()` is the *median* absolute\n * deviation from the median, scaled by 1.4826, which is a different\n * statistic. A caller that shows either one to a reader must write the name\n * in full, because the abbreviation covers both.\n *\n * The sampling demonstration offers this as one of its choices of statistic.\n * It measures spread in the units of the data, as the standard deviation\n * does, but a value far from the mean moves it less, because the distance is\n * not squared.\n *\n * @param values The observations.\n * @returns The mean distance from the mean. One value gives 0, because it\n * sits at its own mean. No values gives NaN, as `mean` does.\n */\nexport function meanAbsoluteDeviation(values: readonly number[]): number {\n const center = mean(values);\n return mean(values.map((value) => Math.abs(value - center)));\n}\n\n/**\n * Return `a * b + c`, rounded once.\n *\n * Written as `a * b + c`, JavaScript rounds twice — once for the product,\n * once for the sum — and the two roundings show. R's `seq.int` rounds once\n * and lands one unit in the last place away often enough to change a tick.\n * The linear algebra in `matrix.ts` needs the same: the compiler of the R\n * install the fixtures come from contracts a multiply and an add into one\n * instruction, so a matrix near singular differs in every digit without it.\n *\n * The two helpers below split each operation into the value a double can\n * hold plus the part it drops, so the dropped parts can be added back before\n * the one rounding that remains. Both are the standard error-free\n * transformations (Dekker 1971, Knuth). Both need every intermediate to stay\n * in range, which fails only within a factor of 2^28 of the largest double.\n * There the plain form is used: the result is already dominated by its own\n * overflow.\n */\nexport function fusedMultiplyAdd(a: number, b: number, c: number): number {\n const [product, productError] = twoProduct(a, b);\n const [sum, sumError] = twoSum(c, product);\n const rounded = sum + (sumError + productError);\n return Number.isFinite(rounded) ? rounded : a * b + c;\n}\n\n/** Split a double into two halves whose product is exact. Dekker's method. */\nfunction split(value: number): [number, number] {\n const scaled = 134217729 * value;\n const high = scaled - (scaled - value);\n return [high, value - high];\n}\n\n/** Return the product and the part of it the product cannot hold. */\nfunction twoProduct(a: number, b: number): [number, number] {\n const product = a * b;\n const [aHigh, aLow] = split(a);\n const [bHigh, bLow] = split(b);\n const error =\n aLow * bLow - (product - aHigh * bHigh - aLow * bHigh - aHigh * bLow);\n return [product, error];\n}\n\n/** Return the sum and the part of it the sum cannot hold. */\nfunction twoSum(a: number, b: number): [number, number] {\n const sum = a + b;\n const carried = sum - a;\n return [sum, a - (sum - carried) + (b - carried)];\n}\n\n/**\n * Return a sample quantile, by the rule of R's `quantile(type = 7)`.\n *\n * Type 7 is the default of R's `quantile()`, and so the rule behind the\n * `IQR()` that `bw.nrd0()` uses to pick a bandwidth. It reads the sorted\n * values at position `1 + (n - 1) * p` and interpolates between the two\n * neighbors of a fractional position.\n *\n * @param values The observations. The function does not modify them.\n * @param p The probability. It must be in [0, 1].\n * @returns The quantile, or NaN for no values. R returns NA there.\n * @throws RangeError If p is outside [0, 1], as R does.\n */\nexport function quantile(values: readonly number[], p: number): number {\n return quantiles(values, [p])[0] as number;\n}\n\n/**\n * Return several sample quantiles, by the rule of R's `quantile(type = 7)`.\n *\n * R's `quantile()` also takes a vector of probabilities, and for one reason:\n * it sorts once and reads every position off the one sorted copy. Asking for\n * the two quartiles together instead of one at a time halves the work, which\n * is what the bandwidth rule does over a pooled sample.\n *\n * @param values The observations. The function does not modify them.\n * @param probs The probabilities. Each must be in [0, 1].\n * @returns One quantile per probability, in the order given. Each is NaN for\n * no values, where R returns NA.\n * @throws RangeError If a probability is outside [0, 1], as R does.\n */\nexport function quantiles(\n values: readonly number[],\n probs: readonly number[],\n): number[] {\n if (probs.some((p) => !(p >= 0 && p <= 1))) {\n throw new RangeError(`every probability must be in [0, 1], got ${probs}`);\n }\n if (values.length === 0) {\n return probs.map(() => Number.NaN);\n }\n\n // A Float64Array sorts by value with no comparator to call, which is about\n // three times faster than sorting a copy of the array over a pooled sample.\n const sorted = Float64Array.from(values).sort();\n\n return probs.map((p) => type7(sorted, p));\n}\n\n/**\n * Return the median, the value with half the observations on each side.\n *\n * R's `median()` sorts the values and, on an even count, averages the two in\n * the middle. That is the type-7 quantile at 0.5, which weights those same two\n * values by a half each, so this delegates rather than repeat the rule. The\n * two forms land on the same double, the halves included.\n *\n * The sampling demonstration offers this as one of its choices of statistic.\n * It marks the center in the units of the data, as the mean does, but a value\n * far from the center moves it very little, because only the ordering counts.\n *\n * @param values The observations. The function does not modify them.\n * @returns The median, or NaN for no values. R returns NA there.\n */\nexport function median(values: readonly number[]): number {\n return quantile(values, 0.5);\n}\n\n/** Read one type-7 quantile off already sorted values. */\nfunction type7(sorted: Float64Array, p: number): number {\n const position = 1 + (sorted.length - 1) * p;\n const below = Math.floor(position);\n const above = Math.ceil(position);\n // Both indices are inside the array: p in [0, 1] bounds the position by\n // 1 and by the length.\n const low = sorted[below - 1] as number;\n const high = sorted[above - 1] as number;\n\n if (position > below && high !== low) {\n // R's own form. The algebraically equal low + h * (high - low) rounds\n // differently, and this keeps the last bits with R.\n const h = position - below;\n return (1 - h) * low + h * high;\n }\n return low;\n}\n",
|
|
6
|
+
"/**\n * Shared array arithmetic for the core modules.\n *\n * Use these helpers with `map` instead of index-based loops. See the\n * iteration convention in CLAUDE.md.\n */\n\n/** Add all values. Return 0 for an empty array. */\nexport function sum(values: readonly number[]): number {\n return values.reduce((total, value) => total + value, 0);\n}\n\n/** Return the arithmetic mean. Return NaN for an empty array. */\nexport function mean(values: readonly number[]): number {\n return sum(values) / values.length;\n}\n\n/**\n * Return the smallest and the largest value, as R's `range()` does.\n *\n * Written as a fold rather than `Math.min(...values)`, which overflows the\n * call stack on a long column.\n *\n * @param values The observations.\n * @returns The lowest and the highest value. An empty array returns\n * [Infinity, -Infinity], the shape of R's `range(numeric(0))`.\n *\n * A comparison keeps the accumulator when it is false, so a NaN entry is\n * skipped rather than carried through. No caller supports NaN input: the\n * modules that call this either drop the non-finite values first or state\n * that they do not handle R's NA.\n */\nexport function extent(values: readonly number[]): [number, number] {\n return values.reduce<[number, number]>(\n ([low, high], value) => [\n value < low ? value : low,\n value > high ? value : high,\n ],\n [Number.POSITIVE_INFINITY, Number.NEGATIVE_INFINITY],\n );\n}\n\n/**\n * Map a negative zero to a positive one.\n *\n * A computed zero can come out of an algorithm with a sign that R's own\n * zeros never carry: of 1498 zero entries of a matrix inverse over a sweep of\n * 20000 slider settings, R gives a positive zero every time.\n */\nexport function withoutNegativeZero(value: number): number {\n return value === 0 ? 0 : value;\n}\n\n/** Reject a count that is not a non-negative integer. */\nexport function requireCount(value: number, name: string): void {\n if (!Number.isInteger(value) || value < 0) {\n throw new RangeError(`${name} must be a non-negative integer, got ${value}`);\n }\n}\n\n/**\n * Combine two arrays element by element.\n *\n * Stop at the end of the shorter array.\n */\nexport function zipWith<A, B, C>(\n as: readonly A[],\n bs: readonly B[],\n combine: (a: A, b: B) => C,\n): C[] {\n const length = Math.min(as.length, bs.length);\n // The slice bounds the index, so the access cannot be undefined.\n return as.slice(0, length).map((a, index) => combine(a, bs[index] as B));\n}\n\n/**\n * Return the standard deviation, with the n − 1 denominator of R's `sd()`.\n *\n * @param values The observations.\n * @returns The standard deviation, or NaN below two values. R returns NA\n * there, with a warning that a library cannot give.\n */\nexport function sd(values: readonly number[]): number {\n if (values.length < 2) {\n return Number.NaN;\n }\n\n const center = mean(values);\n const squares = values.map((value) => (value - center) * (value - center));\n return Math.sqrt(sum(squares) / (values.length - 1));\n}\n\n/**\n * Return the mean absolute deviation, `mean(|x - mean(x)|)`.\n *\n * R base has no function for this. R's `mad()` is the *median* absolute\n * deviation from the median, scaled by 1.4826, which is a different\n * statistic. A caller that shows either one to a reader must write the name\n * in full, because the abbreviation covers both.\n *\n * The sampling demonstration offers this as one of its choices of statistic.\n * It measures spread in the units of the data, as the standard deviation\n * does, but a value far from the mean moves it less, because the distance is\n * not squared.\n *\n * @param values The observations.\n * @returns The mean distance from the mean. One value gives 0, because it\n * sits at its own mean. No values gives NaN, as `mean` does.\n */\nexport function meanAbsoluteDeviation(values: readonly number[]): number {\n const center = mean(values);\n return mean(values.map((value) => Math.abs(value - center)));\n}\n\n/**\n * Return `a * b + c`, rounded once.\n *\n * Written as `a * b + c`, JavaScript rounds twice — once for the product,\n * once for the sum — and the two roundings show. R's `seq.int` rounds once\n * and lands one unit in the last place away often enough to change a tick.\n * The linear algebra in `matrix.ts` needs the same: the compiler of the R\n * install the fixtures come from contracts a multiply and an add into one\n * instruction, so a matrix near singular differs in every digit without it.\n *\n * The two helpers below split each operation into the value a double can\n * hold plus the part it drops, so the dropped parts can be added back before\n * the one rounding that remains. Both are the standard error-free\n * transformations (Dekker 1971, Knuth). Both need every intermediate to stay\n * in range, which fails only within a factor of 2^28 of the largest double.\n * There the plain form is used: the result is already dominated by its own\n * overflow.\n */\nexport function fusedMultiplyAdd(a: number, b: number, c: number): number {\n // A zero product adds exactly, and only the plain form keeps the sign of\n // a zero sum the way the hardware instruction does: fma(-1, 0, -0) is -0.\n if (a * b === 0) {\n return c + a * b;\n }\n const [product, productError] = twoProduct(a, b);\n const [sum, sumError] = twoSum(c, product);\n const rounded = sum + (sumError + productError);\n return Number.isFinite(rounded) ? rounded : a * b + c;\n}\n\n/** Split a double into two halves whose product is exact. Dekker's method. */\nfunction split(value: number): [number, number] {\n const scaled = 134217729 * value;\n const high = scaled - (scaled - value);\n return [high, value - high];\n}\n\n/** Return the product and the part of it the product cannot hold. */\nfunction twoProduct(a: number, b: number): [number, number] {\n const product = a * b;\n const [aHigh, aLow] = split(a);\n const [bHigh, bLow] = split(b);\n const error =\n aLow * bLow - (product - aHigh * bHigh - aLow * bHigh - aHigh * bLow);\n return [product, error];\n}\n\n/** Return the sum and the part of it the sum cannot hold. */\nfunction twoSum(a: number, b: number): [number, number] {\n const sum = a + b;\n const carried = sum - a;\n return [sum, a - (sum - carried) + (b - carried)];\n}\n\n/**\n * Return a sample quantile, by the rule of R's `quantile(type = 7)`.\n *\n * Type 7 is the default of R's `quantile()`, and so the rule behind the\n * `IQR()` that `bw.nrd0()` uses to pick a bandwidth. It reads the sorted\n * values at position `1 + (n - 1) * p` and interpolates between the two\n * neighbors of a fractional position.\n *\n * @param values The observations. The function does not modify them.\n * @param p The probability. It must be in [0, 1].\n * @returns The quantile, or NaN for no values. R returns NA there.\n * @throws RangeError If p is outside [0, 1], as R does.\n */\nexport function quantile(values: readonly number[], p: number): number {\n return quantiles(values, [p])[0] as number;\n}\n\n/**\n * Return several sample quantiles, by the rule of R's `quantile(type = 7)`.\n *\n * R's `quantile()` also takes a vector of probabilities, and for one reason:\n * it sorts once and reads every position off the one sorted copy. Asking for\n * the two quartiles together instead of one at a time halves the work, which\n * is what the bandwidth rule does over a pooled sample.\n *\n * @param values The observations. The function does not modify them.\n * @param probs The probabilities. Each must be in [0, 1].\n * @returns One quantile per probability, in the order given. Each is NaN for\n * no values, where R returns NA.\n * @throws RangeError If a probability is outside [0, 1], as R does.\n */\nexport function quantiles(\n values: readonly number[],\n probs: readonly number[],\n): number[] {\n if (probs.some((p) => !(p >= 0 && p <= 1))) {\n throw new RangeError(`every probability must be in [0, 1], got ${probs}`);\n }\n if (values.length === 0) {\n return probs.map(() => Number.NaN);\n }\n\n // A Float64Array sorts by value with no comparator to call, which is about\n // three times faster than sorting a copy of the array over a pooled sample.\n const sorted = Float64Array.from(values).sort();\n\n return probs.map((p) => type7(sorted, p));\n}\n\n/**\n * Return the median, the value with half the observations on each side.\n *\n * R's `median()` sorts the values and, on an even count, averages the two in\n * the middle. That is the type-7 quantile at 0.5, which weights those same two\n * values by a half each, so this delegates rather than repeat the rule. The\n * two forms land on the same double, the halves included.\n *\n * The sampling demonstration offers this as one of its choices of statistic.\n * It marks the center in the units of the data, as the mean does, but a value\n * far from the center moves it very little, because only the ordering counts.\n *\n * @param values The observations. The function does not modify them.\n * @returns The median, or NaN for no values. R returns NA there.\n */\nexport function median(values: readonly number[]): number {\n return quantile(values, 0.5);\n}\n\n/** Read one type-7 quantile off already sorted values. */\nfunction type7(sorted: Float64Array, p: number): number {\n const position = 1 + (sorted.length - 1) * p;\n const below = Math.floor(position);\n const above = Math.ceil(position);\n // Both indices are inside the array: p in [0, 1] bounds the position by\n // 1 and by the length.\n const low = sorted[below - 1] as number;\n const high = sorted[above - 1] as number;\n\n if (position > below && high !== low) {\n // R's own form. The algebraically equal low + h * (high - low) rounds\n // differently, and this keeps the last bits with R.\n const h = position - below;\n return (1 - h) * low + h * high;\n }\n return low;\n}\n",
|
|
7
7
|
"/**\n * Gaussian kernel density estimate — R's `density()` with its defaults.\n *\n * `plot_sampling()` in the R package draws two of these panels: one over the\n * population and one over the pooled samples. Both calls are `density(x)` with\n * no other argument, so this module ports that default path: the Gaussian\n * kernel, the `nrd0` bandwidth, a 512-point output grid, `cut = 3`, and\n * `ext = 4`. It also ports R's `from` and `to` arguments, which freeze the\n * ends of the reported window — the sampling plot uses them to keep one axis\n * across redraws. Verified against R 4.5.3 in `kde.test.ts`.\n *\n * The estimate is a convolution, and R computes it with an FFT rather than by\n * summing a kernel over every point. This port copies that: the cost is\n * linear in the count of values plus a fixed 1024-point transform, so pooling\n * a million sampled values stays fast. The steps, in R's own order:\n *\n * 1. Pick the bandwidth with `bwNrd0`.\n * 2. Set the reported window to `range(x) ± 3 * bw` (`cut = 3`), and the\n * wider working window to `range(x) ± 7 * bw` (a further `ext = 4`).\n * 3. Spread the mass of the values over 512 equally spaced points of the\n * working window, splitting each value between its two neighbors.\n * 4. Convolve that with a Gaussian of standard deviation `bw`, using a\n * 1024-point FFT, and clamp negative rounding noise to zero.\n * 5. Interpolate the result back onto the reported window.\n *\n * The two windows are different widths and must not be confused. A port that\n * runs the FFT over the reported window gives a visibly narrower curve.\n */\n\nimport { extent, quantiles, sd } from \"./arith\";\n\n/** Points in the reported grid. R's `density(n = 512)` default. */\nconst GRID_SIZE = 512;\n\n/** Points in the FFT grid. R pads the binned mass to twice its length. */\nconst FFT_SIZE = 2 * GRID_SIZE;\n\n/** Bandwidths of reported window beyond the data. R's `cut = 3`. */\nconst CUT = 3;\n\n/** Further bandwidths of working window beyond that. R's `ext = 4`. */\nconst EXT = 4;\n\n/** `M_1_SQRT_2PI` of R's C sources. */\nconst INV_SQRT_2PI = 0.398942280401432677939946059934;\n\n/** What the caller may change. R's other arguments are not ported. */\nexport interface KernelDensityOptions {\n /**\n * The bandwidth, the standard deviation of the kernel.\n *\n * The default is `bwNrd0(values)`, R's `bw = \"nrd0\"`. Giving the bandwidth\n * skips that selection, and with it the rule that the selection needs two\n * values — R does the same.\n */\n readonly bw?: number;\n /**\n * The low end of the reported window, R's `from`.\n *\n * The default is `min(x) - 3 * bw`, R's `cut = 3`. The working window still\n * reaches 4 bandwidths further out, and `binDist` drops the mass beyond it,\n * as R's `BinDist` does. So a window narrower than the data cuts the tails\n * off, and a wider one pads the curve with near-zero density — the frozen\n * axis the sampling plot needs across redraws.\n */\n readonly from?: number;\n /** The high end of the reported window, R's `to`. Same rules as `from`. */\n readonly to?: number;\n}\n\n/** The curve, in the shape of R's `density` object. */\nexport interface KernelDensityEstimate {\n /**\n * The 512 grid points. They run from `min(x) - 3 * bw` to\n * `max(x) + 3 * bw`, unless the caller froze an end with `from` or `to`.\n */\n readonly x: readonly number[];\n /** The density at each grid point. Never negative. */\n readonly y: readonly number[];\n /** The bandwidth the estimate used. */\n readonly bw: number;\n /**\n * The count of values the caller gave, before any were dropped. R reports\n * the same count, and scales the curve by the share that it kept.\n */\n readonly n: number;\n}\n\n/**\n * Pick a bandwidth by Silverman's rule, R's `bw.nrd0()`.\n *\n * The rule is `0.9 * min(sd, IQR / 1.34) * n^(-1/5)`. When that smaller of\n * the two spreads is 0 — every value the same, or every value repeated past\n * the quartiles — R walks a chain of fallbacks and takes the first that is\n * not 0: the standard deviation, then the size of the first value, then 1.\n * This keeps the rule from returning a bandwidth of 0, which would leave the\n * estimate undrawable.\n *\n * @param values The observations. All must be finite.\n * @returns The bandwidth. Always positive.\n * @throws RangeError Below two values. R stops with \"need at least 2 data\n * points\", since the spread of one value has no meaning.\n */\nexport function bwNrd0(values: readonly number[]): number {\n if (values.length < 2) {\n throw new RangeError(`need at least 2 data points, got ${values.length}`);\n }\n\n const spread = sd(values);\n const [lowerQuartile, upperQuartile] = quantiles(values, [0.25, 0.75]);\n const iqrSpread = (upperQuartile - lowerQuartile) / 1.34;\n const scale = fallbackScale(spread, iqrSpread, values[0]);\n\n return 0.9 * scale * Math.pow(values.length, -0.2);\n}\n\n/** Take the first candidate of R's chain that is not 0. */\nfunction fallbackScale(\n spread: number,\n iqrSpread: number,\n first: number,\n): number {\n const smaller = Math.min(spread, iqrSpread);\n if (smaller !== 0) {\n return smaller;\n }\n if (spread !== 0) {\n return spread;\n }\n return Math.abs(first) !== 0 ? Math.abs(first) : 1;\n}\n\n/**\n * Estimate the density of the values.\n *\n * R takes a matrix here and flattens it. This port takes the flat array, so a\n * caller that pools several samples flattens them first. R flattens a matrix\n * column by column, which for `plot_sampling()` means one whole sample after\n * another.\n *\n * Values that are infinite are dropped, and the curve is scaled by the share\n * of values that remain, as in R. A value that is NaN is refused: R reads it\n * as a missing value and stops.\n *\n * @param values The observations.\n * @param options The bandwidth and the window ends, if the caller sets them.\n * @returns The grid, the density on it, the bandwidth, and the count of\n * values given.\n * @throws RangeError If the bandwidth has to be selected from fewer than two\n * values, if a given bandwidth is not positive and finite, if a given\n * window end is not finite, if a value is NaN, or if no value is finite.\n */\nexport function kernelDensity(\n values: readonly number[],\n options: KernelDensityOptions = {},\n): KernelDensityEstimate {\n const finite = finiteValuesOf(values);\n const bw = options.bw ?? bwNrd0(finite);\n\n if (!Number.isFinite(bw) || bw <= 0) {\n throw new RangeError(`bw must be positive and finite, got ${bw}`);\n }\n if (finite.length === 0) {\n throw new RangeError(\"need at least 1 finite value, got none\");\n }\n\n if (options.from !== undefined && !Number.isFinite(options.from)) {\n throw new RangeError(`non-finite 'from': ${options.from}`);\n }\n if (options.to !== undefined && !Number.isFinite(options.to)) {\n throw new RangeError(`non-finite 'to': ${options.to}`);\n }\n\n const [lowest, highest] = extent(finite);\n const from = options.from ?? lowest - CUT * bw;\n const to = options.to ?? highest + CUT * bw;\n const lo = from - EXT * bw;\n const up = to + EXT * bw;\n\n const binned = binDist(finite, lo, up, finite.length / values.length);\n const kernel = gaussianKernel(lo, up, bw);\n const density = convolve(binned, kernel);\n\n const working = gridOf(lo, up);\n const x = gridOf(from, to);\n const y = x.map((point) => interpolate(working, density, point));\n\n return { x, y, bw, n: values.length };\n}\n\n/** Drop the values that are not finite. Refuse a value that is NaN. */\nfunction finiteValuesOf(values: readonly number[]): readonly number[] {\n if (values.every((value) => Number.isFinite(value))) {\n return values;\n }\n if (values.some((value) => Number.isNaN(value))) {\n throw new RangeError(\"values contain a missing value\");\n }\n return values.filter((value) => Number.isFinite(value));\n}\n\n/**\n * Spread the mass of the values over the working grid — R's `C_BinDist`.\n *\n * Each value carries mass `1 / count` and lands between two grid points. The\n * split is proportional to the distance to each: a value three quarters of\n * the way from one point to the next gives a quarter of its mass to the point\n * behind it and three quarters to the point ahead. Rounding each value to its\n * nearest point instead would step the curve.\n *\n * @param values The finite observations.\n * @param lo The low end of the working window.\n * @param up The high end of the working window.\n * @param keptShare The share of the caller's values that reached here, R's\n * `totMass`. It is 1 unless infinite values were dropped.\n * @returns The mass on the first 512 points, zero-padded to 1024 for the FFT.\n */\nfunction binDist(\n values: readonly number[],\n lo: number,\n up: number,\n keptShare: number,\n): Float64Array {\n const bins = new Float64Array(FFT_SIZE);\n const step = (up - lo) / (GRID_SIZE - 1);\n const weight = keptShare / values.length;\n const lastPair = GRID_SIZE - 2;\n\n // An index loop, against the map convention of CLAUDE.md: every value adds\n // to two entries of one shared accumulator, which a map cannot express.\n // This is also the only step whose cost grows with the count of values, so\n // it stays a single pass with no allocation.\n for (let i = 0; i < values.length; i += 1) {\n const position = (values[i] - lo) / step;\n const behind = Math.floor(position);\n const ahead = position - behind;\n\n if (behind >= 0 && behind <= lastPair) {\n bins[behind] += (1 - ahead) * weight;\n bins[behind + 1] += ahead * weight;\n } else if (behind === -1) {\n bins[0] += ahead * weight;\n } else if (behind === lastPair + 1) {\n bins[behind] += (1 - ahead) * weight;\n }\n }\n\n return bins;\n}\n\n/**\n * Build the kernel over the lags of the working grid — R's `kords`.\n *\n * The grid runs from lag 0 up to twice the width of the window, and then the\n * second half is replaced by the negative lags in reverse. That folding is\n * what makes the circular convolution of the FFT behave like the ordinary one\n * over a finite window.\n */\nfunction gaussianKernel(lo: number, up: number, bw: number): Float64Array {\n const span = ((FFT_SIZE - 1) / (GRID_SIZE - 1)) * (up - lo);\n const step = span / (FFT_SIZE - 1);\n const lags = Array.from({ length: FFT_SIZE }, (_, index) => index * step);\n const folded = lags.map((lag, index) =>\n index > GRID_SIZE ? -lags[FFT_SIZE - index] : lag,\n );\n\n return Float64Array.from(folded, (lag) => dnorm(lag, bw));\n}\n\n/**\n * The density of a normal distribution at `at`, centered on 0 — R's `dnorm`.\n *\n * Beyond five standard deviations R splits the value in two and exponentiates\n * each part, which keeps the far tail of the kernel accurate to the last bits.\n * This copies that split so the tails of the curve track R's.\n */\nfunction dnorm(at: number, sd: number): number {\n const z = Math.abs(at) / sd;\n\n if (z < 5) {\n return (INV_SQRT_2PI * Math.exp(-0.5 * z * z)) / sd;\n }\n // Beyond this the density is below the smallest normal double.\n if (z > Math.sqrt(-2 * Math.LN2 * (-1021 + 1 - 53))) {\n return 0;\n }\n\n const head = Math.round(z * 65536) / 65536;\n const tail = z - head;\n return (\n (INV_SQRT_2PI / sd) *\n (Math.exp(-0.5 * head * head) * Math.exp((-0.5 * tail - head) * tail))\n );\n}\n\n/**\n * Convolve the binned mass with the kernel through the frequency domain.\n *\n * The transform of a convolution is the product of the transforms, so one\n * inverse transform of that product gives the whole curve. R does exactly\n * this, and clamps the result at 0 because the rounding of the transform can\n * leave a density slightly below 0 where it should be flat.\n *\n * @returns The density on the 512 working grid points.\n */\nfunction convolve(binned: Float64Array, kernel: Float64Array): Float64Array {\n const massReal = Float64Array.from(binned);\n const massImaginary = new Float64Array(FFT_SIZE);\n const kernelReal = Float64Array.from(kernel);\n const kernelImaginary = new Float64Array(FFT_SIZE);\n\n fftInPlace(massReal, massImaginary, false);\n fftInPlace(kernelReal, kernelImaginary, false);\n\n // An index loop, against the map convention of CLAUDE.md: this multiplies\n // two arrays in place, one complex pair at a time, to avoid four more\n // 1024-point allocations per redraw.\n for (let i = 0; i < FFT_SIZE; i += 1) {\n const real =\n massReal[i] * kernelReal[i] +\n massImaginary[i] * kernelImaginary[i];\n const imaginary =\n massImaginary[i] * kernelReal[i] -\n massReal[i] * kernelImaginary[i];\n massReal[i] = real;\n massImaginary[i] = imaginary;\n }\n\n fftInPlace(massReal, massImaginary, true);\n\n return Float64Array.from(massReal.subarray(0, GRID_SIZE), (value) =>\n Math.max(0, value / FFT_SIZE),\n );\n}\n\n/**\n * Transform in place, by the radix-2 Cooley-Tukey algorithm.\n *\n * The length must be a power of two; here it is always 1024. The forward\n * transform matches R's `fft(z)` and the inverse matches\n * `fft(z, inverse = TRUE)`, which R leaves unscaled — the caller divides.\n *\n * @param real The real parts. Replaced by the result.\n * @param imaginary The imaginary parts. Replaced by the result.\n * @param inverse Whether to run the inverse transform.\n */\nfunction fftInPlace(\n real: Float64Array,\n imaginary: Float64Array,\n inverse: boolean,\n): void {\n const size = real.length;\n const half = size >> 1;\n\n // Index loops throughout, against the map convention of CLAUDE.md: the\n // algorithm is a fixed pattern of in-place swaps and butterflies over pairs\n // of indices, which is what makes it O(n log n) instead of O(n^2).\n for (let i = 1, j = 0; i < size; i += 1) {\n let bit = half;\n for (; (j & bit) !== 0; bit >>= 1) {\n j ^= bit;\n }\n j ^= bit;\n if (i < j) {\n const swappedReal = real[i];\n const swappedImaginary = imaginary[i];\n real[i] = real[j];\n imaginary[i] = imaginary[j];\n real[j] = swappedReal;\n imaginary[j] = swappedImaginary;\n }\n }\n\n const direction = inverse ? 1 : -1;\n const cosines = new Float64Array(half);\n const sines = new Float64Array(half);\n for (let k = 0; k < half; k += 1) {\n const angle = (direction * 2 * Math.PI * k) / size;\n cosines[k] = Math.cos(angle);\n sines[k] = Math.sin(angle);\n }\n\n for (let span = 1; span < size; span <<= 1) {\n const stride = half / span;\n for (let start = 0; start < size; start += span << 1) {\n for (let k = 0; k < span; k += 1) {\n const even = start + k;\n const odd = even + span;\n const cosine = cosines[k * stride];\n const sine = sines[k * stride];\n const oddReal =\n real[odd] * cosine - imaginary[odd] * sine;\n const oddImaginary =\n real[odd] * sine + imaginary[odd] * cosine;\n real[odd] = real[even] - oddReal;\n imaginary[odd] = imaginary[even] - oddImaginary;\n real[even] = real[even] + oddReal;\n imaginary[even] = imaginary[even] + oddImaginary;\n }\n }\n }\n}\n\n/**\n * Build 512 equally spaced points from `from` to `to`, as R's `seq.int` does.\n *\n * R pins both ends and computes each point between them from the start, not\n * by adding up steps. Interior points can still differ from R's by one unit\n * in the last place: R's C loop rounds its multiply-and-add once where this\n * rounds twice. That is a relative difference near 1e-16, far below the\n * tolerance the tests hold the curve to.\n */\nfunction gridOf(from: number, to: number): number[] {\n const step = (to - from) / (GRID_SIZE - 1);\n const points = Array.from(\n { length: GRID_SIZE },\n (_, index) => from + index * step,\n );\n points[GRID_SIZE - 1] = to;\n return points;\n}\n\n/**\n * Read the density at a point between two grid points — R's `approx`.\n *\n * The search is the bisection R uses, including its two tests for landing\n * exactly on a grid point. The reported window always sits inside the working\n * window, so the two guards for a point outside it are unreachable; they hold\n * the ends flat rather than returning R's NA.\n */\nfunction interpolate(\n grid: readonly number[],\n values: Float64Array,\n at: number,\n): number {\n let low = 0;\n let high = grid.length - 1;\n\n if (at < grid[low]) {\n return values[low];\n }\n if (at > grid[high]) {\n return values[high];\n }\n\n while (low < high - 1) {\n const middle = (low + high) >> 1;\n if (at < grid[middle]) {\n high = middle;\n } else {\n low = middle;\n }\n }\n\n if (at === grid[high]) {\n return values[high];\n }\n if (at === grid[low]) {\n return values[low];\n }\n\n const lowValue = values[low];\n const highValue = values[high];\n const lowPoint = grid[low];\n const highPoint = grid[high];\n return (\n lowValue +\n (highValue - lowValue) * ((at - lowPoint) / (highPoint - lowPoint))\n );\n}\n",
|
|
8
8
|
"/**\n * Round numbers covering a range — R's `pretty()`.\n *\n * R places histogram cell edges and axis labels with this. It picks a cell\n * size from the ladder 1, 2, 5, 10 times a power of ten, then rounds the low\n * end down and the high end up to multiples of that size. The result\n * therefore **covers** the range it was given, and usually extends past both\n * ends.\n *\n * That widening is the whole point, and it is what separates this from\n * `prettyTicks` in `src/plot/axes.ts`, which keeps ticks inside a window the\n * caller has already fixed. Do not swap one for the other: a histogram drawn\n * on ticks that stop short of the data loses its outer cells, and a fixed\n * plot window drawn on widened ticks grows past its frame.\n *\n * The port follows R's C routine `R_pretty` step for step, including its\n * rounding guard of 1e-10 and its bias toward 2 and 5 over stepping straight\n * to the next power of ten. Verified against R 4.5.3 in `pretty.test.ts` and\n * across a sweep of 5348 random ranges, every one of which it reproduces\n * edge for edge. R's remaining tuning arguments (`shrink.sml`, `high.u.bias`,\n * `u5.bias`, `eps.correct`, `f.min`) stay at their defaults: nothing in the\n * package changes them, and each one is a branch that could only be guessed\n * at rather than tested.\n */\n\nimport { fusedMultiplyAdd, requireCount } from \"./arith\";\n\n/** R's `rounding_eps`, the slack that keeps a near-multiple from stepping. */\nconst ROUNDING_EPS = 1e-10;\n\n/** R's `shrink.sml`, applied to the cell of a range with no width. */\nconst SHRINK_SMALL = 0.75;\n\n/** R's `high.u.bias`, the pull toward a larger unit. */\nconst HIGH_U_BIAS = 1.5;\n\n/** R's `u5.bias`, the extra pull toward a unit of 5. */\nconst U5_BIAS = 0.5 + 1.5 * HIGH_U_BIAS;\n\n/** What the caller may change. R's tuning arguments are not ported. */\nexport interface RPrettyOptions {\n /**\n * About how many cells to produce. R's `n`, default 5. It is a wish, not a\n * count: the returned array can hold more or fewer edges.\n */\n readonly n?: number;\n /**\n * The fewest cells to accept. R's `min.n`, default `floor(n / 3)`. R's\n * `hist()` passes 1 here rather than taking this default.\n */\n readonly minN?: number;\n}\n\n/**\n * Return round numbers that cover the range from `lo` to `up`.\n *\n * @param lo The low end of the range to cover.\n * @param up The high end. It must not be below `lo`.\n * @param options The wished-for cell count and the fewest cells to accept.\n * @returns The edges, in increasing order. Always at least two, except for\n * the degenerate request of no cells at all.\n * @throws RangeError If an end is not finite, if `up` is below `lo`, if a\n * count is negative or fractional, or if `minN` is above `n` (R stops with\n * \"invalid 'min.n' argument\").\n */\nexport function rPretty(\n lo: number,\n up: number,\n options: RPrettyOptions = {},\n): number[] {\n const { n = 5, minN = Math.floor(n / 3) } = options;\n\n if (!Number.isFinite(lo) || !Number.isFinite(up)) {\n throw new RangeError(`lo and up must be finite, got ${lo} and ${up}`);\n }\n if (up < lo) {\n throw new RangeError(`up must not be below lo, got ${lo} and ${up}`);\n }\n requireCount(n, \"n\");\n requireCount(minN, \"minN\");\n if (minN > n) {\n throw new RangeError(`minN must not be above n, got ${minN} and ${n}`);\n }\n\n const { low, high, cells } = prettyBounds(lo, up, n, minN);\n if (cells === 0) {\n return [low];\n }\n\n const step = (high - low) / cells;\n // R's `seq.int` computes each point to wider precision than a double\n // carries and rounds it a single time. Writing `low + index * step` rounds\n // twice and lands one unit in the last place away often enough to matter:\n // 1081 of the 5348 swept ranges differed on at least one edge before this.\n const edges = Array.from({ length: cells + 1 }, (_, index) =>\n fusedMultiplyAdd(index, step, low),\n );\n edges[cells] = high;\n\n // R zaps an edge that rounding left just off zero, so a range through zero\n // reports a clean 0 rather than 1e-17.\n return edges.map((edge) => (Math.abs(edge) < 1e-14 * step ? 0 : edge));\n}\n\n/**\n * Find the covering bounds and the cell count — R's `R_pretty`.\n *\n * The steps: measure a first guess at the cell size, round that guess to a\n * round number, step the ends out to multiples of it, and widen further if\n * that left fewer cells than `minN`.\n */\nfunction prettyBounds(\n lo: number,\n up: number,\n n: number,\n minN: number,\n): { low: number; high: number; cells: number } {\n const unit = cellUnit(lo, up, n, minN);\n\n let steps = Math.floor(lo / unit + ROUNDING_EPS);\n let stepsUp = Math.ceil(up / unit - ROUNDING_EPS);\n // Index loops, against the map convention of CLAUDE.md: these walk one\n // step at a time until the multiple covers the end, as R's C loops do.\n while (steps * unit > lo + ROUNDING_EPS * unit) {\n steps -= 1;\n }\n while (stepsUp * unit < up - ROUNDING_EPS * unit) {\n stepsUp += 1;\n }\n\n let cells = Math.floor(0.5 + stepsUp - steps);\n if (cells < minN) {\n // Widen toward zero: a range above zero grows downward, one below zero\n // grows upward, and a range with an end exactly at zero grows the only\n // way it can. R splits the extra cells between the two ends when neither\n // end is pinned, giving the odd one to the end it is growing toward. The\n // rule is read off R's own results — 132 of the swept ranges turn on it —\n // rather than from the C source, which is not shipped with this R.\n const missing = minN - cells;\n if (lo === 0 && up > 0) {\n // Anchored at zero from below: every new cell has to go on top.\n stepsUp += missing;\n } else if (up === 0 && lo < 0) {\n steps -= missing;\n } else if (steps >= 0) {\n stepsUp += Math.floor(missing / 2);\n steps -= Math.floor(missing / 2) + (missing % 2);\n } else {\n steps -= Math.floor(missing / 2);\n stepsUp += Math.floor(missing / 2) + (missing % 2);\n }\n cells = minN;\n }\n\n return {\n low: steps * unit < lo ? steps * unit : lo,\n high: stepsUp * unit > up ? stepsUp * unit : up,\n cells,\n };\n}\n\n/**\n * Pick the cell size from the ladder 1, 2, 5, 10 times a power of ten.\n *\n * The tests are R's, and they are one-sided on purpose: a candidate wins when\n * it overshoots the wanted cell size by less than `bias` times the amount the\n * current choice undershoots it. That is what makes 5 beat 2 more readily\n * than 2 beats 1.\n */\nfunction cellUnit(lo: number, up: number, n: number, minN: number): number {\n const width = up - lo;\n let cell: number;\n let noWidth: boolean;\n\n if (width === 0 && up === 0) {\n cell = 1;\n noWidth = true;\n } else {\n cell = Math.max(Math.abs(lo), Math.abs(up));\n const bound =\n 1 +\n (U5_BIAS >= 1.5 * HIGH_U_BIAS + 0.5\n ? 1 / (1 + HIGH_U_BIAS)\n : 1.5 / (1 + U5_BIAS));\n // A range this narrow relative to its distance from zero carries no\n // usable width; R treats it as a point.\n noWidth = width < cell * bound * Math.max(1, n) * Number.EPSILON * 3;\n }\n\n if (noWidth) {\n // A range with no width has only its distance from zero to set a scale\n // by, and that would put a cell of 1e9 around a point at 1e9. R pulls the\n // cell down a decade first, keeping it above 9 so the ladder still has\n // room to choose. Confirmed by bisecting R's unit transitions: they land\n // on 9.333..., 96.666..., and 283.333... to twelve decimals.\n if (cell > 10) {\n cell = 9 + cell / 10;\n }\n cell *= SHRINK_SMALL;\n if (minN > 1) {\n cell /= minN;\n }\n } else {\n cell = width;\n if (n > 1) {\n cell /= n;\n }\n }\n\n const base = powerOfTen(Math.floor(Math.log10(cell)));\n let unit = base;\n if (2 * base - cell < HIGH_U_BIAS * (cell - unit)) {\n unit = 2 * base;\n if (5 * base - cell < U5_BIAS * (cell - unit)) {\n unit = 5 * base;\n if (10 * base - cell < HIGH_U_BIAS * (cell - unit)) {\n unit = 10 * base;\n }\n }\n }\n return unit;\n}\n\n/**\n * Return 10 to the power of an integer, exactly.\n *\n * R's source warns that this step \"relies on exact calculation\", which some C\n * libraries do not deliver from `pow`. Reading the value as a decimal literal\n * does: the language guarantees the nearest double to the decimal written.\n */\nfunction powerOfTen(exponent: number): number {\n const parsed = Number(`1e${exponent}`);\n return Number.isFinite(parsed) && parsed !== 0\n ? parsed\n : Math.pow(10, exponent);\n}\n",
|
|
9
9
|
"/**\n * Counts of values per cell — R's `hist(plot = FALSE)` with its defaults.\n *\n * `plot_sampling()` draws its third panel from this: it accumulates one\n * statistic per sample and calls `hist()` on the running collection, then\n * reads `counts` back to place the panel's label. Verified against R 4.5.3 in\n * `histogram.test.ts`.\n *\n * Three rules carry the behavior, and each one is easy to get subtly wrong:\n *\n * 1. **How many cells.** Sturges' rule, `ceiling(log2(n) + 1)`, is only a\n * suggestion. It goes to `rPretty`, which returns round edges covering the\n * data — often a different count.\n * 2. **Which cell a value belongs to.** Cells are closed on the right,\n * `(edge[k], edge[k+1]]`, so a value sitting on an edge counts into the\n * cell below it. The lowest edge is the exception: nothing sits below it,\n * so it is opened to admit the smallest value.\n * 3. **Values that land on an edge.** Rounding leaves a value that ought to\n * sit on an edge a hair to one side of it. R nudges the edges by a\n * millionth of a cell before counting — outward at the bottom, upward\n * everywhere else — so such a value still lands where it belongs. The\n * reported edges are the unnudged ones.\n */\n\nimport { extent, quantile, sum, zipWith } from \"./arith\";\nimport { rPretty } from \"./pretty\";\n\n/** R's `fuzz` argument of `hist.default`, in cell widths. */\nconst FUZZ = 1e-7;\n\n/** What the caller may change. R's drawing arguments are not ported. */\nexport interface HistogramOptions {\n /**\n * How to place the cell edges.\n *\n * A number asks for about that many cells, which `rPretty` rounds off; an\n * array gives the edges outright. The default is Sturges' rule. R takes the\n * same two forms in one argument, but cannot tell a one-edge array from a\n * request for one cell — this port reads an array as edges, always.\n */\n readonly breaks?: number | readonly number[];\n}\n\n/** The counted histogram, in the shape of R's `histogram` object. */\nexport interface Histogram {\n /** The cell edges, in increasing order. One more than there are cells. */\n readonly breaks: readonly number[];\n /** How many values fell in each cell. */\n readonly counts: readonly number[];\n /** The midpoint of each cell, R's `mids`. */\n readonly mids: readonly number[];\n}\n\n/**\n * Suggest a cell count by Sturges' rule — R's `nclass.Sturges`.\n *\n * @param values The observations. Only how many there are matters.\n * @returns `ceiling(log2(n) + 1)`, or -Infinity for no values. R returns -Inf\n * there too, which is what makes its `hist()` stop.\n */\nexport function nclassSturges(values: readonly number[]): number {\n return Math.ceil(Math.log2(values.length) + 1);\n}\n\n/**\n * Count the values into cells.\n *\n * Values that are not finite are dropped first, as R does — including NaN,\n * which R reads as a missing value and drops here. Note the difference from\n * `kernelDensity`, which refuses NaN, because R's `density()` refuses it.\n *\n * @param values The observations.\n * @param options How to place the cell edges.\n * @returns The edges, the count in each cell, and the cell midpoints.\n * @throws RangeError If no value is finite, if a requested cell count is\n * below one or fractional, if fewer than two edges are given, or if the\n * given edges leave a value uncounted. R stops in all of those cases too.\n */\nexport function histogram(\n values: readonly number[],\n options: HistogramOptions = {},\n): Histogram {\n const finite = values.filter((value) => Number.isFinite(value));\n if (finite.length === 0) {\n throw new RangeError(\"need at least 1 finite value, got none\");\n }\n\n const breaks = resolveBreaks(finite, options.breaks);\n const widths = zipWith(\n breaks.slice(1),\n breaks.slice(0, -1),\n (up, low) => up - low,\n );\n const counts = binCount(finite, fuzzyBreaks(breaks, widths, finite));\n\n if (sum(counts) < finite.length) {\n throw new RangeError(\n \"some values were not counted; the breaks may not span their range\",\n );\n }\n\n return {\n breaks,\n counts,\n mids: zipWith(breaks.slice(1), breaks.slice(0, -1), (up, low) =>\n 0.5 * (up + low),\n ),\n };\n}\n\n/** Place the cell edges, from Sturges' rule, a wish, or the caller's array. */\nfunction resolveBreaks(\n finite: readonly number[],\n requested: number | readonly number[] | undefined,\n): number[] {\n // Narrowing by `typeof`, not Array.isArray: the latter narrows to a mutable\n // array and so leaves a readonly array in the union.\n if (requested !== undefined && typeof requested !== \"number\") {\n if (requested.length < 2) {\n throw new RangeError(\n `breaks given as edges need at least 2 of them, got ${requested.length}`,\n );\n }\n return [...requested].sort((a, b) => a - b);\n }\n\n const cells = requested ?? nclassSturges(finite);\n if (!Number.isInteger(cells) || cells < 1) {\n throw new RangeError(`invalid number of breaks: ${cells}`);\n }\n\n // R's hist() overrides pretty()'s own min.n here, and asks for 1.\n return rPretty(...extent(finite), { n: cells, minN: 1 });\n}\n\n/**\n * Nudge the edges so a value sitting on one lands in the right cell.\n *\n * The size of the nudge follows R: the middle cell width when there are many\n * cells, the narrowest when there are few, and the width of the data itself\n * when there are almost none.\n */\nfunction fuzzyBreaks(\n breaks: readonly number[],\n widths: readonly number[],\n finite: readonly number[],\n): number[] {\n const positive = widths.filter((width) => width > 0);\n const [lowest, highest] = extent(finite);\n const scale =\n breaks.length > 5\n ? quantile(widths, 0.5)\n : breaks.length <= 3\n ? highest - lowest\n : Math.min(...positive);\n const nudge = FUZZ * scale;\n\n // The lowest edge moves outward to admit the smallest value; every other\n // edge moves up, since each one closes the cell below it.\n return breaks.map((edge, index) =>\n index === 0 ? edge - nudge : edge + nudge,\n );\n}\n\n/**\n * Find the cell of each value and count it — R's `C_BinCount`.\n *\n * The search is R's bisection, written the same way: a value above the middle\n * edge belongs to the upper half, and a value exactly on it belongs to the\n * lower half, because cells close on the right.\n */\nfunction binCount(\n values: readonly number[],\n breaks: readonly number[],\n): number[] {\n const counts = new Array<number>(breaks.length - 1).fill(0);\n const last = breaks.length - 1;\n\n // An index loop, against the map convention of CLAUDE.md: each value walks\n // a bisection and then adds to one entry of a shared accumulator.\n for (let i = 0; i < values.length; i += 1) {\n const value = values[i] as number;\n if (value < (breaks[0] as number) || value > (breaks[last] as number)) {\n continue;\n }\n\n let low = 0;\n let high = last;\n while (high - low >= 2) {\n const middle = (high + low) >> 1;\n if (value > (breaks[middle] as number)) {\n low = middle;\n } else {\n high = middle;\n }\n }\n counts[low] += 1;\n }\n\n return counts;\n}\n",
|
|
10
10
|
"/**\n * Seedable random draws for the sampling demonstrations.\n *\n * R gets these from `runif()`, `rnorm()`, and `sample()`, which all read one\n * global Mersenne Twister stream. This port makes the generator an argument\n * instead. A pure core cannot hold a stream, and a demonstration that a\n * student reloads must show the same numbers.\n *\n * The generator does not reproduce R's stream. No JavaScript generator does,\n * and the port plan does not ask for it. The requirement is that one seed\n * always gives one sequence, in this run and in every later run.\n *\n * The generator is mulberry32 (Tommy Ettinger, public domain): 32 bits of\n * state, four integer operations per draw, a period of 2^32, and a published\n * result on the gjrand test suite. It is small enough to read in full below,\n * which matters more here than statistical strength — these draws teach the\n * sampling distribution, they do not protect anything. Do not use this module\n * for cryptography.\n */\n\nimport { requireCount, sum } from \"./arith\";\n\n/** A source of uniform values in the interval [0, 1). */\nexport type Rng = () => number;\n\n/** The parameters of `runif`. The defaults are the defaults of R's `runif`. */\nexport interface RunifOptions {\n /** The low end of the interval. */\n readonly min?: number;\n /** The high end of the interval. The generator never returns it. */\n readonly max?: number;\n}\n\n/** The parameters of `rnorm`. The defaults are the defaults of R's `rnorm`. */\nexport interface RnormOptions {\n /** The center of the distribution. */\n readonly mean?: number;\n /** The standard deviation. A negative value gives NaN, as in R. */\n readonly sd?: number;\n}\n\n/**\n * The parameters of `rlnorm`. The defaults are the defaults of R's `rlnorm`.\n *\n * Both name the normal distribution behind the exponential, not the lognormal\n * distribution itself.\n */\nexport interface RlnormOptions {\n /** The center of the normal behind the exponential. */\n readonly meanlog?: number;\n /**\n * The standard deviation of the normal behind the exponential. A negative\n * value gives NaN, as in R.\n */\n readonly sdlog?: number;\n}\n\n/**\n * The parameters of `rcauchy`. The defaults are the defaults of R's\n * `rcauchy`.\n */\nexport interface RcauchyOptions {\n /** The center of the distribution. It is the median, not a mean. */\n readonly location?: number;\n /** The half-width at half-maximum. A negative value gives NaN, as in R. */\n readonly scale?: number;\n}\n\n/**\n * Make a generator from a seed.\n *\n * Two generators of one seed give the same sequence. The seed keeps only its\n * integer part, and only the low 32 bits of that.\n *\n * @param seed The start state. It must be finite.\n * @returns A generator of uniform values in [0, 1).\n * @throws RangeError If the seed is not finite.\n */\nexport function seededRng(seed: number): Rng {\n if (!Number.isFinite(seed)) {\n throw new RangeError(`seed must be finite, got ${seed}`);\n }\n\n let state = Math.trunc(seed) | 0;\n\n return () => {\n state = (state + 0x6d2b79f5) | 0;\n let mixed = Math.imul(state ^ (state >>> 15), 1 | state);\n mixed = (mixed + Math.imul(mixed ^ (mixed >>> 7), 61 | mixed)) ^ mixed;\n return ((mixed ^ (mixed >>> 14)) >>> 0) / 4294967296;\n };\n}\n\n/**\n * Draw uniform values.\n *\n * The function takes one value from the generator for each result, in order.\n *\n * An interval with `min` above `max`, or with a bound that is not finite,\n * gives NaN for every result and takes nothing from the generator. R does the\n * same, with a warning that a library cannot give.\n *\n * @param rng The source of randomness.\n * @param n How many values to draw. It must be a non-negative integer.\n * @param options The interval. The default is [0, 1).\n * @returns The drawn values.\n * @throws RangeError If n is negative or is not an integer.\n */\nexport function runif(\n rng: Rng,\n n: number,\n options: RunifOptions = {},\n): number[] {\n requireCount(n, \"n\");\n const { min = 0, max = 1 } = options;\n\n if (!Number.isFinite(min) || !Number.isFinite(max) || max < min) {\n return new Array<number>(n).fill(Number.NaN);\n }\n\n return Array.from({ length: n }, () => min + (max - min) * rng());\n}\n\n/**\n * Draw normal values.\n *\n * The function uses the Box-Muller transform, which makes two independent\n * standard normal values from two uniform values. It takes the values in\n * pairs: the first value of a pair gives the radius, the second gives the\n * angle. An odd count discards the second value of the last pair, so the\n * count of draws from the generator is always `2 * ceil(n / 2)`.\n *\n * The radius is `sqrt(-2 * log(1 - u))`, not `sqrt(-2 * log(u))`. The\n * generator can return an exact 0 but never returns 1, and `log(0)` is not\n * finite. The subtraction moves the open end of the interval to the point\n * where the logarithm needs it.\n *\n * A `mean` that is not finite, or an `sd` that is negative or not finite,\n * gives NaN for every result and takes nothing from the generator, as in R.\n *\n * @param rng The source of randomness.\n * @param n How many values to draw. It must be a non-negative integer.\n * @param options The center and the spread. The default is the standard\n * normal distribution.\n * @returns The drawn values.\n * @throws RangeError If n is negative or is not an integer.\n */\nexport function rnorm(\n rng: Rng,\n n: number,\n options: RnormOptions = {},\n): number[] {\n requireCount(n, \"n\");\n const { mean = 0, sd = 1 } = options;\n\n if (!Number.isFinite(mean) || !Number.isFinite(sd) || sd < 0) {\n return new Array<number>(n).fill(Number.NaN);\n }\n\n const pairs = Array.from({ length: Math.ceil(n / 2) }, () =>\n standardNormalPair(rng),\n );\n return pairs\n .flat()\n .slice(0, n)\n .map((z) => mean + sd * z);\n}\n\n/**\n * Draw Student t values.\n *\n * Each value is `z / sqrt(chiSquare / df)`: a standard normal draw over the\n * square root of a scaled chi-square. The chi-square is the sum of `df`\n * squared standard normal draws. The draws come in bulk: one `rnorm` call of\n * length `n` for the numerators, then `df` further calls of length `n`, one\n * per chi-square component. Each `rnorm` call takes `2 * ceil(n / 2)` values\n * from the generator, so `rt` takes `(df + 1) * 2 * ceil(n / 2)`.\n *\n * R's `rt` accepts any `df > 0`, through a gamma sampler. A gamma sampler\n * rejects and redraws, so it cannot state a draw count. This port accepts a\n * positive integer `df` only, which the normal construction covers with a\n * fixed draw count. A `df` that is not a positive finite integer gives NaN\n * for every result and takes nothing from the generator, as `rnorm` does for\n * a bad `sd`.\n *\n * @param rng The source of randomness.\n * @param n How many values to draw. It must be a non-negative integer.\n * @param df The degrees of freedom. It must be a positive integer.\n * @returns The drawn values.\n * @throws RangeError If n is negative or is not an integer.\n */\nexport function rt(rng: Rng, n: number, df: number): number[] {\n requireCount(n, \"n\");\n\n if (!Number.isInteger(df) || df <= 0) {\n return new Array<number>(n).fill(Number.NaN);\n }\n\n const z = rnorm(rng, n);\n const components = Array.from({ length: df }, () => rnorm(rng, n));\n return z.map((numerator, index) => {\n // The index is inside every component: each rnorm call returns n values.\n const chiSquare = sum(\n components.map((draws) => (draws[index] as number) ** 2),\n );\n return numerator / Math.sqrt(chiSquare / df);\n });\n}\n\n/**\n * Draw lognormal values.\n *\n * A lognormal value is the exponential of a normal one, so this draws from\n * `rnorm` at `meanlog` and `sdlog` and exponentiates each value. The draw\n * count is therefore `rnorm`'s, `2 * ceil(n / 2)`.\n *\n * The parameters name the normal distribution behind the exponential, not the\n * distribution the function returns. R names them the same way. Every draw is\n * above zero, and the shape leans right: the median is `exp(meanlog)` and the\n * mean sits above it.\n *\n * A `meanlog` that is not finite, or an `sdlog` that is negative or not\n * finite, gives NaN for every result and takes nothing from the generator, as\n * `rnorm` does.\n *\n * @param rng The source of randomness.\n * @param n How many values to draw. It must be a non-negative integer.\n * @param options The center and the spread of the normal behind the\n * exponential. The default is the standard normal, as in R.\n * @returns The drawn values.\n * @throws RangeError If n is negative or is not an integer.\n */\nexport function rlnorm(\n rng: Rng,\n n: number,\n options: RlnormOptions = {},\n): number[] {\n const { meanlog = 0, sdlog = 1 } = options;\n return rnorm(rng, n, { mean: meanlog, sd: sdlog }).map(Math.exp);\n}\n\n/**\n * Draw Cauchy values.\n *\n * This is R's `rcauchy(n, location, scale)`, by the inverse rule: the Cauchy\n * quantile function is `location + scale * tan(pi * (u - 0.5))`, so applying\n * it to uniform draws gives Cauchy draws. The draws come in one `runif` call\n * of length `n`, so the function takes exactly `n` values from the generator.\n *\n * The Cauchy has no mean and no variance. Its center is the `location`, which\n * is the median, and its spread is the `scale`, the half-width at half of the\n * peak density. The tails are heavy enough that averages of draws do not\n * settle, which is what the sampling demonstrations use it for.\n *\n * A `location` that is not finite, or a `scale` that is negative or not\n * finite, gives NaN for every result and takes nothing from the generator,\n * as in R.\n *\n * @param rng The source of randomness.\n * @param n How many values to draw. It must be a non-negative integer.\n * @param options The center and the spread. The default is the standard\n * Cauchy distribution.\n * @returns The drawn values.\n * @throws RangeError If n is negative or is not an integer.\n */\nexport function rcauchy(\n rng: Rng,\n n: number,\n options: RcauchyOptions = {},\n): number[] {\n requireCount(n, \"n\");\n const { location = 0, scale = 1 } = options;\n\n if (!Number.isFinite(location) || !Number.isFinite(scale) || scale < 0) {\n return new Array<number>(n).fill(Number.NaN);\n }\n\n return runif(rng, n).map(\n (u) => location + scale * Math.tan(Math.PI * (u - 0.5)),\n );\n}\n\n/** Make two standard normal values from two uniform values. */\nfunction standardNormalPair(rng: Rng): [number, number] {\n const radius = Math.sqrt(-2 * Math.log(1 - rng()));\n const angle = 2 * Math.PI * rng();\n return [radius * Math.cos(angle), radius * Math.sin(angle)];\n}\n\n/**\n * Take values from a population, without replacement.\n *\n * This is R's `sample(values, k)`, which also samples without replacement by\n * default. The algorithm is a partial Fisher-Yates shuffle: step `i` takes one\n * value from the generator and swaps position `i` with position\n * `i + floor(u * (length - i))`, so each step selects from the values that no\n * earlier step took. The function takes exactly `k` values from the generator.\n *\n * The function copies the population. It does not modify the input.\n *\n * @param rng The source of randomness.\n * @param values The population. Any element type is permitted.\n * @param k How many values to take. It must be a non-negative integer.\n * @returns The taken values, in the order the algorithm found them.\n * @throws RangeError If k is negative, is not an integer, or is more than the\n * size of the population. R gives the same error: \"cannot take a sample\n * larger than the population when 'replace = FALSE'\".\n */\nexport function sampleWithoutReplacement<T>(\n rng: Rng,\n values: readonly T[],\n k: number,\n): T[] {\n requireCount(k, \"k\");\n if (k > values.length) {\n throw new RangeError(\n `cannot take a sample of ${k} from a population of ${values.length}`,\n );\n }\n\n const pool = values.slice();\n // An index loop, against the map convention of CLAUDE.md: each step swaps\n // two positions of the pool, which a map over the values cannot express.\n for (let i = 0; i < k; i += 1) {\n const chosen = i + Math.floor(rng() * (pool.length - i));\n const held = pool[chosen];\n pool[chosen] = pool[i];\n pool[i] = held;\n }\n\n return pool.slice(0, k);\n}\n",
|
|
11
11
|
"/**\n * Drawing samples and reading confidence intervals off them — the statistics\n * of `plot_sampling()` and `plot_sample_ci()` in `../compstatslib/R/`.\n *\n * Both demonstrations rest on the same idea: a statistic computed from a\n * sample is itself a random quantity, and drawing many samples shows how it\n * scatters. `plot_sampling()` draws repeatedly and accumulates the statistic;\n * `plot_sample_ci()` draws once and asks how often an interval built from a\n * sample covers the mean it was drawn from.\n *\n * Two rules shape this module, both from the port plan:\n *\n * - **The generator is an argument, and one call threads one generator.** R\n * reads a global stream, which a pure core cannot. `drawSamples` takes\n * exactly `reps * sampleSize` values from the generator it is given, in\n * draw order, so a caller who holds the generator can keep drawing where\n * the last call stopped. Restarting the generator per repetition would\n * return the same sample every time.\n * - **Accumulation belongs to the caller.** R's `plot_sampling()` returns a\n * `vars` list holding every statistic drawn so far, and its interactive\n * wrapper hands that back on the next call. This module takes one draw's\n * inputs and returns one draw's outputs; nothing is kept between calls.\n *\n * Verified against R 4.5.3 in `sampling.test.ts` for the interval arithmetic.\n * The drawn values cannot be checked against R and are not meant to be: a\n * seeded JavaScript generator does not reproduce R's Mersenne Twister.\n */\n\nimport { mean, requireCount, sd } from \"./arith\";\nimport { rnorm, sampleWithoutReplacement, type Rng } from \"./rng\";\n\n/** R's hardcoded 95% multiplier in `plot_sample_ci()`. Not `qnorm(0.975)`. */\nconst CI95_MULTIPLIER = 1.96;\n\n/** R's hardcoded 99% multiplier. Not `qnorm(0.995)`, which is 2.5758. */\nconst CI99_MULTIPLIER = 2.58;\n\n/** The defaults of R's `plot_sample_ci()`. */\nconst DEFAULT_POP_SIZE = 10000;\nconst DEFAULT_NUM_SAMPLES = 100;\nconst DEFAULT_SAMPLE_SIZE = 100;\n\n/** What one call to `drawSamples` should do. */\nexport interface DrawSamplesOptions {\n /** How many values to take per sample. R's `sample_size`. */\n readonly sampleSize: number;\n /** How many samples to draw in this call. R's `reps`, default 1. */\n readonly reps?: number;\n /**\n * The statistic to compute from each sample. R's `theta`, default the mean.\n * Any function of a sample will do — the median, a trimmed mean, a range.\n */\n readonly theta?: (sample: readonly number[]) => number;\n}\n\n/** One draw: the samples themselves and the statistic of each. */\nexport interface SampleDraw {\n /**\n * The samples, in draw order. R holds these as the columns of a matrix, so\n * flattening this array gives the same order R's `as.vector()` does — which\n * is what to hand `kernelDensity` when pooling them.\n */\n readonly samples: readonly (readonly number[])[];\n /** The statistic of each sample, in the same order. */\n readonly thetas: readonly number[];\n}\n\n/** A pair of bounds. */\nexport interface Interval {\n readonly low: number;\n readonly high: number;\n}\n\n/** What one sample says about the mean it was drawn from. */\nexport interface SampleInterval {\n /** The sample mean. */\n readonly mean: number;\n /** The sample standard deviation, with R's n − 1 denominator. */\n readonly sd: number;\n /** The standard error, `sd / sqrt(sampleSize)`. */\n readonly standardError: number;\n /** The 95% interval, `mean ± 1.96 * standardError`. */\n readonly ci95: Interval;\n /** The 99% interval, `mean ± 2.58 * standardError`. */\n readonly ci99: Interval;\n /**\n * Whether either interval misses the population mean — R's `bad` set, one\n * sample at a time. R collects the positions where this holds.\n */\n readonly excludesPopulationMean: boolean;\n}\n\n/** How to simulate a population. R's `distr_func` with its `...` bound in. */\nexport type DistributionFn = (rng: Rng, n: number) => number[];\n\n/** What one call to `simulateSampleCi` should do. R's own defaults. */\nexport interface SampleCiOptions {\n /** How many samples to draw. R's `num_samples`, default 100. */\n readonly numSamples?: number;\n /** How many values per sample. R's `sample_size`, default 100. */\n readonly sampleSize?: number;\n /** How many values in the simulated population. R's `pop_size`, 10000. */\n readonly popSize?: number;\n /**\n * How to draw the population. R's `distr_func`, default `rnorm` with its\n * own defaults, a standard normal. A caller who wants R's\n * `plot_sample_ci(distr_func = runif, min = 17, max = 35)` passes\n * `(rng, n) => runif(rng, n, { min: 17, max: 35 })`, which is what R's\n * `...` pass-through amounts to.\n */\n readonly distribution?: DistributionFn;\n}\n\n/** The simulated population's statistics and every sample's interval. */\nexport interface SampleCiSimulation {\n /** The mean of the drawn population. R draws its vertical line here. */\n readonly populationMean: number;\n /** The spread of the drawn population. R's window is this wide, halved. */\n readonly populationSd: number;\n /** One entry per sample, in draw order. */\n readonly intervals: readonly SampleInterval[];\n}\n\n/**\n * Draw samples from a population and compute a statistic from each.\n *\n * This is R's `replicate(reps, sample(population, sample_size))` followed by\n * `apply(samples, FUN = theta, MARGIN = 2)`. Sampling is without replacement,\n * as R's `sample()` is by default, so a value appears at most once within a\n * sample — though the same value can appear in several samples.\n *\n * @param rng The source of randomness. The call takes exactly\n * `reps * sampleSize` values from it.\n * @param population The values to draw from. The function does not modify\n * them.\n * @param options The sample size, how many samples, and the statistic.\n * @returns The samples in draw order and the statistic of each.\n * @throws RangeError If `reps` or `sampleSize` is negative or fractional, or\n * if `sampleSize` is larger than the population — the last from\n * `sampleWithoutReplacement`, which is where R's own refusal lives.\n */\nexport function drawSamples(\n rng: Rng,\n population: readonly number[],\n options: DrawSamplesOptions,\n): SampleDraw {\n const { sampleSize, reps = 1, theta = mean } = options;\n requireCount(reps, \"reps\");\n\n // Array.from calls its builder once per index, in order, so the samples\n // come off the one generator in draw order.\n const samples = Array.from({ length: reps }, () =>\n sampleWithoutReplacement(rng, population, sampleSize),\n );\n\n return { samples, thetas: samples.map((sample) => theta(sample)) };\n}\n\n/**\n * Read a confidence interval off each sample.\n *\n * The multipliers are R's own literal 1.96 and 2.58, not quantiles of any\n * distribution. That matters: 2.58 is not `qnorm(0.995)` to more than three\n * digits, and a port that \"corrected\" it would draw slightly different bars\n * from the R original the demonstration is taught beside.\n *\n * A sample of one gives NaN throughout, because its standard deviation is\n * undefined — R reports NA there and drops it from the `bad` set, and NaN\n * comparisons being false does the same thing here.\n *\n * @param samples The samples, each already drawn.\n * @param populationMean The mean the samples were drawn from, which the\n * intervals are asked to cover.\n * @returns One entry per sample, in the order given.\n */\nexport function sampleConfidenceIntervals(\n samples: readonly (readonly number[])[],\n populationMean: number,\n): SampleInterval[] {\n return samples.map((sample) => {\n const center = mean(sample);\n const spread = sd(sample);\n const standardError = spread / Math.sqrt(sample.length);\n const ci95 = spreadAround(center, standardError, CI95_MULTIPLIER);\n const ci99 = spreadAround(center, standardError, CI99_MULTIPLIER);\n\n return {\n mean: center,\n sd: spread,\n standardError,\n ci95,\n ci99,\n // R's four-way test, kept whole. The 99% interval contains the 95% one,\n // so only the 95% pair can fire, but this is what R asks and reading it\n // back to R's source should not need an argument about which half is\n // redundant.\n excludesPopulationMean:\n ci95.low > populationMean ||\n ci95.high < populationMean ||\n ci99.low > populationMean ||\n ci99.high < populationMean,\n };\n });\n}\n\n/** Build an interval of so many standard errors around a center. */\nfunction spreadAround(\n center: number,\n standardError: number,\n multiplier: number,\n): Interval {\n return {\n low: center - standardError * multiplier,\n high: center + standardError * multiplier,\n };\n}\n\n/**\n * Simulate a population, sample it many times, and interval each sample.\n *\n * This is the whole of `plot_sample_ci()` except the drawing. The population\n * is simulated rather than given, which is the point of the demonstration:\n * the true mean is known, so a student can count how many intervals miss it.\n *\n * The call takes the population's draws from the generator first, then each\n * sample's, so a caller replaying one seed gets one simulation.\n *\n * @param rng The source of randomness, threaded through the whole call.\n * @param options The sizes and the population's distribution.\n * @returns The population's mean and spread, and every sample's interval.\n * @throws RangeError If a count is negative or fractional, or if the sample\n * size is larger than the population.\n */\nexport function simulateSampleCi(\n rng: Rng,\n options: SampleCiOptions = {},\n): SampleCiSimulation {\n const {\n numSamples = DEFAULT_NUM_SAMPLES,\n sampleSize = DEFAULT_SAMPLE_SIZE,\n popSize = DEFAULT_POP_SIZE,\n distribution = standardNormal,\n } = options;\n requireCount(numSamples, \"numSamples\");\n requireCount(popSize, \"popSize\");\n\n const population = distribution(rng, popSize);\n const populationMean = mean(population);\n const { samples } = drawSamples(rng, population, {\n sampleSize,\n reps: numSamples,\n });\n\n return {\n populationMean,\n populationSd: sd(population),\n intervals: sampleConfidenceIntervals(samples, populationMean),\n };\n}\n\n/** R's default `distr_func`, `rnorm` with its own defaults. */\nfunction standardNormal(rng: Rng, n: number): number[] {\n return rnorm(rng, n);\n}\n",
|
|
12
12
|
"/**\n * Column-keyed data frames, and the checks R gets for free.\n *\n * The 3D functions of the R package take an R data frame, which guarantees\n * two things a JavaScript object does not: every column holds one type, and\n * every column has the same length. `moderation.ts` and the scatter3d module\n * both need those guarantees, so the questions are asked in one place and\n * answered the same way for both.\n *\n * The port follows `../compstatslib/R/scatter3d_helpers.R`:\n *\n * ```r\n * scatter3d_numeric_cols <- function(data) {\n * names(data)[vapply(data, is.numeric, logical(1))]\n * }\n * ```\n *\n * with two departures, both forced by the language and both pinned by tests.\n * R reads a vector's declared type, so `is.numeric(numeric(0))` is TRUE and a\n * column of mixed types cannot exist. A JavaScript array declares nothing, so\n * this module reads the values: **a column is numeric when it holds at least\n * one value and every value is a number.** An empty column therefore is not\n * numeric — it offers no evidence either way, and an empty axis draws nothing\n * — and a column of numbers with one string in it is not numeric either,\n * because fitting it would give `NaN` for every coefficient.\n */\n\n/**\n * One column of a data frame.\n *\n * Numeric columns carry the statistics. The other two types are here because\n * `plot_scatter3d()` accepts a categorical column for `color`, which R allows\n * to be a factor, a character vector, or a logical vector.\n */\nexport type Column = readonly number[] | readonly string[] | readonly boolean[];\n\n/**\n * A data frame: named columns of equal length.\n *\n * The equal length is a rule, not a type. `frameRows` enforces it.\n */\nexport type DataFrame = { readonly [name: string]: Column };\n\n/**\n * Report whether a column holds numbers, and narrow it when it does.\n *\n * @param column The column to inspect.\n * @returns True when the column has at least one value and every value is a\n * number. `NaN` counts as a number, as R's missing values do.\n */\nexport function isNumericColumn(column: Column): column is readonly number[] {\n return column.length > 0 && column.every((value) => typeof value === \"number\");\n}\n\n/**\n * Name the numeric columns, in the order the frame declares them.\n *\n * This is R's `scatter3d_numeric_cols()`. The order matters: the scatter3d\n * default takes the first three names this returns.\n *\n * @param data The frame to inspect.\n * @returns The names of the numeric columns, in insertion order.\n */\nexport function numericColumns(data: DataFrame): string[] {\n return Object.keys(data).filter((name) =>\n isNumericColumn(data[name] as Column),\n );\n}\n\n/**\n * Refuse a frame that cannot fill three numeric axes.\n *\n * This is R's `scatter3d_require_3_numeric()`, which both the plot and the\n * gadget call with their own name, so that the message says which function\n * the caller reached.\n *\n * @param numeric The numeric column names, from `numericColumns`.\n * @param caller The name to print, such as `plotScatter3d`.\n * @throws RangeError If fewer than three names were given.\n */\nexport function requireThreeNumericColumns(\n numeric: readonly string[],\n caller: string,\n): void {\n if (numeric.length < 3) {\n throw new RangeError(\n `${caller}() needs at least 3 numeric columns; got ${numeric.length}. ` +\n \"Supply x/y/z explicitly or add numeric columns.\",\n );\n }\n}\n\n/**\n * Return the number of rows, and refuse a frame that has no single answer.\n *\n * @param data The frame to measure.\n * @returns The shared length of the columns. A frame with no columns has no\n * rows.\n * @throws RangeError If two columns have different lengths. An R data frame\n * cannot be built that way, so nothing downstream is written to survive it.\n */\nexport function frameRows(data: DataFrame): number {\n const names = Object.keys(data);\n const first = names[0];\n if (first === undefined) {\n return 0;\n }\n\n const rows = (data[first] as Column).length;\n const ragged = names.find((name) => (data[name] as Column).length !== rows);\n if (ragged !== undefined) {\n throw new RangeError(\n `every column needs the same number of rows: \"${first}\" has ${rows} ` +\n `but \"${ragged}\" has ${(data[ragged] as Column).length}`,\n );\n }\n\n return rows;\n}\n\n/**\n * Read one numeric column, or explain why it cannot be used.\n *\n * The wording follows R's own, which names both the column and the argument\n * it arrived through: `Column \"b\" (passed as \\`x\\`) is not in \\`data\\`.`\n *\n * @param data The frame to read.\n * @param name The column name the caller asked for.\n * @param role The option that carried the name, such as `iv` or `mod`. It\n * appears in the error, so the caller learns which argument is wrong.\n * @returns The column.\n * @throws RangeError If the frame has no such column, or the column is not\n * numeric.\n */\nexport function requireNumericColumn(\n data: DataFrame,\n name: string,\n role: string,\n): readonly number[] {\n const column = data[name];\n if (column === undefined) {\n throw new RangeError(\n `Column \"${name}\" (passed as \\`${role}\\`) is not in the data.`,\n );\n }\n if (!isNumericColumn(column)) {\n throw new RangeError(\n `Column \"${name}\" (passed as \\`${role}\\`) is not numeric; ` +\n \"only numeric columns can carry the statistics.\",\n );\n }\n\n return column;\n}\n",
|
|
13
|
-
"/**\n * Dense (weighted) least squares for small designs.\n *\n * This is the equivalent of R's `lm.wfit()`, and of the solver R runs inside\n * every step of `glm.fit()`'s IRLS loop. R factors the design with `dqrdc2`,\n * a Householder QR with a limited column-pivoting rule: a column whose norm\n * has collapsed against the columns to its left is moved to the right edge\n * and its coefficient is reported as `NA`. The port reproduces that rule,\n * because it is what makes `lm()` and `glm()` report an aliased coefficient\n * instead of dividing by a near-zero pivot. Verified against R in\n * `ols.test.ts`.\n *\n * Designs here are tiny — two columns for logit, four for a moderation\n * surface — so the code follows the LINPACK routine plainly rather than\n * blocking or vectorizing it.\n */\n\nimport { sum, zipWith } from \"./arith\";\n\n/**\n * The result of a fit.\n *\n * A `null` coefficient is the equivalent of R's `NA`: the column carried no\n * information beyond the columns to its left, so R aliases it. `linearRegression`\n * uses the same convention.\n */\nexport interface LeastSquaresFit {\n /**\n * One coefficient per design column, in column order. An aliased column\n * reports null.\n */\n readonly coefficients: readonly (number | null)[];\n /** The fitted response of each row, in input order. */\n readonly fitted: readonly number[];\n /** Response minus fit, of each row, in input order. */\n readonly residuals: readonly number[];\n /** The number of columns the fit could identify. */\n readonly rank: number;\n}\n\nexport interface LeastSquaresOptions {\n /**\n * One weight per row, on R's `lm.wfit()` scale: the solver applies the\n * square root itself.\n *\n * IRLS is the trap here. `glm.fit` carries square-root weights `w` and\n * hands `x * w` to its QR routine, so a caller porting that loop passes\n * `w * w` here, not `w`.\n *\n * A weight of zero drops the row from the fit. The row still gets a fitted\n * value, predicted from the other rows, as it does in R.\n */\n readonly weights?: readonly number[];\n /**\n * How far a column's norm may collapse before the fit aliases it.\n *\n * A column is aliased when its norm, after the columns to its left are\n * projected out, falls below this fraction of its original norm. The\n * default is the value `lm.fit()` uses. `glm.fit()` passes\n * `min(1e-7, epsilon / 1000)`, which is `1e-11` at R's default epsilon.\n */\n readonly tolerance?: number;\n}\n\n/** The rank tolerance of R's `lm.fit()`. */\nexport const DEFAULT_LEAST_SQUARES_TOLERANCE = 1e-7;\n\n/**\n * Fit `y` on the columns of `design` by least squares.\n *\n * @param design One row per observation, each row one value per column. A\n * model with an intercept carries a leading column of ones. The function\n * does not modify it.\n * @param y The response, one value per row.\n * @param options Weights and the rank tolerance.\n * @returns The coefficients, the fit, and the rank.\n * @throws RangeError if there are no rows, if the shapes disagree, or if a\n * weight is negative. R refuses the same inputs: \"0 (non-NA) cases\" and\n * \"missing or negative weights not allowed\".\n */\nexport function leastSquares(\n design: readonly (readonly number[])[],\n y: readonly number[],\n options: LeastSquaresOptions = {},\n): LeastSquaresFit {\n const { weights, tolerance = DEFAULT_LEAST_SQUARES_TOLERANCE } = options;\n const rows = design.length;\n\n if (rows === 0) {\n throw new RangeError(\"least squares needs at least one row\");\n }\n const width = design[0].length;\n if (design.some((row) => row.length !== width)) {\n throw new RangeError(\"every design row needs the same number of columns\");\n }\n if (y.length !== rows) {\n throw new RangeError(\n `the response has ${y.length} values but the design has ${rows} rows`,\n );\n }\n if (weights !== undefined) {\n if (weights.length !== rows) {\n throw new RangeError(\n `there are ${weights.length} weights but ${rows} rows`,\n );\n }\n if (weights.some((weight) => !(weight >= 0))) {\n throw new RangeError(\"weights cannot be negative or missing\");\n }\n }\n\n // Scale each row by the square root of its weight, which turns the weighted\n // problem into an ordinary one. This is what lm.wfit and glm.fit both do.\n const scale = weights?.map((weight) => Math.sqrt(weight));\n const scaled = (value: number, row: number): number =>\n scale === undefined ? value : value * scale[row];\n\n const columns = Array.from({ length: width }, (_, column) =>\n design.map((row, index) => scaled(row[column], index)),\n );\n const projected = y.map(scaled);\n\n const { householders, pivot, rank } = decompose(columns, tolerance, rows);\n applyHouseholders(columns, householders, projected, Math.min(rank, rows - 1));\n const solved = backSubstitute(columns, projected, rank);\n\n // The solve returns the coefficients in pivot order. An aliased column\n // never reaches the solve and keeps its null, the way R reports NA.\n const coefficients = new Array<number | null>(width).fill(null);\n pivot.slice(0, rank).forEach((column, position) => {\n coefficients[column] = solved[position];\n });\n\n const fitted = design.map((row) =>\n sum(\n zipWith(row, coefficients, (value, coefficient) =>\n coefficient === null ? 0 : value * coefficient,\n ),\n ),\n );\n const residuals = zipWith(y, fitted, (value, fit) => value - fit);\n\n return { coefficients, fitted, residuals, rank };\n}\n\n/**\n * Factor the columns in place, R's way.\n *\n * `dqrdc2` walks the columns left to right. A column whose remaining norm has\n * fallen below `tolerance` times its original norm moves to the right edge and\n * the columns behind it shift left, so the columns that survive keep their\n * original order — which is why R can report the coefficients of a rank-\n * deficient fit in their own slots, with `NA` in the slot of the column it\n * dropped.\n *\n * On return each column holds its part of R above the diagonal and the\n * Householder vector below it, as LINPACK stores them.\n *\n * @returns The Householder scalars, the column order, and the rank.\n */\nfunction decompose(\n columns: number[][],\n tolerance: number,\n rows: number,\n): { householders: number[]; pivot: number[]; rank: number } {\n const width = columns.length;\n const pivot = columns.map((_, column) => column);\n // R substitutes 1 for a zero norm, so that an all-zero column compares as\n // negligible rather than dividing by zero.\n const originalNorms = columns.map((column) => norm(column, 0) || 1);\n const householders = new Array<number>(width).fill(0);\n // The count of columns still in play. R keeps this as `k` and rank is\n // min(k, rows) once the walk is over.\n let live = width;\n\n // Index loops throughout: a QR factorization addresses single matrix\n // entries by position, and this one follows LINPACK's dqrdc2 step for step.\n for (let step = 0; step < Math.min(rows, width); step++) {\n while (\n step < live &&\n norm(columns[step], step) < originalNorms[step] * tolerance\n ) {\n cycleToEnd(columns, pivot, originalNorms, step);\n live -= 1;\n }\n\n // The last row leaves nothing to reflect. R skips it and keeps the entry\n // as it stands, which is how a design with more columns than rows still\n // resolves the coefficients it can.\n if (step === rows - 1) {\n continue;\n }\n householders[step] = reflect(columns, step, rows);\n }\n\n return { householders, pivot, rank: Math.min(live, rows) };\n}\n\n/**\n * Build the Householder reflector of one column and apply it to the columns\n * to its right.\n *\n * @returns The leading entry of the reflector, which R keeps in `qraux`.\n */\nfunction reflect(columns: number[][], step: number, rows: number): number {\n const column = columns[step];\n const length = norm(column, step);\n if (length === 0) {\n return 0;\n }\n // Reflect away from the leading entry, so that nothing cancels.\n const pivotNorm = column[step] < 0 ? -length : length;\n\n for (let row = step; row < rows; row++) {\n column[row] = column[row] / pivotNorm;\n }\n const leading = 1 + column[step];\n column[step] = leading;\n\n for (let index = step + 1; index < columns.length; index++) {\n const other = columns[index];\n let inner = 0;\n for (let row = step; row < rows; row++) {\n inner += column[row] * other[row];\n }\n const factor = -inner / leading;\n for (let row = step; row < rows; row++) {\n other[row] = other[row] + factor * column[row];\n }\n }\n\n column[step] = -pivotNorm;\n return leading;\n}\n\n/** Apply the stored reflectors to the response, giving Qᵀy. */\nfunction applyHouseholders(\n columns: readonly number[][],\n householders: readonly number[],\n response: number[],\n count: number,\n): void {\n const rows = response.length;\n\n for (let step = 0; step < count; step++) {\n const leading = householders[step];\n if (leading === 0) {\n continue;\n }\n const column = columns[step];\n // The reflector's leading entry lives outside the column, so the two\n // passes below read it separately from the entries under the diagonal.\n let inner = leading * response[step];\n for (let row = step + 1; row < rows; row++) {\n inner += column[row] * response[row];\n }\n const factor = -inner / leading;\n response[step] = response[step] + factor * leading;\n for (let row = step + 1; row < rows; row++) {\n response[row] = response[row] + factor * column[row];\n }\n }\n}\n\n/** Solve the leading `rank` columns of the triangular system. */\nfunction backSubstitute(\n columns: readonly number[][],\n response: readonly number[],\n rank: number,\n): number[] {\n const solved = new Array<number>(rank).fill(0);\n\n for (let row = rank - 1; row >= 0; row--) {\n let value = response[row];\n for (let column = row + 1; column < rank; column++) {\n value -= columns[column][row] * solved[column];\n }\n solved[row] = value / columns[row][row];\n }\n\n return solved;\n}\n\n/** Move one column to the right edge, sliding the rest left. */\nfunction cycleToEnd(\n columns: number[][],\n pivot: number[],\n originalNorms: number[],\n step: number,\n): void {\n moveToEnd(columns, step);\n moveToEnd(pivot, step);\n moveToEnd(originalNorms, step);\n}\n\n/** Move one entry of an array to its end, sliding the rest left. */\nfunction moveToEnd<T>(track: T[], from: number): void {\n const [moved] = track.splice(from, 1) as [T];\n track.push(moved);\n}\n\n/** The Euclidean length of a column from `from` down. */\nfunction norm(column: readonly number[], from: number): number {\n return Math.hypot(...column.slice(from));\n}\n",
|
|
14
|
-
"/**\n * The fitted surface of a moderated regression.\n *\n * This is the statistics half of `plot_moderation_3d()` in the R package,\n * which fits `lm(formula, data)`, predicts over a 15 by 15 grid of the IV and\n * the moderator, and hands the grid to `lattice::wireframe()`. Verified\n * against R in `moderation.test.ts`.\n *\n * Four things are worth knowing before reading the code.\n *\n * **Columns, not a formula.** R names the model with `y ~ x * z`. TypeScript\n * has no such notation, so the model arrives as column names, per CLAUDE.md:\n * an outcome, an IV, a moderator, an optional list of controls, and a flag\n * for the interaction. The three models the fixtures pin are\n * `{outcome: \"y\", iv: \"x\", mod: \"z\"}` (R's `y ~ x * z`), the same with\n * `interaction: false` (`y ~ x + z`), and the same with `controls: [\"w\"]`\n * (`y ~ x + z + w + x:z`).\n *\n * **The design follows R's model matrix, not the option order.** R's\n * `model.matrix` puts every main effect before any interaction, whatever\n * order the formula was typed in, so `y ~ x + z + w + x:z` gives the columns\n * `(Intercept), x, z, w, x:z`. This module builds them in that order, which\n * is what lets a caller read the coefficients next to R's.\n *\n * **Controls are held at their mean, and only numbers are accepted.** R's\n * `hold_value()` also handles factors (first level), characters (first in\n * sort order) and logicals (always FALSE). The bundled data has no such\n * column and no doc example uses one, so this port supports the numeric\n * branch alone and refuses the rest, rather than shipping three rules nothing\n * exercises. The other rules are recorded in\n * `.claude/plans/moderation-fixtures.md` section 4 if they are ever wanted.\n *\n * **Missing values leave the fit, as R's do.** `lm()` drops incomplete rows\n * through `na.omit` and `hold_value()` averages with `na.rm = TRUE`; this\n * port does the same, with NaN standing in for `NA` and any non-finite value\n * counting as missing. The details — the `na.exclude`-style NaN padding of\n * `fitted` and `residuals`, the one departure on `zlim` — are on\n * `moderationSurface` itself.\n */\n\nimport { extent, mean, sum, zipWith } from \"./arith\";\nimport { frameRows, requireNumericColumn, type DataFrame } from \"./frame\";\nimport { leastSquares } from \"./ols\";\n\n/**\n * The number of steps along each axis of the grid. R's\n * `plot_moderation_3d()` hardcodes `length.out = 15` for both.\n */\nconst GRID_STEPS = 15;\n\n/** Which columns make the model. */\nexport interface ModerationOptions {\n /** The column to predict — the vertical axis of the surface. */\n readonly outcome: string;\n /** The predictor on the first horizontal axis. */\n readonly iv: string;\n /** The predictor on the second horizontal axis. */\n readonly mod: string;\n /**\n * Whether the model carries the IV by moderator product. True by default,\n * which is R's `y ~ x * z`. False gives R's additive `y ~ x + z`, whose\n * surface is a plane with no twist.\n */\n readonly interaction?: boolean;\n /**\n * Further predictors to fit but not to plot. Each is held at its own mean\n * over the grid, R's `hold_value()` for a numeric column. Empty by default.\n */\n readonly controls?: readonly string[];\n}\n\n/** One fitted term, named as R names it. */\nexport interface ModerationTerm {\n /**\n * R's coefficient name: `(Intercept)`, a column name, or `iv:mod` for the\n * product term.\n */\n readonly name: string;\n /**\n * The coefficient, or null where R reports `NA` — a column the fit could\n * not tell apart from the columns before it.\n */\n readonly value: number | null;\n}\n\n/** A fitted model and the surface it predicts. */\nexport interface ModerationSurface {\n /** The fitted terms, in R's model-matrix order. */\n readonly coefficients: readonly ModerationTerm[];\n /**\n * The fitted outcome of each data row, in input order. NaN where the row\n * was dropped for a missing value, as R's `na.exclude` pads.\n */\n readonly fitted: readonly number[];\n /**\n * The outcome minus the fit, of each data row, in input order. NaN where\n * the row was dropped for a missing value.\n */\n readonly residuals: readonly number[];\n /** The 15 IV values of the grid, from the column's minimum to its maximum. */\n readonly ivValues: readonly number[];\n /** The 15 moderator values of the grid, over the same span. */\n readonly modValues: readonly number[];\n /**\n * The 225 predicted outcomes, **with the IV varying fastest**: index\n * `j * 15 + i` holds the prediction at `ivValues[i]` and `modValues[j]`.\n * This is the row order of R's `expand.grid(seq_iv, seq_mod)`.\n */\n readonly predictions: readonly number[];\n /**\n * The vertical range to draw, as `[low, high]`: the range of the observed\n * outcome together with the range of the surface. Which of the two reaches\n * further depends on the model — an interaction usually swings the surface\n * past the data at the corners of the grid, while a plane stays inside it.\n */\n readonly zlim: readonly [number, number];\n /** The value each control is held at over the grid: its mean. */\n readonly holds: Readonly<Record<string, number>>;\n}\n\n/**\n * Fit the model and predict its surface.\n *\n * Rows with a missing (non-finite) value in any model column are dropped\n * before fitting, R's `na.action = na.omit`; their fitted values and\n * residuals report NaN, keeping input order. The grid and zlim span the\n * finite values of their columns, and a control is held at its finite mean —\n * R's `hold_value()` with `na.rm = TRUE`. (R itself computes zlim with no\n * `na.rm` and fails on a missing outcome; the port draws what it can fit, a\n * stated departure.)\n *\n * @param data The frame holding every column the options name.\n * @param options Which column plays which part in the model.\n * @returns The fit, the grid, the surface, and the vertical range.\n * @throws RangeError If a named column is absent, empty, or not numeric, if\n * the IV and the moderator are the same column, if a control repeats\n * another named column, if the frame is ragged, or if no row is complete.\n */\nexport function moderationSurface(\n data: DataFrame,\n options: ModerationOptions,\n): ModerationSurface {\n const { outcome, iv, mod, interaction = true, controls = [] } = options;\n\n if (iv === mod) {\n throw new RangeError(\n `\\`iv\\` and \\`mod\\` must name different columns, both name \"${iv}\"`,\n );\n }\n // A repeated column would enter the design twice and alias itself, and the\n // caller would read a null coefficient with no clue why.\n const named = new Set([outcome, iv, mod]);\n controls.forEach((control) => {\n if (named.has(control)) {\n throw new RangeError(\n `control \"${control}\" already names the outcome, the iv, the mod, ` +\n \"or another control\",\n );\n }\n named.add(control);\n });\n\n const rows = frameRows(data);\n const y = requireNumericColumn(data, outcome, \"outcome\");\n const ivColumn = requireNumericColumn(data, iv, \"iv\");\n const modColumn = requireNumericColumn(data, mod, \"mod\");\n const controlColumns = controls.map((control) =>\n requireNumericColumn(data, control, \"controls\"),\n );\n\n // R's na.omit: a row with a missing value in any model column leaves the\n // fit. NaN is this library's missing value, and an infinity would poison\n // the fit the same way, so \"complete\" means finite everywhere.\n const modelColumns = [y, ivColumn, modColumn, ...controlColumns];\n const completeRows = y\n .map((_, row) => row)\n .filter((row) =>\n modelColumns.every((column) => Number.isFinite(column[row])),\n );\n if (completeRows.length === 0) {\n throw new RangeError(\n \"the model has no complete rows: every row is missing a value in \" +\n \"the outcome, the IV, the moderator, or a control\",\n );\n }\n\n // R's model.matrix order: the intercept, the main effects in the order the\n // model names them, then the interaction.\n const designColumns: readonly {\n readonly name: string;\n readonly values: readonly number[];\n }[] = [\n { name: \"(Intercept)\", values: new Array<number>(rows).fill(1) },\n { name: iv, values: ivColumn },\n { name: mod, values: modColumn },\n ...controls.map((control, index) => ({\n name: control,\n values: controlColumns[index] as readonly number[],\n })),\n ...(interaction\n ? [\n {\n name: `${iv}:${mod}`,\n values: zipWith(ivColumn, modColumn, (a, b) => a * b),\n },\n ]\n : []),\n ];\n\n const design = completeRows.map((row) =>\n designColumns.map((column) => column.values[row] as number),\n );\n const fit = leastSquares(\n design,\n completeRows.map((row) => y[row] as number),\n );\n const coefficients = designColumns.map((column, index) => ({\n name: column.name,\n value: fit.coefficients[index] ?? null,\n }));\n\n // R's na.exclude padding: report the fit in input order, NaN where a row\n // was dropped.\n const fitted = new Array<number>(rows).fill(Number.NaN);\n const residuals = new Array<number>(rows).fill(Number.NaN);\n completeRows.forEach((row, survivor) => {\n fitted[row] = fit.fitted[survivor] as number;\n residuals[row] = fit.residuals[survivor] as number;\n });\n\n // extent() ignores non-finite values, so each axis spans its column's\n // finite range — R's seq over min and max, which R only reaches when the\n // column has no NA. The hold is R's hold_value(): mean with na.rm = TRUE.\n const ivValues = rSeq(...extent(ivColumn), GRID_STEPS);\n const modValues = rSeq(...extent(modColumn), GRID_STEPS);\n const holds = Object.fromEntries(\n controls.map((control, index) => [\n control,\n mean(\n (controlColumns[index] as readonly number[]).filter(Number.isFinite),\n ),\n ]),\n );\n\n // R's predict() drops an aliased term rather than giving up on the row, so\n // a null coefficient contributes nothing here either.\n const weights = coefficients.map((term) => term.value ?? 0);\n const predictions = modValues.flatMap((modValue) =>\n ivValues.map((ivValue) => {\n const gridRow = [\n 1,\n ivValue,\n modValue,\n ...controls.map((control) => holds[control] as number),\n ...(interaction ? [ivValue * modValue] : []),\n ];\n return sum(zipWith(gridRow, weights, (value, weight) => value * weight));\n }),\n );\n\n const [dataLow, dataHigh] = extent(y);\n const [surfaceLow, surfaceHigh] = extent(predictions);\n\n return {\n coefficients,\n fitted,\n residuals,\n ivValues,\n modValues,\n predictions,\n zlim: [Math.min(dataLow, surfaceLow), Math.max(dataHigh, surfaceHigh)],\n holds,\n };\n}\n\n/**\n * Step from one end of a span to the other, the way R's\n * `seq(from, to, length.out = n)` does.\n *\n * R computes `from + i * by` in plain double arithmetic and writes both\n * endpoints in exactly. That last part matters — it is why the grid always\n * reaches the data's own minimum and maximum — and so does the plain\n * arithmetic: rounding the product and the sum together, as `pretty.ts` must\n * for R's other sequence path, moves 14 of the 30 grid coordinates of the\n * bundled dataset off R's values.\n *\n * @param from The first value.\n * @param to The last value.\n * @param length How many values to return.\n * @returns The sequence. A span of no width repeats its one value, as R's\n * `seq(3, 3, length.out = 15)` does.\n */\nfunction rSeq(from: number, to: number, length: number): number[] {\n if (from === to) {\n return new Array<number>(length).fill(from);\n }\n\n const by = (to - from) / (length - 1);\n return Array.from({ length }, (_, index) =>\n index === 0 ? from : index === length - 1 ? to : from + index * by,\n );\n}\n",
|
|
13
|
+
"/**\n * Special functions that the statistics in `core/` build on.\n *\n * JavaScript has no `lgamma` and no incomplete beta, so the distribution\n * functions need them here. R gets the same quantities from its own C\n * routines; this module is the port's replacement.\n *\n * Every function is pure. None of them touch the DOM or hold state.\n */\n\nimport { sum } from \"./arith\";\n\n/**\n * Lanczos parameter and coefficients, g = 607/128 with 15 terms.\n *\n * This set holds about 15 correct digits over the whole positive real line,\n * which is what the t quantiles need at 1e-12 relative tolerance.\n */\nconst LANCZOS_G = 607 / 128;\n\nconst LANCZOS_LEAD = 0.99999999999999709182;\n\nconst LANCZOS_TAIL: readonly number[] = [\n 57.156235665862923517, -59.597960355475491248, 14.136097974741747174,\n -0.49191381609762019978, 0.33994649984811888699e-4,\n 0.46523628927048575665e-4, -0.98374475304879564677e-4,\n 0.15808870322491248884e-3, -0.21026444172410488319e-3,\n 0.2174396181152126432e-3, -0.16431810653676389022e-3,\n 0.84418223983852743293e-4, -0.2619083840158140867e-4,\n 0.36899182659531622704e-5,\n];\n\nconst LOG_SQRT_TWO_PI = 0.5 * Math.log(2 * Math.PI);\n\n/**\n * The Lanczos series A(x), the slowly varying part of the approximation\n *\n * Γ(x) = √(2π) · (x + g − ½)^(x − ½) · e^−(x + g − ½) · A(x)\n */\nfunction lanczosSeries(x: number): number {\n return (\n LANCZOS_LEAD +\n sum(LANCZOS_TAIL.map((coefficient, index) => coefficient / (x + index)))\n );\n}\n\n/**\n * The natural log of the gamma function, R's `lgamma()`.\n *\n * @param x A positive number.\n * @returns log Γ(x), or NaN if x is zero or less.\n */\nexport function logGamma(x: number): number {\n if (!(x > 0)) {\n return Number.NaN;\n }\n const shifted = x + LANCZOS_G - 0.5;\n return (\n LOG_SQRT_TWO_PI +\n (x - 0.5) * Math.log(shifted) -\n shifted +\n Math.log(lanczosSeries(x))\n );\n}\n\n/**\n * The natural log of the beta function, R's `lbeta()`.\n *\n * The obvious route, `logGamma(a) + logGamma(b) - logGamma(a + b)`, subtracts\n * numbers near 600 for the degrees of freedom this package plots, and loses\n * about three digits doing so. Expanding the Lanczos form first cancels the\n * large terms by hand: the exponential parts collapse to the constant\n * −(g − ½), and the logarithmic parts become ratios that stay of order one.\n * What is left has no cancellation at all.\n *\n * Both ratios go through `log1p`. Each one sits just below 1, and taking the\n * quotient first would round away the small part that the log then reads —\n * a loss that grows with the larger argument, reaching 1e-13 by b = 2500.\n *\n * @param a A positive number.\n * @param b A positive number.\n * @returns log B(a, b), or NaN if either argument is zero or less.\n */\nexport function logBeta(a: number, b: number): number {\n if (!(a > 0) || !(b > 0)) {\n return Number.NaN;\n }\n const shiftedSum = a + b + LANCZOS_G - 0.5;\n return (\n LOG_SQRT_TWO_PI -\n (LANCZOS_G - 0.5) +\n Math.log(lanczosSeries(a)) +\n Math.log(lanczosSeries(b)) -\n Math.log(lanczosSeries(a + b)) +\n (a - 0.5) * Math.log1p(-b / shiftedSum) +\n (b - 0.5) * Math.log1p(-a / shiftedSum) -\n 0.5 * Math.log(shiftedSum)\n );\n}\n\n/** Iteration caps and guards for the continued fraction. */\nconst FRACTION_MAX_STEPS = 400;\nconst FRACTION_EPSILON = 3e-16;\nconst FRACTION_FLOOR = 1e-300;\n\n/**\n * The continued fraction of the incomplete beta function, by the modified\n * Lentz method.\n *\n * The loop is index based on purpose: it refines one running value step by\n * step and stops on a convergence test, so there is no array to map over.\n */\nfunction betaContinuedFraction(x: number, a: number, b: number): number {\n const total = a + b;\n const aPlus = a + 1;\n const aMinus = a - 1;\n\n let c = 1;\n let d = 1 - (total * x) / aPlus;\n if (Math.abs(d) < FRACTION_FLOOR) {\n d = FRACTION_FLOOR;\n }\n d = 1 / d;\n let value = d;\n\n for (let step = 1; step <= FRACTION_MAX_STEPS; step += 1) {\n const twice = 2 * step;\n\n const even = (step * (b - step) * x) / ((aMinus + twice) * (a + twice));\n d = 1 + even * d;\n if (Math.abs(d) < FRACTION_FLOOR) {\n d = FRACTION_FLOOR;\n }\n c = 1 + even / c;\n if (Math.abs(c) < FRACTION_FLOOR) {\n c = FRACTION_FLOOR;\n }\n d = 1 / d;\n value *= d * c;\n\n const odd = (-(a + step) * (total + step) * x) / ((a + twice) * (aPlus + twice));\n d = 1 + odd * d;\n if (Math.abs(d) < FRACTION_FLOOR) {\n d = FRACTION_FLOOR;\n }\n c = 1 + odd / c;\n if (Math.abs(c) < FRACTION_FLOOR) {\n c = FRACTION_FLOOR;\n }\n d = 1 / d;\n\n const delta = d * c;\n value *= delta;\n if (Math.abs(delta - 1) < FRACTION_EPSILON) {\n break;\n }\n }\n\n return value;\n}\n\n/**\n * The regularized incomplete beta function I_x(a, b), R's `pbeta()`.\n *\n * The continued fraction converges quickly only on one side of the\n * distribution, so the function evaluates the mirrored form when x sits above\n * the switch point and takes the complement.\n *\n * @param x A value between 0 and 1.\n * @param a A positive shape.\n * @param b A positive shape.\n * @returns The share of the beta density below x, or NaN for a bad shape.\n */\nexport function incompleteBeta(x: number, a: number, b: number): number {\n if (Number.isNaN(x)) {\n return Number.NaN;\n }\n if (x <= 0) {\n return 0;\n }\n if (x >= 1) {\n return 1;\n }\n return incompleteBetaSplit(x, 1 - x, a, b);\n}\n\n/**\n * The regularized incomplete beta function, told x and 1 − x separately.\n *\n * A caller that can write down both members of the pair should use this\n * instead of `incompleteBeta`. Once x is within 1e-16 of 1, the double\n * holding it has no room left for 1 − x, and rebuilding the complement by\n * subtraction throws away the very digits the answer rests on. `pt()` reads\n * both straight off t and df, so it gives up nothing.\n *\n * The two are treated as an exact pair, not as one value and a derived one:\n * each logarithm is taken from whichever member still carries its precision.\n *\n * @param x A value between 0 and 1.\n * @param complement The value of 1 − x, computed without subtracting.\n * @param a A positive shape.\n * @param b A positive shape.\n * @returns The share of the beta density below x, or NaN for a bad shape.\n */\nexport function incompleteBetaSplit(\n x: number,\n complement: number,\n a: number,\n b: number,\n): number {\n if (Number.isNaN(x) || Number.isNaN(complement) || !(a > 0) || !(b > 0)) {\n return Number.NaN;\n }\n if (x <= 0) {\n return 0;\n }\n if (complement <= 0) {\n return 1;\n }\n\n const logX = complement < 0.5 ? Math.log1p(-complement) : Math.log(x);\n const logComplement = x < 0.5 ? Math.log1p(-x) : Math.log(complement);\n const front = Math.exp(a * logX + b * logComplement - logBeta(a, b));\n\n if (x < (a + 1) / (a + b + 2)) {\n return (front * betaContinuedFraction(x, a, b)) / a;\n }\n return 1 - (front * betaContinuedFraction(complement, b, a)) / b;\n}\n\n/** Iteration cap and tolerance for the incomplete gamma routines. */\nconst GAMMA_MAX_STEPS = 1000;\nconst GAMMA_EPSILON = 3e-16;\n\n/**\n * P(a, x), the regularized lower incomplete gamma, by its power series.\n *\n * The series converges quickly while x stays below a + 1. Index loop with a\n * stated reason: it sums one term at a time and stops on a size test.\n */\nfunction lowerGammaSeries(a: number, x: number): number {\n let term = 1 / a;\n let total = term;\n for (let step = 1; step <= GAMMA_MAX_STEPS; step += 1) {\n term *= x / (a + step);\n total += term;\n if (Math.abs(term) < Math.abs(total) * GAMMA_EPSILON) {\n break;\n }\n }\n return total * Math.exp(-x + a * Math.log(x) - logGamma(a));\n}\n\n/**\n * Q(a, x), the regularized upper incomplete gamma, by the modified Lentz\n * method on its continued fraction.\n *\n * This is the branch that carries the far normal tail, where the answer runs\n * to 1e-70 and below and must stay accurate relative to itself.\n */\nfunction upperGammaFraction(a: number, x: number): number {\n let b = x + 1 - a;\n let c = 1 / FRACTION_FLOOR;\n let d = 1 / b;\n let value = d;\n\n for (let step = 1; step <= GAMMA_MAX_STEPS; step += 1) {\n const numerator = -step * (step - a);\n b += 2;\n d = numerator * d + b;\n if (Math.abs(d) < FRACTION_FLOOR) {\n d = FRACTION_FLOOR;\n }\n c = b + numerator / c;\n if (Math.abs(c) < FRACTION_FLOOR) {\n c = FRACTION_FLOOR;\n }\n d = 1 / d;\n const delta = d * c;\n value *= delta;\n if (Math.abs(delta - 1) < GAMMA_EPSILON) {\n break;\n }\n }\n\n return value * Math.exp(-x + a * Math.log(x) - logGamma(a));\n}\n\n/** Q(a, x), taking whichever of the two routes converges at this x. */\nfunction upperGamma(a: number, x: number): number {\n if (x <= 0) {\n return 1;\n }\n if (!Number.isFinite(x)) {\n return 0;\n }\n return x < a + 1 ? 1 - lowerGammaSeries(a, x) : upperGammaFraction(a, x);\n}\n\n/**\n * The standard normal distribution function, R's `pnorm()`.\n *\n * Built on the identity Φ(−z) = ½ · Q(½, z²/2), which keeps the far tail\n * accurate relative to itself rather than losing it against 1. The\n * non-central t needs Φ(−ncp) down to 1e-72 at the widest slider settings.\n *\n * @param z Where to evaluate the distribution.\n * @returns A probability between 0 and 1, or NaN for a NaN input.\n */\nexport function normalCdf(z: number): number {\n if (Number.isNaN(z)) {\n return Number.NaN;\n }\n const lower = 0.5 * upperGamma(0.5, 0.5 * z * z);\n return z > 0 ? 1 - lower : lower;\n}\n\n/** The largest double below 1. The inverse never returns 1 itself. */\nconst BELOW_ONE = 1 - Number.EPSILON / 2;\n\n/** Iteration cap for the inverse. Newton needs about 8 steps; 200 is slack. */\nconst INVERSE_MAX_STEPS = 200;\n\n/**\n * A starting point for the inverse, from Numerical Recipes.\n *\n * Both branches are approximations only. The Newton loop that follows carries\n * the value the rest of the way, so the guess needs to be in the right\n * neighborhood, not accurate.\n */\nfunction inverseGuess(p: number, a: number, b: number): number {\n if (a >= 1 && b >= 1) {\n const tail = p < 0.5 ? p : 1 - p;\n const t = Math.sqrt(-2 * Math.log(tail));\n const normal =\n (p < 0.5 ? -1 : 1) *\n ((2.30753 + t * 0.27061) / (1 + t * (0.99229 + t * 0.04481)) - t);\n const scale = (normal * normal - 3) / 6;\n const harmonic = 2 / (1 / (2 * a - 1) + 1 / (2 * b - 1));\n const w =\n (normal * Math.sqrt(scale + harmonic)) / harmonic -\n (1 / (2 * b - 1) - 1 / (2 * a - 1)) *\n (scale + 5 / 6 - 2 / (3 * harmonic));\n return a / (a + b * Math.exp(2 * w));\n }\n\n const lower = Math.exp(a * Math.log(a / (a + b))) / a;\n const upper = Math.exp(b * Math.log(b / (a + b))) / b;\n const total = lower + upper;\n if (p < lower / total) {\n return Math.pow(a * total * p, 1 / a);\n }\n return 1 - Math.pow(b * total * (1 - p), 1 / b);\n}\n\n/**\n * The inverse of the regularized incomplete beta function, R's `qbeta()`.\n *\n * Newton's method on I_x(a, b) − p, with the exact beta density as the\n * derivative. Every step keeps a bracket, and a step that leaves the bracket\n * falls back to bisection, so the loop cannot run away on a poor guess.\n *\n * @param p A probability between 0 and 1.\n * @param a A positive shape.\n * @param b A positive shape.\n * @returns The x where I_x(a, b) equals p, or NaN for a bad shape.\n */\nexport function inverseIncompleteBeta(\n p: number,\n a: number,\n b: number,\n): number {\n if (Number.isNaN(p) || !(a > 0) || !(b > 0)) {\n return Number.NaN;\n }\n if (p <= 0) {\n return 0;\n }\n if (p >= 1) {\n return 1;\n }\n\n const logBetaValue = logBeta(a, b);\n let lower = 0;\n let upper = 1;\n let x = inverseGuess(p, a, b);\n if (!(x > 0) || !(x < 1)) {\n x = 0.5;\n }\n\n // Index loop with a stated reason: this refines a single root and stops on\n // a convergence test.\n for (let step = 0; step < INVERSE_MAX_STEPS; step += 1) {\n const residual = incompleteBeta(x, a, b) - p;\n if (residual < 0) {\n lower = x;\n } else {\n upper = x;\n }\n\n const density = Math.exp(\n (a - 1) * Math.log(x) + (b - 1) * Math.log1p(-x) - logBetaValue,\n );\n let next =\n density > 0 && Number.isFinite(density) ? x - residual / density : Number.NaN;\n if (!(next > lower) || !(next < upper)) {\n next = 0.5 * (lower + upper);\n }\n if (next === x) {\n break;\n }\n\n const moved = Math.abs(next - x);\n x = next;\n if (moved <= Number.EPSILON * x) {\n break;\n }\n }\n\n return Math.min(x, BELOW_ONE);\n}\n",
|
|
14
|
+
"/**\n * The t distribution: density, cumulative probability, and quantile.\n *\n * These are the port of R's `dt()`, `pt()`, and `qt()`. `plot_t_test()` in\n * `../compstatslib/R/t_statistic_plot.R` draws both hypothesis curves from\n * them. Verified against R in `tdist.test.ts`.\n *\n * All three take an optional non-centrality, as in R. Left out or given as 0,\n * they run the central path, which `plot_t_test()` draws the null hypothesis\n * from; given a non-zero value they run the non-central path behind the\n * alternative-hypothesis curve, where the non-centrality is the t statistic\n * itself.\n *\n * A note on how close this comes to R. The non-central routines follow R's\n * own `pnt.c` and `dnt.c` step for step, down to the iteration cap and the\n * error bound. That is on purpose. Both stop the series on an *absolute*\n * bound, so where they stop is part of the answer, and a tidier stopping rule\n * would move the last digits away from R rather than toward the truth. It\n * also means this port inherits R's limits: at a large non-centrality the\n * series terms are built by repeated subtraction and go to noise once they\n * fall below about 1e-16, which is what R's own \"full precision may not have\n * been achieved\" warning reports. Densities near 1e-50 there agree with R in\n * absolute terms only.\n */\n\nimport {\n incompleteBetaSplit,\n inverseIncompleteBeta,\n logBeta,\n normalCdf,\n} from \"./special\";\n\n/** True when a non-centrality was given and is not the central case. */\nfunction isNonCentral(ncp: number | undefined): ncp is number {\n return ncp !== undefined && ncp !== 0;\n}\n\n/** True when any argument rules the answer out before any work starts. */\nfunction isBadArgument(value: number, df: number, ncp: number | undefined): boolean {\n return (\n Number.isNaN(value) ||\n !(df > 0) ||\n (ncp !== undefined && Number.isNaN(ncp))\n );\n}\n\n/**\n * The density of the t distribution, R's `dt()`.\n *\n * @param x Where to evaluate the density.\n * @param df Degrees of freedom. Any positive number, whole or not.\n * @param ncp The non-centrality. Left out, or 0, gives the central density.\n * @returns The density, or NaN if df is zero or less.\n */\nexport function dt(x: number, df: number, ncp?: number): number {\n if (isBadArgument(x, df, ncp)) {\n return Number.NaN;\n }\n return isNonCentral(ncp)\n ? nonCentralDensity(x, df, ncp)\n : centralDensity(x, df);\n}\n\n/**\n * The share of the distribution below x, R's `pt()`.\n *\n * @param x Where to evaluate the distribution.\n * @param df Degrees of freedom. Any positive number, whole or not.\n * @param ncp The non-centrality. Left out, or 0, gives the central case.\n * @returns A probability between 0 and 1, or NaN if df is zero or less.\n */\nexport function pt(x: number, df: number, ncp?: number): number {\n if (isBadArgument(x, df, ncp)) {\n return Number.NaN;\n }\n return isNonCentral(ncp)\n ? nonCentralProbability(x, df, ncp)\n : centralProbability(x, df);\n}\n\n/**\n * The value with probability p below it, R's `qt()`.\n *\n * @param p A probability between 0 and 1. The ends give infinities, as in R.\n * @param df Degrees of freedom. Any positive number, whole or not.\n * @param ncp The non-centrality. Left out, or 0, gives the central case.\n * @returns The quantile, or NaN for a p outside 0 to 1 or a df of zero or\n * less.\n */\nexport function qt(p: number, df: number, ncp?: number): number {\n if (isBadArgument(p, df, ncp) || p < 0 || p > 1) {\n return Number.NaN;\n }\n return isNonCentral(ncp)\n ? nonCentralQuantile(p, df, ncp)\n : centralQuantile(p, df);\n}\n\n/**\n * The density, computed in logs.\n *\n * f(x) = (1 + x²/df)^−(df+1)/2 / (√df · B(½, df/2))\n *\n * `log1p` keeps the small-x end accurate, and the log form keeps the large-df\n * end from overflowing on the way to a modest answer.\n */\nfunction centralDensity(x: number, df: number): number {\n if (!Number.isFinite(x)) {\n return 0;\n }\n const logDensity =\n -0.5 * Math.log(df) -\n logBeta(0.5, df / 2) -\n ((df + 1) / 2) * Math.log1p((x * x) / df);\n return Math.exp(logDensity);\n}\n\n/**\n * The cumulative probability, from the upper tail outward.\n *\n * Working from whichever tail holds the smaller mass avoids subtracting two\n * nearly equal numbers, which is what makes the far tails accurate.\n */\nfunction centralProbability(x: number, df: number): number {\n if (x === 0) {\n return 0.5;\n }\n if (x === Number.POSITIVE_INFINITY) {\n return 1;\n }\n if (x === Number.NEGATIVE_INFINITY) {\n return 0;\n }\n const tail = upperTail(Math.abs(x), df);\n return x < 0 ? tail : 1 - tail;\n}\n\n/**\n * The mass above t, for a t of zero or more.\n *\n * P(T > t) = ½ · I_z(df/2, ½), z = df / (df + t²)\n *\n * This is the incomplete-beta identity R's `pt()` uses. Both z and 1 − z come\n * straight out of t and df, each to full precision, so the pair goes to\n * `incompleteBetaSplit` rather than letting it subtract one from the other. A\n * small t drives z against 1, where a subtracted complement would keep only a\n * handful of digits; a large t makes the answer tiny, where building it as\n * ½ − something would cancel it away to nothing.\n */\nfunction upperTail(t: number, df: number): number {\n const squared = t * t;\n if (!Number.isFinite(squared)) {\n // t is past 1e154. The mass above it is far below the smallest double.\n return 0;\n }\n const total = df + squared;\n return 0.5 * incompleteBetaSplit(df / total, squared / total, df / 2, 0.5);\n}\n\n/** How many Newton steps the quantile takes after the beta inverse. */\nconst POLISH_MAX_STEPS = 4;\n\n/**\n * The quantile, by inverting the incomplete beta and then polishing.\n *\n * The symmetry of the distribution turns a one-sided probability into a\n * two-sided mass, which the beta inverse handles. Which shape goes first\n * depends on which side is small: taking the large side would compute the\n * answer as one minus something near one and throw away digits.\n */\nfunction centralQuantile(p: number, df: number): number {\n if (p === 0.5) {\n return 0;\n }\n if (p <= 0) {\n return Number.NEGATIVE_INFINITY;\n }\n if (p >= 1) {\n return Number.POSITIVE_INFINITY;\n }\n\n const tail = p < 0.5 ? p : 1 - p;\n const sign = p < 0.5 ? -1 : 1;\n const twoSided = 2 * tail;\n\n let squared: number;\n if (twoSided > 0.5) {\n // Near the middle: the answer is small, so solve for x²/(df + x²).\n const near = inverseIncompleteBeta(1 - twoSided, 0.5, df / 2);\n squared = (df * near) / (1 - near);\n } else {\n // Out in a tail: the answer is large, so solve for df/(df + x²).\n const far = inverseIncompleteBeta(twoSided, df / 2, 0.5);\n squared = (df * (1 - far)) / far;\n }\n\n return sign * polish(Math.sqrt(squared), tail, df);\n}\n\n/**\n * Newton steps on the upper tail, to take the last digits home.\n *\n * The beta inverse lands close but loses a little precision on the way\n * through x² and the square root. Solving P(T > t) = tail directly, with the\n * density as the derivative, recovers it. The step is measured against the\n * tail rather than against p, so a p near 1 does not lose its digits to the\n * subtraction.\n */\nfunction polish(start: number, tail: number, df: number): number {\n let t = start;\n\n // Index loop with a stated reason: this refines a single root and stops on\n // a convergence test.\n for (let step = 0; step < POLISH_MAX_STEPS; step += 1) {\n const density = centralDensity(t, df);\n if (!(density > 0) || !Number.isFinite(t)) {\n break;\n }\n\n const move = (upperTail(t, df) - tail) / density;\n const next = t + move;\n if (!(next > 0) || !Number.isFinite(next) || Math.abs(move) > 0.25 * t) {\n break;\n }\n if (next === t) {\n break;\n }\n\n t = next;\n if (Math.abs(move) <= Number.EPSILON * t) {\n break;\n }\n }\n\n return t;\n}\n\n/**\n * Iteration cap and error bound for the AS 243 series.\n *\n * These are R's own values from `pnt.c`. They are part of the answer, not a\n * detail: the series stops on an *absolute* bound, so where it stops decides\n * the last digits. Holding R's numbers here is what makes this port agree\n * with R rather than merely come close to the true value.\n */\nconst SERIES_MAX_STEPS = 1000;\nconst SERIES_ERROR_MAX = 1e-12;\n\n/** Above this non-centrality R leaves the series for a normal fit. */\nconst SERIES_NCP_LIMIT_SQUARED = 2 * Math.LN2 * 1022;\n\n/** Above this many degrees of freedom R does the same. */\nconst SERIES_DF_LIMIT = 4e5;\n\nconst SQRT_TWO_OVER_PI = Math.sqrt(2 / Math.PI);\n\n/**\n * The share of the non-central distribution below x, R's `pt(x, df, ncp)`.\n *\n * The series only runs on values of zero or more, so a negative x is\n * reflected through the origin along with the non-centrality. That names the\n * other tail, which the caller flips back.\n */\nfunction nonCentralProbability(x: number, df: number, ncp: number): number {\n if (x === Number.POSITIVE_INFINITY) {\n return 1;\n }\n if (x === Number.NEGATIVE_INFINITY) {\n return 0;\n }\n\n const reflected = x < 0;\n const t = reflected ? -x : x;\n const delta = reflected ? -ncp : ncp;\n const lower =\n df > SERIES_DF_LIMIT || delta * delta > SERIES_NCP_LIMIT_SQUARED\n ? normalApproximation(t, df, delta)\n : lenthSeries(t, df, delta);\n\n return reflected ? 1 - lower : lower;\n}\n\n/**\n * Abramowitz and Stegun 26.7.10, the fit R falls back on.\n *\n * Past a non-centrality of about 37.6 the leading Poisson weight\n * exp(−ncp²/2) drops below the smallest double and the series has nothing\n * left to sum. The sliders reach that: a difference of 4 with a standard\n * deviation of 1 over 500 observations puts the non-centrality near 89.\n */\nfunction normalApproximation(t: number, df: number, delta: number): number {\n const shrink = 1 / (4 * df);\n const spread = Math.sqrt(1 + t * t * 2 * shrink);\n return normalCdf((t * (1 - shrink) - delta) / spread);\n}\n\n/**\n * The AS 243 twin series of Lenth (1989), as R's `pnt.c` runs it.\n *\n * The distribution is a Poisson mixture of incomplete beta terms. Both\n * families of terms step by recurrence rather than being evaluated afresh,\n * and `remaining` carries the Poisson mass still to come, which bounds the\n * error of stopping early.\n *\n * @param t Where to evaluate, zero or more.\n * @param df Degrees of freedom.\n * @param delta The non-centrality, of either sign.\n */\nfunction lenthSeries(t: number, df: number, delta: number): number {\n const squared = t * t;\n const total = df + squared;\n const x = squared / total;\n const complement = df / total;\n\n let sum = 0;\n if (x > 0) {\n const lambda = delta * delta;\n let oddWeight = 0.5 * Math.exp(-0.5 * lambda);\n let evenWeight = SQRT_TWO_OVER_PI * oddWeight * delta;\n\n let remaining = 0.5 - oddWeight;\n if (remaining < 1e-7) {\n remaining = -0.5 * Math.expm1(-0.5 * lambda);\n }\n\n let a = 0.5;\n const b = 0.5 * df;\n const powered = Math.pow(complement, b);\n const logBetaValue = logBeta(0.5, b);\n\n let oddTerm = incompleteBetaSplit(x, complement, a, b);\n let oddStep = 2 * powered * Math.exp(a * Math.log(x) - logBetaValue);\n let evenTerm = 1 - powered;\n let evenStep = b * x * powered;\n sum = oddWeight * oddTerm + evenWeight * evenTerm;\n\n // Index loop with a stated reason: each pass advances one Poisson term by\n // recurrence and the loop stops on an error bound, not on a data length.\n for (let step = 1; step <= SERIES_MAX_STEPS; step += 1) {\n a += 1;\n oddTerm -= oddStep;\n evenTerm -= evenStep;\n oddStep *= (x * (a + b - 1)) / a;\n evenStep *= (x * (a + b - 0.5)) / (a + 0.5);\n oddWeight *= lambda / (2 * step);\n evenWeight *= lambda / (2 * step + 1);\n remaining -= oddWeight;\n if (remaining <= 0) {\n break;\n }\n sum += oddWeight * oddTerm + evenWeight * evenTerm;\n if (Math.abs(2 * remaining * (oddTerm - oddStep)) < SERIES_ERROR_MAX) {\n break;\n }\n }\n }\n\n return Math.min(Math.max(sum + normalCdf(-delta), 0), 1);\n}\n\n/**\n * The density of the non-central distribution, R's `dt(x, df, ncp)`.\n *\n * Away from zero the density is read off the distribution function, using\n * that its derivative can be written as a difference between two evaluations\n * two degrees of freedom apart. R notes in `dnt.c` that this still cancels,\n * and it does: at x = 1 the two probabilities agree to about two digits\n * before the difference is taken. Following R's route rather than a cleaner\n * one is deliberate, since the fixtures are R's own output.\n */\nfunction nonCentralDensity(x: number, df: number, ncp: number): number {\n if (!Number.isFinite(x)) {\n return 0;\n }\n\n if (Math.abs(x) > Math.sqrt(df * Number.EPSILON)) {\n const stepped = x * Math.sqrt((df + 2) / df);\n const difference =\n nonCentralProbability(stepped, df + 2, ncp) -\n nonCentralProbability(x, df, ncp);\n return (df / Math.abs(x)) * Math.abs(difference);\n }\n\n // At zero that difference is 0/0. The density there is the central one\n // damped by the non-centrality, exp(−ncp²/2).\n return Math.exp(\n -0.5 * Math.log(df) - logBeta(0.5, df / 2) - 0.5 * ncp * ncp,\n );\n}\n\n/** Iteration cap for the non-central quantile search. */\nconst QUANTILE_MAX_STEPS = 200;\n\n/**\n * The non-central quantile, R's `qt(p, df, ncp)`.\n *\n * There is no closed form to invert, so this brackets the root and then works\n * inward. R bisects to a relative 1e-13; Newton steps get there in a handful\n * of passes instead, with the bracket kept so that a step into the flat part\n * of a far tail cannot run away.\n */\nfunction nonCentralQuantile(p: number, df: number, ncp: number): number {\n if (p <= 0) {\n return Number.NEGATIVE_INFINITY;\n }\n if (p >= 1) {\n return Number.POSITIVE_INFINITY;\n }\n\n // Widen outward from the non-centrality until the root is enclosed.\n let upper = Math.max(1, ncp);\n while (\n Number.isFinite(upper) &&\n nonCentralProbability(upper, df, ncp) < p\n ) {\n upper *= 2;\n }\n let lower = Math.min(-1, -ncp);\n while (\n Number.isFinite(lower) &&\n nonCentralProbability(lower, df, ncp) > p\n ) {\n lower *= 2;\n }\n\n let t = 0.5 * (lower + upper);\n\n // Index loop with a stated reason: this refines a single root and stops on\n // a convergence test.\n for (let step = 0; step < QUANTILE_MAX_STEPS; step += 1) {\n const residual = nonCentralProbability(t, df, ncp) - p;\n if (residual < 0) {\n lower = t;\n } else {\n upper = t;\n }\n\n const density = nonCentralDensity(t, df, ncp);\n let next =\n density > 0 && Number.isFinite(density) ? t - residual / density : Number.NaN;\n if (!(next > lower) || !(next < upper)) {\n next = 0.5 * (lower + upper);\n }\n if (next === t) {\n break;\n }\n\n const moved = Math.abs(next - t);\n t = next;\n if (moved <= Number.EPSILON * Math.abs(t)) {\n break;\n }\n }\n\n return t;\n}\n",
|
|
15
|
+
"/**\n * A matrix, held the way R holds one.\n *\n * R stores a matrix as one vector in column-major order with a `dim`\n * attribute and optional `dimnames`. This module keeps that shape as a plain\n * object: a `Float64Array` of the entries column by column, the two extents,\n * and the names. Plain data, not a class — a matrix serializes, clones and\n * crosses a worker boundary as it is, and every operation on it is a function\n * in R's vocabulary (`t`, `matmul`, `crossprod`, `cbind`, …) in `ops.ts`.\n *\n * Column-major is load-bearing. It is what R, LAPACK and every conformance\n * fixture assume, so `matrix(c(x1, y1, x2, y2), nrow = 2)` translates with\n * no reordering, and a factorization ported from LINPACK reads the same\n * memory in the same order.\n *\n * Indices are zero-based throughout, as the language's are. R's `A[1, 1]` is\n * `at(a, 0, 0)` here.\n *\n * R recycles the data to fill the matrix: a scalar silently, a sub-multiple\n * of the extent silently too (`matrix(1:3, 3, 2)` repeats the column), and\n * any other length with a warning. This module recycles a scalar only —\n * `matrix([0], {nrow: 3, ncol: 3})` is R's `matrix(0, 3, 3)` — and refuses\n * every other mismatch, warned or not. A silently recycled column lets a\n * typo fit the wrong model; a caller who wants the repeat writes\n * `cbind(v, v)`.\n */\n\nimport {\n frameRows,\n numericColumns,\n requireNumericColumn,\n type DataFrame,\n} from \"../frame\";\nimport type { Vector } from \"./vector\";\n\n/** Row names and column names, either of which R may leave `NULL`. */\nexport type Dimnames = readonly [\n readonly string[] | null,\n readonly string[] | null,\n];\n\n/** A matrix in R's layout: column-major data with its two extents. */\nexport interface Matrix {\n readonly nrow: number;\n readonly ncol: number;\n /**\n * The entries, column by column: entry `(i, j)` is `data[j * nrow + i]`.\n * Treat it as read-only. A `Float64Array` has no read-only type, so the\n * rule is stated rather than enforced.\n */\n readonly data: Float64Array;\n /** R's `dimnames`, or null when the matrix has none. */\n readonly dimnames: Dimnames | null;\n}\n\n/** The named arguments of R's `matrix()`. */\nexport interface MatrixOptions {\n /** The number of rows. At least one of `nrow` and `ncol` is required. */\n readonly nrow?: number;\n /** The number of columns. */\n readonly ncol?: number;\n /** Fill row by row instead of column by column. False by default. */\n readonly byrow?: boolean;\n /** Row names and column names. */\n readonly dimnames?: Dimnames;\n}\n\n/**\n * Build a matrix from its entries, as R's `matrix()` does.\n *\n * @param values The entries, in column-major order unless `byrow` is set,\n * or a single value to fill the whole matrix with. The function copies\n * them; a hole in a sparse array reads as NaN.\n * @param options `nrow` or `ncol` (or both, in which case they must agree\n * with the length), `byrow`, and `dimnames`. An extent may be zero, as\n * R's may.\n * @returns The matrix.\n * @throws RangeError If neither extent is given, an extent is not a\n * non-negative integer, the length is not a multiple of the extent given\n * (R warns and recycles; the port refuses), both extents are given and do\n * not multiply to the length (R recycles a sub-multiple silently; the port\n * refuses), or a dimnames entry has the wrong length.\n */\nexport function matrix(\n values: Vector,\n options: MatrixOptions,\n): Matrix {\n const { byrow = false, dimnames } = options;\n const [nrow, ncol] = extents(values.length, options);\n // A typed array has no holes, so every fill path below sees the same\n // dense sequence, with NaN where the caller's array had a gap.\n const dense = Float64Array.from(values);\n\n const data = new Float64Array(nrow * ncol);\n if (dense.length === 1 && data.length > 1) {\n data.fill(dense[0] as number);\n } else if (byrow) {\n dense.forEach((value, index) => {\n const i = Math.floor(index / ncol);\n const j = index % ncol;\n data[j * nrow + i] = value;\n });\n } else {\n data.set(dense);\n }\n\n return make(nrow, ncol, data, dimnames ?? null);\n}\n\n/**\n * Resolve `nrow` and `ncol` from whichever the caller gave. A single value\n * fills any extents; otherwise the length must match them.\n */\nfunction extents(\n length: number,\n { nrow, ncol }: MatrixOptions,\n): [number, number] {\n if (nrow === undefined && ncol === undefined) {\n throw new RangeError(\"matrix() needs nrow or ncol\");\n }\n if (nrow !== undefined) {\n requireExtent(nrow, \"nrow\");\n }\n if (ncol !== undefined) {\n requireExtent(ncol, \"ncol\");\n }\n const scalar = length === 1;\n\n if (nrow !== undefined && ncol !== undefined) {\n if (!scalar && nrow * ncol !== length) {\n throw new RangeError(\n length > nrow * ncol\n ? \"data is too long\"\n : `data length [${length}] is not nrow * ncol [${nrow} * ${ncol}]`,\n );\n }\n return [nrow, ncol];\n }\n // One extent given. R's `matrix(numeric(0), nrow = 0)` is 0 x 0.\n const given = (nrow ?? ncol) as number;\n const name = nrow !== undefined ? \"rows\" : \"columns\";\n if (given === 0) {\n if (length !== 0) {\n throw new RangeError(\"data is too long\");\n }\n return [0, 0];\n }\n const other = scalar ? 1 : length / given;\n if (!scalar && length % given !== 0) {\n throw new RangeError(\n `data length [${length}] is not a multiple of the number of ${name} [${given}]`,\n );\n }\n return nrow !== undefined ? [nrow, other] : [other, given];\n}\n\n/** Reject an extent that is not a non-negative integer a double can count. */\nfunction requireExtent(value: number, name: string): void {\n if (!Number.isSafeInteger(value) || value < 0) {\n throw new RangeError(`${name} must be a non-negative integer, got ${value}`);\n }\n}\n\n/**\n * Assemble a matrix from data already in column-major order, checking the\n * dimnames against the extents and copying the name arrays so that no two\n * matrices share one. The data is taken as is, not copied.\n *\n * @internal Not part of the entry point. The other linalg modules build\n * their results through it.\n */\nexport function make(\n nrow: number,\n ncol: number,\n data: Float64Array,\n dimnames: Dimnames | null,\n): Matrix {\n if (data.length !== nrow * ncol) {\n throw new RangeError(\n `data length [${data.length}] is not nrow * ncol [${nrow} * ${ncol}]`,\n );\n }\n if (dimnames !== null) {\n const [rows, columns] = dimnames;\n if (rows !== null && rows.length !== nrow) {\n throw new RangeError(\n `length of dimnames [1] (${rows.length}) not equal to array extent (${nrow})`,\n );\n }\n if (columns !== null && columns.length !== ncol) {\n throw new RangeError(\n `length of dimnames [2] (${columns.length}) not equal to array extent (${ncol})`,\n );\n }\n dimnames =\n rows === null && columns === null\n ? null\n : [rows === null ? null : [...rows], columns === null ? null : [...columns]];\n }\n return { nrow, ncol, data, dimnames };\n}\n\n/**\n * Build a matrix from its rows.\n *\n * @param rows One array per row, each one value per column. Copied.\n * @returns The matrix.\n * @throws RangeError If there are no rows, a row is empty, or the rows have\n * different lengths.\n */\nexport function fromRows(rows: readonly Vector[]): Matrix {\n const nrow = rows.length;\n const first = rows[0];\n if (first === undefined || first.length === 0) {\n throw new RangeError(\"fromRows() needs at least one row with one value\");\n }\n const ncol = first.length;\n const ragged = rows.findIndex((row) => row.length !== ncol);\n if (ragged !== -1) {\n throw new RangeError(\n `every row needs ${ncol} values; row ${ragged} has ${(rows[ragged] as Vector).length}`,\n );\n }\n\n const data = new Float64Array(nrow * ncol);\n rows.forEach((row, i) => {\n // Through a typed array, so a hole reads as NaN rather than being skipped.\n Float64Array.from(row).forEach((value, j) => {\n data[j * nrow + i] = value;\n });\n });\n return make(nrow, ncol, data, null);\n}\n\n/**\n * Build a matrix from its columns. This is R's `cbind()` over vectors and\n * the natural constructor from a column-keyed data frame.\n *\n * @param columns One array per column, each one value per row. Copied.\n * @returns The matrix.\n * @throws RangeError If there are no columns, a column is empty, or the\n * columns have different lengths.\n */\nexport function fromColumns(\n columns: readonly Vector[],\n): Matrix {\n const ncol = columns.length;\n const first = columns[0];\n if (first === undefined || first.length === 0) {\n throw new RangeError(\n \"fromColumns() needs at least one column with one value\",\n );\n }\n const nrow = first.length;\n const ragged = columns.findIndex((column) => column.length !== nrow);\n if (ragged !== -1) {\n throw new RangeError(\n `every column needs ${nrow} values; column ${ragged} has ${(columns[ragged] as Vector).length}`,\n );\n }\n\n const data = new Float64Array(nrow * ncol);\n columns.forEach((column, j) => {\n data.set(column, j * nrow);\n });\n return make(nrow, ncol, data, null);\n}\n\n/**\n * Read one entry. R's `m[i + 1, j + 1]`.\n *\n * @throws RangeError If the index is outside the matrix.\n */\nexport function at(m: Matrix, i: number, j: number): number {\n if (!Number.isInteger(i) || i < 0 || i >= m.nrow) {\n throw new RangeError(`row index ${i} is outside 0..${m.nrow - 1}`);\n }\n if (!Number.isInteger(j) || j < 0 || j >= m.ncol) {\n throw new RangeError(`column index ${j} is outside 0..${m.ncol - 1}`);\n }\n return m.data[j * m.nrow + i] as number;\n}\n\n/** Read one row as a plain array. R's `m[i + 1, ]`. */\nexport function row(m: Matrix, i: number): number[] {\n if (!Number.isInteger(i) || i < 0 || i >= m.nrow) {\n throw new RangeError(`row index ${i} is outside 0..${m.nrow - 1}`);\n }\n return Array.from({ length: m.ncol }, (_, j) => m.data[j * m.nrow + i] as number);\n}\n\n/** Read one column as a plain array. R's `m[, j + 1]`. */\nexport function column(m: Matrix, j: number): number[] {\n if (!Number.isInteger(j) || j < 0 || j >= m.ncol) {\n throw new RangeError(`column index ${j} is outside 0..${m.ncol - 1}`);\n }\n return Array.from(m.data.subarray(j * m.nrow, (j + 1) * m.nrow));\n}\n\n/** The matrix as an array of rows. */\nexport function toRows(m: Matrix): number[][] {\n return Array.from({ length: m.nrow }, (_, i) => row(m, i));\n}\n\n/** The matrix as an array of columns. */\nexport function toColumns(m: Matrix): number[][] {\n return Array.from({ length: m.ncol }, (_, j) => column(m, j));\n}\n\n/**\n * R's `as.matrix()` of a data frame: the numeric columns side by side, with\n * the column names carried. The natural way into `cov`, `prcomp` and\n * `matmul` from a column-keyed frame.\n *\n * @param data The frame.\n * @param columns The columns to take, in order. By default every numeric\n * column, in frame order — R's `Filter(is.numeric, data)`.\n * @returns The matrix, `frameRows(data)` by `columns.length`, with the\n * column names as its column names.\n * @throws RangeError If a named column is absent or not numeric (through\n * `requireNumericColumn`), or if the frame is ragged.\n */\nexport function fromFrame(data: DataFrame, columns?: readonly string[]): Matrix {\n const nrow = frameRows(data);\n const names = columns ?? numericColumns(data);\n const buffer = new Float64Array(nrow * names.length);\n names.forEach((name, j) => {\n buffer.set(requireNumericColumn(data, name, \"columns\"), j * nrow);\n });\n return make(nrow, names.length, buffer, names.length === 0 ? null : [null, [...names]]);\n}\n",
|
|
16
|
+
"/**\n * R's `model.matrix()`: a data frame and a list of terms → the design\n * matrix, with the column names `lm()` gives its coefficients.\n *\n * R builds this from a formula. The port has no formulas (CLAUDE.md: the\n * canonical form is explicit column names in an options object), so a\n * model is a list of terms — a column name for a main effect, an array of\n * column names for an interaction — and the intercept is a flag. R's\n * `y ~ x * z + w` is `{ outcome: \"y\", terms: [\"x\", \"z\", \"w\", [\"x\", \"z\"]] }`.\n *\n * The columns come out in R's order, whatever order the terms were written\n * in: the intercept, then the terms by degree — every main effect before\n * every two-way interaction before every three-way — and within a degree in\n * the order given. A term written twice enters once. The `assign` vector is\n * R's: the index of the term each column came from, 0 for the intercept.\n *\n * Rows with a missing (non-finite) value in the outcome or in any column a\n * term names are dropped, R's `model.frame()` under `na.omit`; the indices\n * of the rows kept are returned, so a fit can pad its results back to the\n * input order (the `na.exclude` convention every fit in this package uses).\n * Only numeric columns can enter; R's factors and contrasts are out of\n * scope.\n */\n\nimport { frameRows, requireNumericColumn, type DataFrame } from \"../frame\";\nimport { make, type Matrix } from \"./matrix\";\n\n/**\n * One term of a model: a column name for a main effect, or the column names\n * of an interaction, R's `a:b`.\n */\nexport type Term = string | readonly string[];\n\n/** Which columns make the model. */\nexport interface ModelSpec {\n /**\n * The outcome column. It enters no design column, but a row missing it is\n * dropped, as `model.frame()` drops it. Optional here; `lm()` requires it.\n */\n readonly outcome?: string;\n /** The terms, in any order. R's order is restored. */\n readonly terms: readonly Term[];\n /** Whether to lead with a column of ones. True by default, R's `+ 1`. */\n readonly intercept?: boolean;\n}\n\n/** A design matrix and where its rows came from. */\nexport interface ModelMatrix {\n /**\n * The design, one row per complete data row, with the coefficient names\n * as column names: `(Intercept)`, the main effects, the interactions as\n * `a:b`.\n */\n readonly matrix: Matrix;\n /** The data rows the design holds, in input order. */\n readonly rows: readonly number[];\n /** R's `assign`: the term each column came from, 0 for the intercept. */\n readonly assign: readonly number[];\n /** R's `term.labels`: the terms in the order the columns follow. */\n readonly termLabels: readonly string[];\n}\n\n/**\n * Build the design matrix of a model, as R's `model.matrix()` does.\n *\n * @param data The frame holding every column the model names.\n * @param spec The outcome, the terms, and the intercept flag.\n * @returns The design, the rows it kept, and R's `assign` and term labels.\n * @throws RangeError If a named column is absent or not numeric (through\n * `requireNumericColumn`, naming the option it arrived through), if the\n * frame is ragged, or if an interaction term names no column.\n */\nexport function modelMatrix(data: DataFrame, spec: ModelSpec): ModelMatrix {\n const { outcome, intercept = true } = spec;\n const rowCount = frameRows(data);\n const terms = orderTerms(spec.terms);\n\n const columns = new Map<string, readonly number[]>();\n const read = (name: string, role: string): readonly number[] => {\n const held = columns.get(name);\n if (held !== undefined) {\n return held;\n }\n const column = requireNumericColumn(data, name, role);\n columns.set(name, column);\n return column;\n };\n if (outcome !== undefined) {\n read(outcome, \"outcome\");\n }\n terms.forEach((factors) => {\n factors.forEach((name) => read(name, \"terms\"));\n });\n\n // R's na.omit: a row with a missing value in any model column leaves.\n // NaN is this library's missing value, and an infinity would poison the\n // fit the same way, so \"complete\" means finite everywhere.\n const involved = [...columns.values()];\n const rows = Array.from({ length: rowCount }, (_, row) => row).filter((row) =>\n involved.every((column) => Number.isFinite(column[row])),\n );\n\n const termColumns = terms.map((factors) =>\n rows.map((row) =>\n factors.reduce((product, name) => product * ((columns.get(name) as readonly number[])[row] as number), 1),\n ),\n );\n const design = intercept ? [rows.map(() => 1), ...termColumns] : termColumns;\n const names = [\n ...(intercept ? [\"(Intercept)\"] : []),\n ...terms.map((factors) => factors.join(\":\")),\n ];\n const assign = [\n ...(intercept ? [0] : []),\n ...terms.map((_, index) => index + 1),\n ];\n\n const n = rows.length;\n const p = design.length;\n const buffer = new Float64Array(n * p);\n design.forEach((column, j) => {\n buffer.set(column, j * n);\n });\n\n return {\n matrix: make(n, p, buffer, p === 0 ? null : [null, names]),\n rows,\n assign,\n termLabels: names.slice(intercept ? 1 : 0),\n };\n}\n\n/**\n * Normalize the terms to arrays of column names, drop repeats, and put them\n * in R's order: by degree, then as written.\n *\n * @throws RangeError If a term names no column.\n */\nfunction orderTerms(terms: readonly Term[]): readonly (readonly string[])[] {\n const seen = new Set<string>();\n const unique: (readonly string[])[] = [];\n terms.forEach((term) => {\n const factors = typeof term === \"string\" ? [term] : term;\n if (factors.length === 0) {\n throw new RangeError(\"an interaction term needs at least one column name\");\n }\n // R treats `a:b` and `b:a` as one term; the first spelling wins.\n const key = [...factors].sort().join(\"\u0000\");\n if (!seen.has(key)) {\n seen.add(key);\n unique.push(factors);\n }\n });\n // A stable sort by degree keeps the written order within a degree, as R's\n // terms() does.\n return unique\n .map((factors, index) => ({ factors, index }))\n .sort((a, b) => a.factors.length - b.factors.length || a.index - b.index)\n .map(({ factors }) => factors);\n}\n",
|
|
17
|
+
"/**\n * R's named vector: values with a name each, in order.\n *\n * A coefficient vector is the case that matters here — `coef(fit)` in R\n * prints `(Intercept)`, `x`, `z`, `x:z` above its values, and `summary()`\n * lines the standard errors up under the same names. The port holds the\n * names alongside the values rather than in an object keyed by name,\n * because a JavaScript object moves an integer-like key to the front: a\n * column called `\"1\"` would jump ahead of `(Intercept)`. The pair of arrays\n * keeps R's order, and pairs with `dimnames` on a `Matrix`, so the column\n * names of a model matrix become the names of a fit with no reshaping\n * (plan Q11).\n *\n * `null` is R's `NA`: a coefficient the fit could not identify.\n */\n\n/** Values with a name each, in order. */\nexport interface NamedVector {\n readonly names: readonly string[];\n /** One value per name; null where R reports `NA`. */\n readonly values: readonly (number | null)[];\n}\n\n/**\n * Pair names with values.\n *\n * @param names One name per value. Copied.\n * @param values One value per name; null for R's `NA`. Copied.\n * @throws RangeError If the two lengths differ.\n */\nexport function namedVector(\n names: readonly string[],\n values: readonly (number | null)[],\n): NamedVector {\n if (names.length !== values.length) {\n throw new RangeError(\n `a named vector needs one name per value: ${names.length} names, ${values.length} values`,\n );\n }\n return { names: [...names], values: [...values] };\n}\n\n/**\n * Read one value by name. R's `v[[\"name\"]]`.\n *\n * @returns The value, null where the entry is R's `NA`, or undefined when\n * no entry carries the name. With a repeated name, the first.\n */\nexport function lookup(v: NamedVector, name: string): number | null | undefined {\n const index = v.names.indexOf(name);\n return index === -1 ? undefined : (v.values[index] as number | null);\n}\n",
|
|
18
|
+
"/**\n * The elementary matrix operations, named as R names them.\n *\n * `t()`, `%*%` (`matmul`), `crossprod()`, `tcrossprod()`, `cbind()`,\n * `rbind()` and `diag()`. Each takes matrices (and, where R allows it, plain\n * vectors) and returns a new matrix; nothing here modifies its input.\n *\n * A bare vector in a product takes the shape R gives it, which is not\n * always the one that would conform (fixtures 1g and 1h probe the rules).\n * In `%*%`, a left vector is a row when its length matches the rows of the\n * right factor and otherwise a column; a right vector is a column when its\n * length matches the columns of the left factor and otherwise a row; two\n * vectors give their inner product. In `crossprod` a vector `x` is always\n * a column, and a vector `y` is a column when its length matches the rows\n * of `x` and otherwise a row. In `tcrossprod` a vector `x` is a row when\n * its length matches the columns of a matrix `y` and otherwise a column,\n * and a vector `y` is a row only when `x` has one row; two vectors are both\n * columns, the outer product.\n *\n * Dimnames travel as they do in R: a transpose swaps them, a product keeps\n * the row names of the left factor and the column names of the right, and\n * binding stacks them, with `\"\"` for a bare vector joined to a named matrix.\n *\n * The product follows the reference BLAS `dgemm` that R ships: the loop\n * over `i` innermost walks each column of the left factor in order, and each\n * product is rounded once into its running sum with `fusedMultiplyAdd`,\n * because the build the conformance fixtures come from contracts\n * `C + A * B` into one instruction (the fixture README records this; the LU\n * and QR here already follow it). Index loops throughout: a product\n * addresses entries by position. (CLAUDE.md allows an index loop with a\n * stated reason; that is the reason.)\n */\n\nimport { fusedMultiplyAdd } from \"../arith\";\nimport { make, type Dimnames, type Matrix } from \"./matrix\";\nimport type { Vector } from \"./vector\";\n\n/** A matrix, or a vector R would treat as a one-column matrix. */\nexport type MatrixOrVector = Matrix | Vector;\n\n/** R's `t()`. Also exported as `transpose`, for an app whose `t` is already taken. */\nexport function t(m: Matrix): Matrix {\n const { nrow, ncol } = m;\n const data = new Float64Array(nrow * ncol);\n for (let j = 0; j < ncol; j++) {\n for (let i = 0; i < nrow; i++) {\n data[i * ncol + j] = m.data[j * nrow + i] as number;\n }\n }\n const dimnames: Dimnames | null =\n m.dimnames === null ? null : [m.dimnames[1], m.dimnames[0]];\n return make(ncol, nrow, data, dimnames);\n}\n\n/** R's `t()`, under a name that does not collide with an i18n `t`. */\nexport const transpose = t;\n\n/**\n * R's `x %*% y`.\n *\n * @param x The left factor. A vector is a row when its length matches the\n * rows of `y`, else a column when `y` has one row.\n * @param y The right factor. A vector is a column when its length matches\n * the columns of `x`, else a row when `x` has one column. Two vectors of\n * one length give their inner product as a 1 x 1 matrix.\n * @returns The product, with the row names of `x` and the column names of\n * `y`.\n * @throws RangeError If the inner extents differ: R's \"non-conformable\n * arguments\".\n */\nexport function matmul(x: MatrixOrVector, y: MatrixOrVector): Matrix {\n const [left, right] = conformProduct(x, y);\n if (left.ncol !== right.nrow) {\n throw new RangeError(\n `non-conformable arguments: ${left.nrow} x ${left.ncol} %*% ${right.nrow} x ${right.ncol}`,\n );\n }\n const data = product(left, right);\n return make(left.nrow, right.ncol, data, productDimnames(left, right));\n}\n\n/** Shape the factors of `%*%` by R's rules for a bare vector. */\nfunction conformProduct(x: MatrixOrVector, y: MatrixOrVector): [Matrix, Matrix] {\n if (isMatrix(x)) {\n if (isMatrix(y)) {\n return [x, y];\n }\n return [x, y.length === x.ncol ? asColumn(y) : asRow(y)];\n }\n if (isMatrix(y)) {\n return [x.length === y.nrow ? asRow(x) : asColumn(x), y];\n }\n // Two vectors: `x` is a row, and `y` is a row too when `x` is a single\n // value, else a column — the inner product when the lengths agree.\n return [asRow(x), x.length === 1 ? asRow(y) : asColumn(y)];\n}\n\n/**\n * R's `crossprod(x, y)`: `t(x) %*% y`, with `crossprod(x)` for `t(x) %*% x`.\n * A bare vector `x` is a column; a bare vector `y` is a column when its\n * length matches the rows of `x`, else a row (fixture 1h).\n *\n * @throws RangeError If the row counts differ.\n */\nexport function crossprod(x: MatrixOrVector, y: MatrixOrVector = x): Matrix {\n const left = asColumn(x);\n const right = isMatrix(y) ? y : y.length === left.nrow ? asColumn(y) : asRow(y);\n if (left.nrow !== right.nrow) {\n throw new RangeError(\n `non-conformable arguments: crossprod of ${left.nrow} x ${left.ncol} and ${right.nrow} x ${right.ncol}`,\n );\n }\n return matmul(t(left), right);\n}\n\n/**\n * R's `tcrossprod(x, y)`: `x %*% t(y)`, with `tcrossprod(x)` for\n * `x %*% t(x)`. A bare vector `x` is a row when its length matches the\n * columns of a matrix `y`, else a column; a bare vector `y` is a row only\n * when `x` has one row, and two bare vectors are both columns (fixture 1h).\n *\n * @throws RangeError If the column counts differ.\n */\nexport function tcrossprod(x: MatrixOrVector, y: MatrixOrVector = x): Matrix {\n const bothVectors = !isMatrix(x) && !isMatrix(y);\n const left = isMatrix(x) ? x : isMatrix(y) && y.ncol === x.length ? asRow(x) : asColumn(x);\n const right = isMatrix(y)\n ? y\n : !bothVectors && left.nrow === 1\n ? asRow(y)\n : asColumn(y);\n if (left.ncol !== right.ncol) {\n throw new RangeError(\n `non-conformable arguments: tcrossprod of ${left.nrow} x ${left.ncol} and ${right.nrow} x ${right.ncol}`,\n );\n }\n return matmul(left, t(right));\n}\n\n/** The raw product of two conformable matrices, column-major. */\nfunction product(x: Matrix, y: Matrix): Float64Array {\n const { nrow, ncol: inner } = x;\n const { ncol } = y;\n const data = new Float64Array(nrow * ncol);\n for (let j = 0; j < ncol; j++) {\n for (let k = 0; k < inner; k++) {\n const factor = y.data[j * y.nrow + k] as number;\n for (let i = 0; i < nrow; i++) {\n data[j * nrow + i] = fusedMultiplyAdd(\n x.data[k * nrow + i] as number,\n factor,\n data[j * nrow + i] as number,\n );\n }\n }\n }\n return data;\n}\n\n/** Row names of the left factor, column names of the right. */\nfunction productDimnames(x: Matrix, y: Matrix): Dimnames | null {\n const rows = x.dimnames?.[0] ?? null;\n const columns = y.dimnames?.[1] ?? null;\n return rows === null && columns === null ? null : [rows, columns];\n}\n\n/** A vector as R's one-column matrix; a matrix as it is. */\nfunction asColumn(value: MatrixOrVector): Matrix {\n if (isMatrix(value)) {\n return value;\n }\n return make(value.length, 1, Float64Array.from(value), null);\n}\n\n/** A vector as a one-row matrix. */\nfunction asRow(value: Vector): Matrix {\n return make(1, value.length, Float64Array.from(value), null);\n}\n\n/**\n * Tell a matrix from a vector by shape, and refuse anything else — a typed\n * array or a stray object — with a TypeError rather than a wrong shape.\n *\n * @internal Shared with the other linalg modules; not part of the entry.\n */\nexport function isMatrix(value: MatrixOrVector): value is Matrix {\n if (Array.isArray(value)) {\n return false;\n }\n if (\n typeof value === \"object\" &&\n value !== null &&\n \"nrow\" in value &&\n \"ncol\" in value &&\n \"data\" in value\n ) {\n return true;\n }\n throw new TypeError(\"expected a Matrix or an array of numbers\");\n}\n\n/**\n * R's `cbind()`: join matrices and vectors side by side.\n *\n * @param parts Matrices, and vectors taken as columns. At least one.\n * @returns The joined matrix. Row names come from the first part that has\n * them. Column names are kept when any part has them, with `\"\"` for a part\n * that does not, as R names a bare vector.\n * @throws RangeError If the row counts differ, in R's words for a matrix\n * part and for a vector part. R recycles a short vector with a warning;\n * the port refuses.\n */\nexport function cbind(...parts: readonly MatrixOrVector[]): Matrix {\n const matrices = parts.map(asColumn);\n const first = matrices[0];\n if (first === undefined) {\n throw new RangeError(\"cbind() needs at least one argument\");\n }\n const nrow = first.nrow;\n matrices.forEach((m, index) => {\n if (m.nrow !== nrow) {\n throw new RangeError(\n isMatrix(parts[index] as MatrixOrVector)\n ? `number of rows of matrices must match (see arg ${index + 1})`\n : `number of rows of result is not a multiple of vector length (arg ${index + 1})`,\n );\n }\n });\n\n const ncol = matrices.reduce((total, m) => total + m.ncol, 0);\n const data = new Float64Array(nrow * ncol);\n let offset = 0;\n matrices.forEach((m) => {\n data.set(m.data, offset);\n offset += m.data.length;\n });\n\n const rows = matrices.find((m) => m.dimnames?.[0])?.dimnames?.[0] ?? null;\n const columns = boundNames(\n matrices.map((m) => ({ names: m.dimnames?.[1] ?? null, count: m.ncol })),\n );\n return make(nrow, ncol, data, rows === null && columns === null ? null : [rows, columns]);\n}\n\n/**\n * R's `rbind()`: stack matrices and vectors.\n *\n * @param parts Matrices, and vectors taken as rows. At least one.\n * @returns The stacked matrix, with names as `cbind` carries them, rows and\n * columns exchanged.\n * @throws RangeError If the column counts differ.\n */\nexport function rbind(...parts: readonly MatrixOrVector[]): Matrix {\n if (parts.length === 0) {\n throw new RangeError(\"rbind() needs at least one argument\");\n }\n const transposed = parts.map((part) => (isMatrix(part) ? t(part) : part));\n try {\n return t(cbind(...transposed));\n } catch (error) {\n if (error instanceof RangeError) {\n throw new RangeError(\n error.message.replace(\"number of rows\", \"number of columns\"),\n );\n }\n throw error;\n }\n}\n\n/** Concatenate the names of bound parts, `\"\"` where a part has none. */\nfunction boundNames(\n parts: readonly { names: readonly string[] | null; count: number }[],\n): readonly string[] | null {\n if (parts.every((part) => part.names === null)) {\n return null;\n }\n return parts.flatMap(\n (part) => part.names ?? new Array<string>(part.count).fill(\"\"),\n );\n}\n\n/**\n * R's `diag()` in its three forms: a vector gives the diagonal matrix of it,\n * a count gives the identity of that order, and a matrix gives its diagonal.\n *\n * The form is chosen by type, not by length, which is R's own gotcha\n * removed: `diag([5])` is the 1 x 1 matrix `[5]` where R's `diag(c(5))` is\n * the 5 x 5 identity, and `diag(2.5)` refuses where R truncates to 2 x 2.\n * The diagonal of a matrix comes back as a plain array; R names it when the\n * row and column names agree, which the port will do once a named vector\n * exists (plan Q11).\n */\nexport function diag(values: Vector): Matrix;\nexport function diag(order: number): Matrix;\nexport function diag(m: Matrix): number[];\nexport function diag(arg: Vector | number | Matrix): Matrix | number[] {\n if (typeof arg === \"number\") {\n return identity(arg);\n }\n if (Array.isArray(arg)) {\n const values = arg as Vector;\n const n = values.length;\n const data = new Float64Array(n * n);\n values.forEach((value, i) => {\n data[i * n + i] = value;\n });\n return make(n, n, data, null);\n }\n const m = arg as Matrix;\n const n = Math.min(m.nrow, m.ncol);\n return Array.from({ length: n }, (_, i) => m.data[i * m.nrow + i] as number);\n}\n\n/**\n * The identity matrix of the given order. R's `diag(n)`.\n *\n * @throws RangeError If the order is not a non-negative integer.\n */\nexport function identity(order: number): Matrix {\n if (!Number.isInteger(order) || order < 0) {\n throw new RangeError(`order must be a non-negative integer, got ${order}`);\n }\n const data = new Float64Array(order * order);\n for (let i = 0; i < order; i++) {\n data[i * order + i] = 1;\n }\n return make(order, order, data, null);\n}\n",
|
|
19
|
+
"/**\n * The QR factorization, R's `qr()` with `LAPACK = FALSE`.\n *\n * R factors a design with LINPACK's `dqrdc2`, a Householder QR with a\n * limited column-pivoting rule: a column whose norm has collapsed against\n * the columns to its left is moved to the right edge and its coefficient is\n * reported as `NA`. That rule is what makes `lm()` and `glm()` report an\n * aliased coefficient instead of dividing by a near-zero pivot. This module\n * reproduces it and exposes R's result — the compact `qr` matrix, `qraux`,\n * `pivot` and `rank` — and R's readers of it: `qr.coef`, `qr.fitted`,\n * `qr.resid`, `qr.qy`, `qr.qty`, `qr.Q` and `qr.R`. Verified against R in\n * `qr.test.ts`; `leastSquares` in `../ols.ts` is a wrapper over it.\n *\n * Designs here are small — two columns for logit, four for a moderation\n * surface — so the code follows the LINPACK routines plainly rather than\n * blocking or vectorizing them. Index loops throughout: a factorization\n * addresses single entries by position, and this one follows `dqrdc2` and\n * `dqrsl` step for step so that the fixtures pin bit for bit.\n */\n\nimport { fusedMultiplyAdd } from \"../arith\";\nimport { make, type Dimnames, type Matrix } from \"./matrix\";\nimport { isMatrix, type MatrixOrVector } from \"./ops\";\nimport type { Vector } from \"./vector\";\n\n/** R's `qr()` result. */\nexport interface QrDecomposition {\n /**\n * The compact factorization, R's `qr$qr`: `R` on and above the diagonal,\n * the Householder vectors below it, columns in pivot order. Column names\n * follow the pivot, as R's do.\n */\n readonly qr: Matrix;\n /**\n * R's `qr$qraux`: for each reflected column, the leading entry of its\n * Householder reflector; for a column never reflected — the trailing\n * column of a square or wide design, or an aliased column — its remaining\n * norm, which is what R reports there (fixtures 2b, 2c, 2g).\n */\n readonly qraux: Vector;\n /**\n * The column order after pivoting, R's `qr$pivot` **zero-based**:\n * `pivot[k]` is the original index of the column now at position `k`.\n * The aliased columns are at the end.\n */\n readonly pivot: readonly number[];\n /** The number of columns the factorization could identify. */\n readonly rank: number;\n}\n\nexport interface QrOptions {\n /**\n * How far a column's norm may collapse before it is aliased: the column is\n * moved to the end when its remaining norm falls below this fraction of\n * its original norm. The default is R's `qr()` and `lm.fit()` default.\n * `glm.fit()` passes `min(1e-7, epsilon / 1000)`. Zero aliases nothing,\n * as R's `tol = 0` does; a negative or NaN value is refused, where R\n * would pass it through — a deliberate narrowing.\n */\n readonly tolerance?: number;\n}\n\n/** The rank tolerance of R's `qr()` and `lm.fit()`. */\nexport const DEFAULT_QR_TOLERANCE = 1e-7;\n\n/**\n * Factor a matrix, as R's `qr(x, LAPACK = FALSE)` does.\n *\n * @param x The matrix. The function does not modify it. Row names travel\n * onto the compact form; column names follow the pivot.\n * @param options The rank tolerance.\n * @returns The compact factorization, `qraux`, the pivot, and the rank.\n * @throws RangeError If the tolerance is negative or NaN, or if an entry is\n * not finite — R's \"NA/NaN/Inf in foreign function call (arg 1)\". NaN is\n * this library's missing value; a caller drops incomplete rows first, as\n * `modelMatrix` does.\n * @throws TypeError If `x` is not a matrix.\n */\nexport function qr(x: Matrix, options: QrOptions = {}): QrDecomposition {\n const { tolerance = DEFAULT_QR_TOLERANCE } = options;\n if (!(tolerance >= 0)) {\n throw new RangeError(`tolerance must be a non-negative number, got ${tolerance}`);\n }\n if (!isMatrix(x)) {\n throw new TypeError(\"expected a Matrix\");\n }\n if (!x.data.every(Number.isFinite)) {\n throw new RangeError(\"NA/NaN/Inf in foreign function call (arg 1)\");\n }\n const { nrow, ncol } = x;\n\n // Work on a copy of each column. `dqrdc2` overwrites the matrix in place;\n // the copies keep the caller's matrix untouched.\n const columns = Array.from({ length: ncol }, (_, j) =>\n Array.from(x.data.subarray(j * nrow, (j + 1) * nrow)),\n );\n const { householders, pivot, rank } = decompose(columns, tolerance, nrow);\n\n const data = new Float64Array(nrow * ncol);\n columns.forEach((column, j) => {\n data.set(column, j * nrow);\n });\n const rows = x.dimnames?.[0] ?? null;\n const names = x.dimnames?.[1] ?? null;\n const dimnames: Dimnames | null =\n rows === null && names === null\n ? null\n : [rows, names === null ? null : pivot.map((from) => names[from] as string)];\n\n return { qr: make(nrow, ncol, data, dimnames), qraux: householders, pivot, rank };\n}\n\n/**\n * Solve for the coefficients, R's `qr.coef(qr, y)`.\n *\n * @param q The factorization.\n * @param y The response, one value per row — or a matrix with one response\n * per column, as R also takes.\n * @returns One coefficient per column of the factored matrix, **in the\n * original column order**, with null for an aliased column (R's `NA`).\n * For a matrix `y`, a matrix with one column per response, the factored\n * matrix's column names as row names and `y`'s column names as column\n * names; an aliased column reads NaN there, since a matrix holds no null.\n * @throws RangeError If `y` has the wrong number of rows.\n */\nexport function qrCoef(q: QrDecomposition, y: Vector): (number | null)[];\nexport function qrCoef(q: QrDecomposition, y: Matrix): Matrix;\nexport function qrCoef(q: QrDecomposition, y: MatrixOrVector): (number | null)[] | Matrix {\n if (isMatrix(y)) {\n requireRows(q, y.nrow);\n const width = q.qr.ncol;\n const data = new Float64Array(width * y.ncol);\n for (let j = 0; j < y.ncol; j++) {\n const solved = coefficientsOf(q, Array.from(y.data.subarray(j * y.nrow, (j + 1) * y.nrow)));\n solved.forEach((value, i) => {\n data[j * width + i] = value ?? Number.NaN;\n });\n }\n return make(width, y.ncol, data, readerDimnames(originalColumnNames(q), y));\n }\n requireRows(q, y.length);\n return coefficientsOf(q, y);\n}\n\n/** The coefficients of one response, in the original column order. */\nfunction coefficientsOf(q: QrDecomposition, y: Vector): (number | null)[] {\n const qty = transformed(q, y, true);\n const solved = backSubstitute(q.qr, qty, q.rank);\n const coefficients = new Array<number | null>(q.qr.ncol).fill(null);\n q.pivot.slice(0, q.rank).forEach((column, position) => {\n coefficients[column] = solved[position] as number;\n });\n return coefficients;\n}\n\n/** The factored matrix's column names in their original order, if any. */\nfunction originalColumnNames(q: QrDecomposition): readonly string[] | null {\n const pivoted = q.qr.dimnames?.[1] ?? null;\n if (pivoted === null) {\n return null;\n }\n const names = new Array<string>(pivoted.length);\n q.pivot.forEach((original, position) => {\n names[original] = pivoted[position] as string;\n });\n return names;\n}\n\n/**\n * The fitted values, R's `qr.fitted(qr, y)`: `Q` applied to the first `rank`\n * entries of `Qᵀy`, the rest set to zero. A matrix `y` gives a matrix with\n * its column names.\n *\n * @throws RangeError If `y` has the wrong number of rows.\n */\nexport function qrFitted(q: QrDecomposition, y: Vector): number[];\nexport function qrFitted(q: QrDecomposition, y: Matrix): Matrix;\nexport function qrFitted(q: QrDecomposition, y: MatrixOrVector): number[] | Matrix {\n return perColumn(q, y, (column) =>\n transformed(q, transformed(q, column, true).map((value, index) => (index < q.rank ? value : 0)), false),\n );\n}\n\n/**\n * The residuals, R's `qr.resid(qr, y)`: `Q` applied to `Qᵀy` with its first\n * `rank` entries set to zero. A matrix `y` gives a matrix with its column\n * names.\n *\n * @throws RangeError If `y` has the wrong number of rows.\n */\nexport function qrResid(q: QrDecomposition, y: Vector): number[];\nexport function qrResid(q: QrDecomposition, y: Matrix): Matrix;\nexport function qrResid(q: QrDecomposition, y: MatrixOrVector): number[] | Matrix {\n return perColumn(q, y, (column) =>\n transformed(q, transformed(q, column, true).map((value, index) => (index < q.rank ? 0 : value)), false),\n );\n}\n\n/**\n * `Qᵀy`, R's `qr.qty(qr, y)`: the reflectors applied first to last. A\n * matrix `y` gives a matrix with its column names.\n *\n * @throws RangeError If `y` has the wrong number of rows.\n */\nexport function qrQty(q: QrDecomposition, y: Vector): number[];\nexport function qrQty(q: QrDecomposition, y: Matrix): Matrix;\nexport function qrQty(q: QrDecomposition, y: MatrixOrVector): number[] | Matrix {\n return perColumn(q, y, (column) => transformed(q, column, true));\n}\n\n/**\n * `Qy`, R's `qr.qy(qr, y)`: the reflectors applied last to first. A matrix\n * `y` gives a matrix with its column names.\n *\n * @throws RangeError If `y` has the wrong number of rows.\n */\nexport function qrQy(q: QrDecomposition, y: Vector): number[];\nexport function qrQy(q: QrDecomposition, y: Matrix): Matrix;\nexport function qrQy(q: QrDecomposition, y: MatrixOrVector): number[] | Matrix {\n return perColumn(q, y, (column) => transformed(q, column, false));\n}\n\n/** Apply a vector reader to a vector, or to each column of a matrix. */\nfunction perColumn(\n q: QrDecomposition,\n y: MatrixOrVector,\n read: (column: Vector) => number[],\n): number[] | Matrix {\n if (isMatrix(y)) {\n requireRows(q, y.nrow);\n const data = new Float64Array(y.nrow * y.ncol);\n for (let j = 0; j < y.ncol; j++) {\n data.set(read(Array.from(y.data.subarray(j * y.nrow, (j + 1) * y.nrow))), j * y.nrow);\n }\n return make(y.nrow, y.ncol, data, readerDimnames(null, y));\n }\n requireRows(q, y.length);\n return read(y);\n}\n\n/** Row names given, column names of `y`; null when there are neither. */\nfunction readerDimnames(rows: readonly string[] | null, y: Matrix): Dimnames | null {\n const columns = y.dimnames?.[1] ?? null;\n return rows === null && columns === null ? null : [rows, columns];\n}\n\n/** Apply the reflectors to a copy of `y`, first to last for `Qᵀy`, last to first for `Qy`. */\nfunction transformed(q: QrDecomposition, y: Vector, transpose: boolean): number[] {\n const result = [...y];\n const count = reflectorCount(q);\n if (transpose) {\n for (let step = 0; step < count; step++) {\n applyReflector(q, step, result);\n }\n } else {\n for (let step = count - 1; step >= 0; step--) {\n applyReflector(q, step, result);\n }\n }\n return result;\n}\n\n/**\n * The orthogonal factor, R's `qr.Q(qr)`: `n` rows by `min(n, p)` columns —\n * `Q` applied to the leading columns of the identity. It carries no names,\n * as R's does not.\n */\nexport function qrQ(q: QrDecomposition): Matrix {\n const { nrow, ncol } = q.qr;\n const width = Math.min(nrow, ncol);\n const data = new Float64Array(nrow * width);\n for (let j = 0; j < width; j++) {\n const unit = new Array<number>(nrow).fill(0);\n unit[j] = 1;\n data.set(transformed(q, unit, false), j * nrow);\n }\n return make(nrow, width, data, null);\n}\n\n/**\n * The triangular factor, R's `qr.R(qr)`: `min(n, p)` rows by `p` columns,\n * the upper triangle of the compact form, with the leading row names and\n * the column names in pivot order.\n */\nexport function qrR(q: QrDecomposition): Matrix {\n const { nrow, ncol } = q.qr;\n const height = Math.min(nrow, ncol);\n const data = new Float64Array(height * ncol);\n for (let j = 0; j < ncol; j++) {\n for (let i = 0; i <= Math.min(j, height - 1); i++) {\n data[j * height + i] = q.qr.data[j * nrow + i] as number;\n }\n }\n const rows = q.qr.dimnames?.[0]?.slice(0, height) ?? null;\n const columns = q.qr.dimnames?.[1] ?? null;\n return make(height, ncol, data, rows === null && columns === null ? null : [rows, columns]);\n}\n\n/** Refuse a response that does not match the rows. R's own wording. */\nfunction requireRows(q: QrDecomposition, rows: number): void {\n if (rows !== q.qr.nrow) {\n throw new RangeError(\"'qr' and 'y' must have the same number of rows\");\n }\n}\n\n/**\n * How many reflectors `dqrsl` applies: `min(k, n - 1)`, because the last\n * row of a square or wide matrix is never reflected.\n */\nfunction reflectorCount(q: QrDecomposition): number {\n return Math.min(q.rank, q.qr.nrow - 1);\n}\n\n/**\n * Apply one stored reflector to a vector in place: one step of LINPACK's\n * `dqrsl`.\n *\n * The reflector's leading entry lives in `qraux`, outside the column, so the\n * inner product and the update read it separately from the entries under\n * the diagonal. Both are BLAS calls in LINPACK — `ddot` and `daxpy` — and on\n * the build the fixtures come from each product is contracted into a fused\n * multiply-add, so `fusedMultiplyAdd` is used where the BLAS would round\n * once.\n */\nfunction applyReflector(\n q: QrDecomposition,\n step: number,\n vector: number[],\n): void {\n const leading = q.qraux[step] as number;\n if (leading === 0) {\n return;\n }\n const { nrow } = q.qr;\n const column = q.qr.data.subarray(step * nrow, (step + 1) * nrow);\n\n let inner = leading * (vector[step] as number);\n for (let row = step + 1; row < nrow; row++) {\n inner = fusedMultiplyAdd(column[row] as number, vector[row] as number, inner);\n }\n const factor = -inner / leading;\n vector[step] = fusedMultiplyAdd(factor, leading, vector[step] as number);\n for (let row = step + 1; row < nrow; row++) {\n vector[row] = fusedMultiplyAdd(factor, column[row] as number, vector[row] as number);\n }\n}\n\n/**\n * Factor the columns in place: LINPACK's `dqrdc2`, R's modification of\n * `dqrdc` with limited column pivoting.\n *\n * The routine walks the columns left to right, keeping in `qraux` a running\n * norm of each column's remaining part — downdated after every reflection\n * rather than recomputed, and recomputed only when the downdate would lose\n * too much (the `1e-6` rule). A column whose running norm has fallen below\n * `tolerance` times its original norm moves to the right edge and the\n * columns behind it shift left, so the columns that survive keep their\n * original order — which is why R can report the coefficients of a rank-\n * deficient fit in their own slots, with `NA` in the slot of the column it\n * dropped.\n *\n * On return each column holds its part of R above the diagonal and the\n * Householder vector below it, `qraux` holds the leading entry of each\n * reflector — or, for a column that was never reflected, its running norm,\n * which is what R reports there.\n *\n * @returns `qraux`, the column order, and the rank.\n */\nfunction decompose(\n columns: number[][],\n tolerance: number,\n rows: number,\n): { householders: number[]; pivot: number[]; rank: number } {\n const width = columns.length;\n const pivot = columns.map((_, column) => column);\n const qraux = columns.map((column) => norm(column, 0));\n // `work(j, 1)`: the norm the running value was last set from.\n const lastNorms = [...qraux];\n // `work(j, 2)`: the original norm, with 1 substituted for zero so that an\n // all-zero column compares as negligible rather than dividing by zero.\n const originalNorms = qraux.map((value) => value || 1);\n // R's `k`, one past the count of columns still in play.\n let k = width + 1;\n\n for (let step = 0; step < Math.min(rows, width); step++) {\n // Cycle the columns from `step` rightward until one with a non-negligible\n // norm is found. `step + 1` is R's one-based `l`.\n while (\n step + 1 < k &&\n (qraux[step] as number) < (originalNorms[step] as number) * tolerance\n ) {\n moveToEnd(columns, step);\n moveToEnd(pivot, step);\n moveToEnd(qraux, step);\n moveToEnd(lastNorms, step);\n moveToEnd(originalNorms, step);\n k -= 1;\n }\n\n // The last row leaves nothing to reflect. R skips it and keeps the entry\n // as it stands, which is how a design with more columns than rows still\n // resolves the coefficients it can.\n if (step === rows - 1) {\n continue;\n }\n reflect(columns, qraux, lastNorms, step, rows);\n }\n\n return { householders: qraux, pivot, rank: Math.min(k - 1, rows) };\n}\n\n/**\n * Build the Householder reflector of one column, apply it to the columns to\n * its right, and downdate their running norms. On return `qraux[step]` holds\n * the reflector's leading entry.\n */\nfunction reflect(\n columns: number[][],\n qraux: number[],\n lastNorms: number[],\n step: number,\n rows: number,\n): void {\n const column = columns[step] as number[];\n const length = norm(column, step);\n if (length === 0) {\n return;\n }\n // Reflect away from the leading entry, so that nothing cancels.\n const pivotNorm = (column[step] as number) < 0 ? -length : length;\n\n // `dscal(n, 1/nrmxl, x)`: LINPACK multiplies by the reciprocal rather than\n // dividing, and the two round differently. Dividing lands one ulp away from\n // R in the Householder vector of the very first fixture.\n const reciprocal = 1 / pivotNorm;\n for (let row = step; row < rows; row++) {\n column[row] = (column[row] as number) * reciprocal;\n }\n const leading = 1 + (column[step] as number);\n column[step] = leading;\n\n for (let index = step + 1; index < columns.length; index++) {\n const other = columns[index] as number[];\n // `ddot` and `daxpy`, each product rounded once with its addition.\n let inner = 0;\n for (let row = step; row < rows; row++) {\n inner = fusedMultiplyAdd(column[row] as number, other[row] as number, inner);\n }\n const factor = -inner / leading;\n for (let row = step; row < rows; row++) {\n other[row] = fusedMultiplyAdd(factor, column[row] as number, other[row] as number);\n }\n\n // Downdate the running norm of the column just updated, or recompute it\n // when the downdate would cancel too much.\n const running = qraux[index] as number;\n if (running !== 0) {\n const ratio = Math.abs(other[step] as number) / running;\n const remaining = Math.max(1 - ratio * ratio, 0);\n if (Math.abs(remaining) < 1e-6) {\n qraux[index] = norm(other, step + 1);\n lastNorms[index] = qraux[index] as number;\n } else {\n qraux[index] = running * Math.sqrt(remaining);\n }\n }\n }\n\n qraux[step] = leading;\n column[step] = -pivotNorm;\n}\n\n/**\n * Solve the leading `rank` columns of the triangular system, as `dqrsl`\n * does: column by column from the last, each solved coefficient subtracted\n * from the entries above it with `daxpy`.\n */\nfunction backSubstitute(\n compact: Matrix,\n response: Vector,\n rank: number,\n): number[] {\n const { nrow } = compact;\n const entry = (i: number, j: number): number =>\n compact.data[j * nrow + i] as number;\n const solved = response.slice(0, rank);\n\n for (let column = rank - 1; column >= 0; column--) {\n const value = (solved[column] as number) / entry(column, column);\n solved[column] = value;\n for (let row = 0; row < column; row++) {\n solved[row] = fusedMultiplyAdd(-value, entry(row, column), solved[row] as number);\n }\n }\n\n return solved;\n}\n\n/** Move one entry of an array to its end, sliding the rest left. */\nfunction moveToEnd<T>(track: T[], from: number): void {\n const [moved] = track.splice(from, 1) as [T];\n track.push(moved);\n}\n\n/**\n * The Euclidean length of a column from `from` down: the BLAS `dnrm2`.\n *\n * For values in the ordinary range `dnrm2` is a sum of squares under a\n * square root; its scaling engages only near overflow or underflow, which\n * no fixture and no teaching dataset reaches. Written as a fold —\n * `Math.hypot(...column)` overflows the call stack past about a million\n * entries, and its rounding is not specified — with each square rounded\n * once into the sum, as the contracted BLAS does.\n */\nfunction norm(column: Vector, from: number): number {\n let squares = 0;\n for (let row = from; row < column.length; row++) {\n const value = column[row] as number;\n squares = fusedMultiplyAdd(value, value, squares);\n }\n return Math.sqrt(squares);\n}\n",
|
|
20
|
+
"/**\n * R's `lm()` over a data frame, with what `summary.lm()` reads off the fit.\n *\n * `lm()` is `model.matrix()` followed by `lm.fit()`, and `lm.fit()` is\n * `dqrls`: the `qr()` of `qr.ts` — LINPACK's `dqrdc2` with its limited\n * column pivoting — followed by `dqrsl`'s coefficients and residuals, with\n * the fitted values as `y` minus the residuals. The port runs that same\n * arithmetic, so the coefficients, fitted values and residuals pin bit for\n * bit against R. The summary statistics — R², adjusted R², σ, the standard\n * errors and the t and p values — follow `summary.lm()`'s formulas but not\n * its rounding step for step (`chol2inv` and `pt`), and are verified at a\n * stated tolerance. See `lm.test.ts`.\n *\n * Coefficients come back as a `NamedVector` in R's order, `null` where R\n * reports `NA` for an aliased column. Fitted values and residuals are padded\n * with NaN to the input length where a row was dropped for a missing value,\n * R's `na.exclude`, which is the convention every fit in this package uses.\n */\n\nimport { mean, sum, zipWith } from \"../arith\";\nimport type { DataFrame } from \"../frame\";\nimport { pt } from \"../tdist\";\nimport { modelMatrix, type ModelSpec } from \"./modelMatrix\";\nimport { namedVector, type NamedVector } from \"./namedVector\";\nimport { DEFAULT_QR_TOLERANCE, qr, qrCoef, qrResid, type QrDecomposition } from \"./qr\";\nimport type { Vector } from \"./vector\";\n\n/** The model, with the outcome required, and the rank tolerance. */\nexport interface LmOptions extends ModelSpec {\n /** The column to fit. */\n readonly outcome: string;\n /** How far a column's norm may collapse before it is aliased. R's `lm.fit()` default. */\n readonly tolerance?: number;\n}\n\n/** R's `summary(fit)$fstatistic`. */\nexport interface FStatistic {\n readonly value: number;\n readonly numdf: number;\n readonly dendf: number;\n}\n\n/** A fitted linear model and its summary. */\nexport interface LmFit {\n /** `coef(fit)`: one entry per design column, null where R reports `NA`. */\n readonly coefficients: NamedVector;\n /** `coef(summary(fit))[, \"Std. Error\"]`, null for an aliased term. */\n readonly standardErrors: NamedVector;\n /** `coef(summary(fit))[, \"t value\"]`, null for an aliased term. */\n readonly tValues: NamedVector;\n /** `coef(summary(fit))[, \"Pr(>|t|)\"]`, null for an aliased term. */\n readonly pValues: NamedVector;\n /** The fitted outcome of each data row, in input order; NaN for a row dropped. */\n readonly fitted: Vector;\n /** The outcome minus the fit, in input order; NaN for a row dropped. */\n readonly residuals: Vector;\n /** The number of columns the fit could identify. */\n readonly rank: number;\n /** `fit$df.residual`: rows fitted minus rank. */\n readonly dfResidual: number;\n /** `summary(fit)$r.squared`. */\n readonly rSquared: number;\n /** `summary(fit)$adj.r.squared`. */\n readonly adjRSquared: number;\n /** `summary(fit)$sigma`: the residual standard error. */\n readonly sigma: number;\n /** `summary(fit)$fstatistic`, or null when the model has no term beyond the intercept. */\n readonly fStatistic: FStatistic | null;\n /** The data rows the fit used, in input order. */\n readonly rows: readonly number[];\n /** R's `term.labels`. */\n readonly termLabels: readonly string[];\n}\n\n/**\n * Fit a linear model, as R's `lm()` does.\n *\n * @param data The frame holding every column the model names.\n * @param options The outcome, the terms, the intercept flag, and the rank\n * tolerance.\n * @returns The fit and its summary.\n * @throws RangeError If a named column is absent or not numeric, if the\n * frame is ragged, or if no row is complete — R's \"0 (non-NA) cases\".\n */\nexport function lm(data: DataFrame, options: LmOptions): LmFit {\n const { outcome, intercept = true, tolerance = DEFAULT_QR_TOLERANCE } = options;\n const design = modelMatrix(data, options);\n const { rows } = design;\n const n = rows.length;\n if (n === 0) {\n throw new RangeError(\"0 (non-NA) cases\");\n }\n // modelMatrix has already checked the outcome column.\n const outcomeColumn = data[outcome] as Vector;\n const y = rows.map((row) => outcomeColumn[row] as number);\n\n const factored = qr(design.matrix, { tolerance });\n const coefficients = qrCoef(factored, y);\n const residuals = qrResid(factored, y);\n const fitted = zipWith(y, residuals, (value, residual) => value - residual);\n const names = design.matrix.dimnames?.[1] ?? [];\n\n const { rank } = factored;\n const dfResidual = n - rank;\n const interceptCount = intercept ? 1 : 0;\n const rss = sum(residuals.map((r) => r * r));\n const centered = intercept ? mean(fitted) : 0;\n const mss = sum(fitted.map((f) => (f - centered) * (f - centered)));\n const resvar = rss / dfResidual;\n const numdf = rank - interceptCount;\n // summary.lm() reports 0 for both when nothing beyond the intercept was\n // fitted, rather than the rounding noise the formula would give.\n const rSquared = numdf > 0 ? mss / (mss + rss) : 0;\n const adjRSquared =\n numdf > 0 ? 1 - (1 - rSquared) * ((n - interceptCount) / dfResidual) : 0;\n\n const standardErrors = standardErrorsOf(factored, resvar, names.length);\n const tValues = zipWith(coefficients, standardErrors, (b, se) =>\n b === null || se === null ? null : b / se,\n );\n const pValues = tValues.map((tv) =>\n tv === null ? null : 2 * pt(-Math.abs(tv), dfResidual),\n );\n\n return {\n coefficients: namedVector(names, coefficients),\n standardErrors: namedVector(names, standardErrors),\n tValues: namedVector(names, tValues),\n pValues: namedVector(names, pValues),\n fitted: padded(fitted, rows, outcomeColumn.length),\n residuals: padded(residuals, rows, outcomeColumn.length),\n rank,\n dfResidual,\n rSquared,\n adjRSquared,\n sigma: Math.sqrt(resvar),\n fStatistic:\n numdf > 0 ? { value: mss / numdf / resvar, numdf, dendf: dfResidual } : null,\n rows,\n termLabels: design.termLabels,\n };\n}\n\n/**\n * The standard errors, `summary.lm()`'s `sqrt(diag(chol2inv(R)) * resvar)`\n * over the leading `rank` columns of the factorization, placed back in the\n * original column order; null for an aliased column.\n *\n * `chol2inv(R)` is `(RᵀR)⁻¹ = R⁻¹ R⁻ᵀ`, whose diagonal is the sum of\n * squares of each row of `R⁻¹`. `R⁻¹` comes from back substitution against\n * the identity.\n */\nfunction standardErrorsOf(\n factored: QrDecomposition,\n resvar: number,\n width: number,\n): (number | null)[] {\n const { rank, pivot } = factored;\n const { nrow } = factored.qr;\n const r = (i: number, j: number): number => factored.qr.data[j * nrow + i] as number;\n\n // Column k of R⁻¹ solves R x = e_k; the entries above row k are the only\n // ones that can be non-zero.\n const inverse = Array.from({ length: rank }, (_, k) => {\n const x = new Array<number>(rank).fill(0);\n x[k] = 1 / r(k, k);\n for (let i = k - 1; i >= 0; i--) {\n let total = 0;\n for (let j = i + 1; j <= k; j++) {\n total += r(i, j) * (x[j] as number);\n }\n x[i] = -total / r(i, i);\n }\n return x;\n });\n const diagonal = Array.from({ length: rank }, (_, i) =>\n sum(inverse.map((columnOfInverse) => (columnOfInverse[i] as number) ** 2)),\n );\n\n const errors = new Array<number | null>(width).fill(null);\n pivot.slice(0, rank).forEach((original, position) => {\n errors[original] = Math.sqrt((diagonal[position] as number) * resvar);\n });\n return errors;\n}\n\n/** Spread values fitted on `rows` back over `length` slots, NaN elsewhere. */\nfunction padded(values: Vector, rows: readonly number[], length: number): number[] {\n const out = new Array<number>(length).fill(Number.NaN);\n rows.forEach((row, index) => {\n out[row] = values[index] as number;\n });\n return out;\n}\n",
|
|
21
|
+
"/**\n * The fitted surface of a moderated regression.\n *\n * This is the statistics half of `plot_moderation_3d()` in the R package,\n * which fits `lm(formula, data)`, predicts over a 15 by 15 grid of the IV and\n * the moderator, and hands the grid to `lattice::wireframe()`. Verified\n * against R in `moderation.test.ts`.\n *\n * Four things are worth knowing before reading the code.\n *\n * **Columns, not a formula.** R names the model with `y ~ x * z`. TypeScript\n * has no such notation, so the model arrives as column names, per CLAUDE.md:\n * an outcome, an IV, a moderator, an optional list of controls, and a flag\n * for the interaction. The three models the fixtures pin are\n * `{outcome: \"y\", iv: \"x\", mod: \"z\"}` (R's `y ~ x * z`), the same with\n * `interaction: false` (`y ~ x + z`), and the same with `controls: [\"w\"]`\n * (`y ~ x + z + w + x:z`).\n *\n * **The design follows R's model matrix, not the option order.** R's\n * `model.matrix` puts every main effect before any interaction, whatever\n * order the formula was typed in, so `y ~ x + z + w + x:z` gives the columns\n * `(Intercept), x, z, w, x:z`. This module names the terms and hands them to\n * `linalg/lm`, which is `model.matrix()` followed by `lm.fit()` and puts the\n * columns in that order, so a caller can read the coefficients next to R's.\n * Going through `lm` also makes the fitted values `y` minus the residuals of\n * the factorization, which is R's own definition, rather than `X · β`.\n *\n * **Controls are held at their mean, and only numbers are accepted.** R's\n * `hold_value()` also handles factors (first level), characters (first in\n * sort order) and logicals (always FALSE). The bundled data has no such\n * column and no doc example uses one, so this port supports the numeric\n * branch alone and refuses the rest, rather than shipping three rules nothing\n * exercises. The other rules are recorded in\n * `.claude/plans/001-PLAN-port/moderation-fixtures.md` section 4 if they are ever wanted.\n *\n * **Missing values leave the fit, as R's do.** `lm()` drops incomplete rows\n * through `na.omit` and `hold_value()` averages with `na.rm = TRUE`; this\n * port does the same, with NaN standing in for `NA` and any non-finite value\n * counting as missing. The details — the `na.exclude`-style NaN padding of\n * `fitted` and `residuals`, the one departure on `zlim` — are on\n * `moderationSurface` itself.\n */\n\nimport { extent, mean, sum, zipWith } from \"./arith\";\nimport { frameRows, requireNumericColumn, type DataFrame } from \"./frame\";\nimport { lm } from \"./linalg/lm\";\n\n/**\n * The number of steps along each axis of the grid. R's\n * `plot_moderation_3d()` hardcodes `length.out = 15` for both.\n */\nconst GRID_STEPS = 15;\n\n/** Which columns make the model. */\nexport interface ModerationOptions {\n /** The column to predict — the vertical axis of the surface. */\n readonly outcome: string;\n /** The predictor on the first horizontal axis. */\n readonly iv: string;\n /** The predictor on the second horizontal axis. */\n readonly mod: string;\n /**\n * Whether the model carries the IV by moderator product. True by default,\n * which is R's `y ~ x * z`. False gives R's additive `y ~ x + z`, whose\n * surface is a plane with no twist.\n */\n readonly interaction?: boolean;\n /**\n * Further predictors to fit but not to plot. Each is held at its own mean\n * over the grid, R's `hold_value()` for a numeric column. Empty by default.\n */\n readonly controls?: readonly string[];\n}\n\n/** One fitted term, named as R names it. */\nexport interface ModerationTerm {\n /**\n * R's coefficient name: `(Intercept)`, a column name, or `iv:mod` for the\n * product term.\n */\n readonly name: string;\n /**\n * The coefficient, or null where R reports `NA` — a column the fit could\n * not tell apart from the columns before it.\n */\n readonly value: number | null;\n}\n\n/** A fitted model and the surface it predicts. */\nexport interface ModerationSurface {\n /** The fitted terms, in R's model-matrix order. */\n readonly coefficients: readonly ModerationTerm[];\n /**\n * The fitted outcome of each data row, in input order. NaN where the row\n * was dropped for a missing value, as R's `na.exclude` pads.\n */\n readonly fitted: readonly number[];\n /**\n * The outcome minus the fit, of each data row, in input order. NaN where\n * the row was dropped for a missing value.\n */\n readonly residuals: readonly number[];\n /** The 15 IV values of the grid, from the column's minimum to its maximum. */\n readonly ivValues: readonly number[];\n /** The 15 moderator values of the grid, over the same span. */\n readonly modValues: readonly number[];\n /**\n * The 225 predicted outcomes, **with the IV varying fastest**: index\n * `j * 15 + i` holds the prediction at `ivValues[i]` and `modValues[j]`.\n * This is the row order of R's `expand.grid(seq_iv, seq_mod)`.\n */\n readonly predictions: readonly number[];\n /**\n * The vertical range to draw, as `[low, high]`: the range of the observed\n * outcome together with the range of the surface. Which of the two reaches\n * further depends on the model — an interaction usually swings the surface\n * past the data at the corners of the grid, while a plane stays inside it.\n */\n readonly zlim: readonly [number, number];\n /** The value each control is held at over the grid: its mean. */\n readonly holds: Readonly<Record<string, number>>;\n}\n\n/**\n * Fit the model and predict its surface.\n *\n * Rows with a missing (non-finite) value in any model column are dropped\n * before fitting, R's `na.action = na.omit`; their fitted values and\n * residuals report NaN, keeping input order. The grid and zlim span the\n * finite values of their columns, and a control is held at its finite mean —\n * R's `hold_value()` with `na.rm = TRUE`. (R itself computes zlim with no\n * `na.rm` and fails on a missing outcome; the port draws what it can fit, a\n * stated departure.)\n *\n * @param data The frame holding every column the options name.\n * @param options Which column plays which part in the model.\n * @returns The fit, the grid, the surface, and the vertical range.\n * @throws RangeError If a named column is absent, empty, or not numeric, if\n * the IV and the moderator are the same column, if a control repeats\n * another named column, if the frame is ragged, or if no row is complete.\n */\nexport function moderationSurface(\n data: DataFrame,\n options: ModerationOptions,\n): ModerationSurface {\n const { outcome, iv, mod, interaction = true, controls = [] } = options;\n\n if (iv === mod) {\n throw new RangeError(\n `\\`iv\\` and \\`mod\\` must name different columns, both name \"${iv}\"`,\n );\n }\n // A repeated column would enter the design twice and alias itself, and the\n // caller would read a null coefficient with no clue why.\n const named = new Set([outcome, iv, mod]);\n controls.forEach((control) => {\n if (named.has(control)) {\n throw new RangeError(\n `control \"${control}\" already names the outcome, the iv, the mod, ` +\n \"or another control\",\n );\n }\n named.add(control);\n });\n\n // `lm` validates the frame again through `modelMatrix`, but reading the\n // columns here first is what lets the refusals below name the option the\n // column arrived through.\n frameRows(data);\n const y = requireNumericColumn(data, outcome, \"outcome\");\n const ivColumn = requireNumericColumn(data, iv, \"iv\");\n const modColumn = requireNumericColumn(data, mod, \"mod\");\n const controlColumns = controls.map((control) =>\n requireNumericColumn(data, control, \"controls\"),\n );\n\n // R's na.omit: a row with a missing value in any model column leaves the\n // fit. NaN is this library's missing value, and an infinity would poison\n // the fit the same way, so \"complete\" means finite everywhere. `lm` drops\n // the same rows and refuses an empty fit in R's words, \"0 (non-NA) cases\";\n // the check is repeated here only to name the columns that can be at\n // fault, which a caller who chose them one by one needs.\n const modelColumns = [y, ivColumn, modColumn, ...controlColumns];\n const anyComplete = y.some((_, row) =>\n modelColumns.every((column) => Number.isFinite(column[row])),\n );\n if (!anyComplete) {\n throw new RangeError(\n \"the model has no complete rows: every row is missing a value in \" +\n \"the outcome, the IV, the moderator, or a control\",\n );\n }\n\n // R's `y ~ x * z + w` as a term list: the main effects as the model names\n // them, then the product. `lm` restores R's column order, drops the\n // incomplete rows and pads the fit back with NaN (`na.exclude`).\n const fit = lm(data, {\n outcome,\n terms: [iv, mod, ...controls, ...(interaction ? [[iv, mod]] : [])],\n });\n const { fitted, residuals } = fit;\n const coefficients = fit.coefficients.names.map((name, index) => ({\n name,\n value: fit.coefficients.values[index] ?? null,\n }));\n\n // extent() ignores non-finite values, so each axis spans its column's\n // finite range — R's seq over min and max, which R only reaches when the\n // column has no NA. The hold is R's hold_value(): mean with na.rm = TRUE.\n const ivValues = rSeq(...extent(ivColumn), GRID_STEPS);\n const modValues = rSeq(...extent(modColumn), GRID_STEPS);\n const holds = Object.fromEntries(\n controls.map((control, index) => [\n control,\n mean(\n (controlColumns[index] as readonly number[]).filter(Number.isFinite),\n ),\n ]),\n );\n\n // R's predict() drops an aliased term rather than giving up on the row, so\n // a null coefficient contributes nothing here either.\n const weights = coefficients.map((term) => term.value ?? 0);\n const predictions = modValues.flatMap((modValue) =>\n ivValues.map((ivValue) => {\n const gridRow = [\n 1,\n ivValue,\n modValue,\n ...controls.map((control) => holds[control] as number),\n ...(interaction ? [ivValue * modValue] : []),\n ];\n return sum(zipWith(gridRow, weights, (value, weight) => value * weight));\n }),\n );\n\n const [dataLow, dataHigh] = extent(y);\n const [surfaceLow, surfaceHigh] = extent(predictions);\n\n return {\n coefficients,\n fitted,\n residuals,\n ivValues,\n modValues,\n predictions,\n zlim: [Math.min(dataLow, surfaceLow), Math.max(dataHigh, surfaceHigh)],\n holds,\n };\n}\n\n/**\n * Step from one end of a span to the other, the way R's\n * `seq(from, to, length.out = n)` does.\n *\n * R computes `from + i * by` in plain double arithmetic and writes both\n * endpoints in exactly. That last part matters — it is why the grid always\n * reaches the data's own minimum and maximum — and so does the plain\n * arithmetic: rounding the product and the sum together, as `pretty.ts` must\n * for R's other sequence path, moves 14 of the 30 grid coordinates of the\n * bundled dataset off R's values.\n *\n * @param from The first value.\n * @param to The last value.\n * @param length How many values to return.\n * @returns The sequence. A span of no width repeats its one value, as R's\n * `seq(3, 3, length.out = 15)` does.\n */\nfunction rSeq(from: number, to: number, length: number): number[] {\n if (from === to) {\n return new Array<number>(length).fill(from);\n }\n\n const by = (to - from) / (length - 1);\n return Array.from({ length }, (_, index) =>\n index === 0 ? from : index === length - 1 ? to : from + index * by,\n );\n}\n",
|
|
15
22
|
"/**\n * Ordinary least-squares regression of y on x.\n *\n * This is the statistics half of `plot_regression()` in the R package. R gets these\n * numbers from `lm()`, `cor()`, and `summary()$r.squared`. Verified against R\n * in `regression.test.ts`.\n */\n\nimport { mean, sum, zipWith } from \"./arith\";\n\n/** One observation. R holds these as rows of a data frame. */\nexport interface Point {\n readonly x: number;\n readonly y: number;\n}\n\n/**\n * The indices of the rows a fit may use: both coordinates finite.\n *\n * This is R's `na.omit` for a set of points. NaN is this library's missing\n * value, and an infinity would poison a fit the same way, so \"complete\" means\n * finite everywhere — the rule `moderationSurface` set for frames. The point\n * cores (this module, `logit.ts`, `pca.ts`) share the rule through this\n * helper.\n */\nexport function completePointRows(points: readonly Point[]): readonly number[] {\n return points.flatMap((point, row) =>\n Number.isFinite(point.x) && Number.isFinite(point.y) ? [row] : [],\n );\n}\n\n/**\n * The result of a fit.\n *\n * A `null` field is the equivalent of R's `NA`. R drops a singular predictor\n * and reports `NA` for its coefficient. This port reports `null`, which makes\n * strict TypeScript force the caller to handle the degenerate fit.\n */\nexport interface RegressionFit {\n /** The y value where the line crosses x = 0. */\n readonly intercept: number;\n /** The change in y for each unit of x. Null if x has no variation. */\n readonly slope: number | null;\n /** Pearson r. Null if x or y has no variation. */\n readonly correlation: number | null;\n /** Sum of squares regression. */\n readonly ssr: number;\n /** Sum of squares error. */\n readonly sse: number;\n /** Sum of squares total. */\n readonly sst: number;\n /** The part of SST that the fit explains. Null if SST is 0. */\n readonly rSquared: number | null;\n /**\n * The fitted y value of each point, in input order. NaN where the point\n * was dropped for a missing value.\n */\n readonly fitted: readonly number[];\n}\n\n/**\n * Fit a line to the points.\n *\n * With no variation in x, the function fits the mean of y and reports no\n * slope. R does the same: it drops the singular predictor and fits an\n * intercept-only model. A single point is that same case.\n *\n * A point with a non-finite coordinate is dropped before fitting, R's\n * `na.action = na.omit`; its fitted value reports NaN, keeping input order\n * (R's `na.exclude` padding, as `moderationSurface` does). R's `lm()` errors\n * when every row is missing (\"0 (non-NA) cases\"); this port already answers\n * null for \"nothing to fit\", and an all-missing input is that same answer.\n *\n * @param points The observations. The function does not modify them.\n * @returns The fit, or null if no point is complete.\n */\nexport function linearRegression(\n points: readonly Point[],\n): RegressionFit | null {\n const rows = completePointRows(points);\n if (rows.length === 0) {\n return null;\n }\n\n const xs = rows.map((row) => (points[row] as Point).x);\n const ys = rows.map((row) => (points[row] as Point).y);\n const meanX = mean(xs);\n const meanY = mean(ys);\n\n const devX = xs.map((x) => x - meanX);\n const devY = ys.map((y) => y - meanY);\n const sumSquaresX = sum(devX.map((d) => d * d));\n const sumSquaresY = sum(devY.map((d) => d * d));\n const sumProducts = sum(zipWith(devX, devY, (dx, dy) => dx * dy));\n\n const slope = sumSquaresX === 0 ? null : sumProducts / sumSquaresX;\n const intercept = slope === null ? meanY : meanY - slope * meanX;\n const correlation =\n sumSquaresX === 0 || sumSquaresY === 0\n ? null\n : sumProducts / Math.sqrt(sumSquaresX * sumSquaresY);\n\n const fittedComplete = xs.map((x) =>\n slope === null ? intercept : intercept + slope * x,\n );\n\n const ssr = sum(fittedComplete.map((f) => (f - meanY) * (f - meanY)));\n const sse = sum(zipWith(ys, fittedComplete, (y, f) => (y - f) * (y - f)));\n const sst = sumSquaresY;\n const rSquared = sst === 0 ? null : ssr / sst;\n\n // R's na.exclude padding: report the fit in input order, NaN where a\n // point was dropped.\n const fitted = new Array<number>(points.length).fill(Number.NaN);\n rows.forEach((row, survivor) => {\n fitted[row] = fittedComplete[survivor] as number;\n });\n\n return {\n intercept,\n slope,\n correlation,\n ssr,\n sse,\n sst,\n rSquared,\n fitted,\n };\n}\n",
|
|
16
23
|
"/**\n * The determinant and the inverse of a 2x2 matrix.\n *\n * This is the arithmetic half of `plot_matrix_inverse()` in the R package,\n * which builds `A <- matrix(c(x1, y1, x2, y2), nrow = 2)` and calls\n * `solve(A)` before it draws anything. Verified against R in\n * `matrix.test.ts`.\n *\n * Four things are worth knowing before reading the code.\n *\n * **The matrix is two columns.** R fills a matrix column by column, so\n * `(x1, y1)` is column 1 and `(x2, y2)` is column 2. The R plot draws each\n * column as an arrow from the origin, and the parallelogram they span has the\n * determinant as its area. The field names are R's argument names, so nothing\n * has to be transposed on the way in or out.\n *\n * **R's answers come from a factorization, not from the closed form.** Both\n * `det()` and `solve()` factor the matrix first (LAPACK `dgetrf`, partial\n * pivoting), and `det()` then exponentiates a sum of logarithms. The closed\n * forms `x1*y2 - x2*y1` and `[[y2, -x2], [-y1, x1]]/det` give different last\n * bits: for the default matrix of the interactive gadget the closed form gives\n * exactly -3 where R gives -2.9999999999999996. This module follows the\n * factorization, so its numbers are R's.\n *\n * **Two operations there are not the obvious ones.** The factorization scales\n * the column below the pivot by `1 / pivot` instead of dividing by the pivot,\n * and it rounds the rank-one update once (see `fusedMultiplyAdd`). Both\n * change what a near-singular matrix reports: dividing turns R's\n * \"computationally singular\" into \"exactly singular\" for four equal entries at\n * `1e-5`, and rounding twice moves a cancelled determinant by a factor of two.\n *\n * **A singular matrix is data, not an error.** R stops with an error, which\n * ends the R function before it draws. A component that redraws while a slider\n * moves cannot throw, so this module reports the singularity in its result and\n * lets the caller decide. The two kinds R distinguishes are kept apart,\n * because they describe different things: an exactly zero pivot, and a matrix\n * that is invertible on paper but too ill-conditioned to invert in doubles.\n */\n\nimport { fusedMultiplyAdd, sum, withoutNegativeZero } from \"./arith\";\n\n/**\n * The smallest normal double, LAPACK's `dlamch(\"S\")`.\n *\n * Below it, `dgetf2` divides the column by the pivot instead of multiplying by\n * the reciprocal, because the reciprocal would overflow.\n */\nconst SMALLEST_NORMAL = 2.2250738585072014e-308;\n\n/**\n * A 2x2 matrix, held as R's `plot_matrix_inverse` arguments.\n *\n * `(x1, y1)` is the first column and `(x2, y2)` is the second, which is how\n * `matrix(c(x1, y1, x2, y2), nrow = 2)` fills it. Written as a table of rows,\n * the matrix is `[[x1, x2], [y1, y2]]`.\n */\nexport interface Matrix2 {\n /** Row 1 of column 1. R's `A[1,1]`. */\n readonly x1: number;\n /** Row 2 of column 1. R's `A[2,1]`. */\n readonly y1: number;\n /** Row 1 of column 2. R's `A[1,2]`. */\n readonly x2: number;\n /** Row 2 of column 2. R's `A[2,2]`. */\n readonly y2: number;\n}\n\n/**\n * Why a matrix has no inverse, in the two kinds R reports.\n *\n * `\"exact\"` is R's \"Lapack routine dgesv: system is exactly singular:\n * U[i,i] = 0\": the factorization found a pivot that is the literal value zero.\n * `\"computational\"` is R's \"system is computationally singular: reciprocal\n * condition number = ...\": the factorization completed, but the condition\n * number is below R's tolerance of one machine epsilon.\n */\nexport type Singularity = \"exact\" | \"computational\";\n\n/** What `invertMatrix` reports about one matrix. */\nexport interface MatrixInversion {\n /**\n * The determinant, as R's `det()` computes it. It is exactly zero for an\n * exactly singular matrix, and it is not a test for singularity: a matrix\n * with a determinant of `2e-16` can still be too ill-conditioned to invert,\n * and one with a determinant of `0.01` inverts without trouble.\n */\n readonly determinant: number;\n /**\n * The inverse, or null if R's `solve()` would have stopped with an error.\n * The port could report the huge and meaningless numbers that a\n * computationally singular matrix produces, and does not: a null says the\n * same thing as R's error, in a form a caller can branch on.\n */\n readonly inverse: Matrix2 | null;\n /** Which kind of singularity, or null if the matrix inverts. */\n readonly singularity: Singularity | null;\n /**\n * The reciprocal condition number in the one-norm:\n * `1 / (norm(A) * norm(inverse))`. R's bar for a usable matrix is\n * `rcond >= Number.EPSILON`, and this port keeps that bar.\n *\n * R's `solve()` reads an estimate of the same number from LAPACK's\n * `dgecon` rather than computing it. Near the bar the two agree to the last\n * bit — every fixture at the edge of singularity does — while for a well\n * conditioned matrix R's estimate can be up to about twice this value,\n * because the estimator only bounds the norm of the inverse from below. The\n * two never disagreed about a matrix over a sweep of 20000 slider settings.\n *\n * It is 0 for an exactly singular matrix. R computes no condition number\n * there — the factorization has already failed — and zero is the limit.\n */\n readonly rcond: number;\n /**\n * Which pivot was exactly zero: the `i` of R's message `U[i,i] = 0`. It is\n * 1 only when the whole first column is zero, and null unless the\n * singularity is exact.\n */\n readonly zeroPivot: 1 | 2 | null;\n}\n\n/**\n * Return the determinant, as R's `det()` reports it.\n *\n * R factors the matrix and then computes `sign * exp(sum(log(abs(pivot))))`,\n * so an integer determinant does not always come back as an integer. A\n * singular matrix gives a positive zero, whatever its rows: R leaves the sign\n * of the interchange unread on that path.\n *\n * @param matrix The matrix. The function does not modify it.\n * @returns The determinant. It is NaN if an entry is NaN, and it overflows to\n * an infinity for entries large enough, both as R's does.\n */\nexport function determinant(matrix: Matrix2): number {\n return determinantOf(factorize(matrix));\n}\n\n/**\n * Invert the matrix, and report what R's `solve()` would have done with it.\n *\n * The function does not throw. An entry of NaN spreads into every number of\n * the report, which is what R's `solve()` does with it too. An infinite entry\n * gives an infinite norm and so a condition number of zero, and the report\n * says the matrix is computationally singular. R returns an inverse of zeros\n * there instead, but only because its condition test cannot judge a matrix of\n * infinite norm: R's own `rcond()` stops with an error on the same matrix.\n *\n * @param matrix The matrix. The function does not modify it.\n * @returns The inverse and the determinant, or the kind of singularity that\n * stops the matrix from having an inverse.\n */\nexport function invertMatrix(matrix: Matrix2): MatrixInversion {\n const factorization = factorize(matrix);\n const determinant = determinantOf(factorization);\n const zeroPivot = zeroPivotOf(factorization);\n\n if (zeroPivot !== null) {\n return {\n determinant,\n inverse: null,\n singularity: \"exact\",\n rcond: 0,\n zeroPivot,\n };\n }\n\n const inverse = solveForIdentity(factorization);\n // R's `dgecon` estimates the norm of the inverse from the factorization.\n // This module has the inverse itself, so it takes the norm directly. See\n // the note on `rcond` for what that changes and what it does not.\n const rcond = 1 / (oneNorm(matrix) * oneNorm(inverse));\n\n // R's `solve()` takes its tolerance from `.Machine$double.eps`. A NaN fails\n // this test, as it fails R's, and so passes through as an inverse of NaNs.\n if (rcond < Number.EPSILON) {\n return {\n determinant,\n inverse: null,\n singularity: \"computational\",\n rcond,\n zeroPivot: null,\n };\n }\n\n return {\n determinant,\n inverse,\n singularity: null,\n rcond,\n zeroPivot: null,\n };\n}\n\n/**\n * The matrix, factored into a lower and an upper triangle with the larger\n * first-column entry as the leading pivot. LAPACK's `dgetf2`.\n */\ninterface Factorization {\n /** Whether the rows were interchanged to bring up the larger pivot. */\n readonly interchanged: boolean;\n /** The one entry of the lower triangle, below its unit diagonal. */\n readonly multiplier: number;\n /** The diagonal of the upper triangle, in order. */\n readonly pivots: readonly [number, number];\n /** The one entry of the upper triangle above its diagonal. */\n readonly upperRight: number;\n}\n\n/** Factor the matrix, as LAPACK's `dgetf2` does. */\nfunction factorize(matrix: Matrix2): Factorization {\n // Partial pivoting: the larger of the two first-column entries leads.\n const interchanged = Math.abs(matrix.y1) > Math.abs(matrix.x1);\n const leading = interchanged ? matrix.y1 : matrix.x1;\n const upperRight = interchanged ? matrix.y2 : matrix.x2;\n const below = interchanged ? matrix.x1 : matrix.y1;\n const belowRight = interchanged ? matrix.x2 : matrix.y2;\n\n // `dgetf2` scales by the reciprocal of the pivot, and divides only where\n // the reciprocal would overflow. The difference reaches the result: see the\n // note on the module.\n const multiplier =\n Math.abs(leading) >= SMALLEST_NORMAL ? below * (1 / leading) : below / leading;\n const trailing = fusedMultiplyAdd(-multiplier, upperRight, belowRight);\n\n return {\n interchanged,\n multiplier,\n pivots: [leading, trailing],\n upperRight,\n };\n}\n\n/** Return the determinant of a factored matrix, as R's `det()` does. */\nfunction determinantOf(factorization: Factorization): number {\n const { interchanged, pivots } = factorization;\n\n // R's `det_ge_real` reads neither the interchanges nor the diagonal when\n // the factorization reports a zero pivot: it sets the modulus to negative\n // infinity and keeps the sign at 1, so the determinant is a positive zero.\n if (zeroPivotOf(factorization) !== null) {\n return 0;\n }\n\n const modulus = sum(pivots.map((pivot) => Math.log(Math.abs(pivot))));\n const sign = pivots.reduce(\n (carried, pivot) => (pivot < 0 ? -carried : carried),\n interchanged ? -1 : 1,\n );\n\n return sign * Math.exp(modulus);\n}\n\n/** Return which pivot is exactly zero, in the order the factorization finds. */\nfunction zeroPivotOf(factorization: Factorization): 1 | 2 | null {\n const [leading, trailing] = factorization.pivots;\n if (leading === 0) {\n return 1;\n }\n return trailing === 0 ? 2 : null;\n}\n\n/**\n * Solve the factored matrix against the identity, as `dgetrs` does.\n *\n * The right-hand side is the identity with its rows interchanged the same way\n * the factorization interchanged them, and each of its columns then goes\n * forward through the lower triangle and back through the upper one.\n */\nfunction solveForIdentity(factorization: Factorization): Matrix2 {\n const { interchanged } = factorization;\n const [firstTop, firstBottom] = interchanged ? [0, 1] : [1, 0];\n const [secondTop, secondBottom] = interchanged ? [1, 0] : [0, 1];\n\n const [x1, y1] = solveColumn(factorization, firstTop, firstBottom);\n const [x2, y2] = solveColumn(factorization, secondTop, secondBottom);\n\n // The substitution can leave a zero entry with a sign; R's never carry one.\n return {\n x1: withoutNegativeZero(x1),\n y1: withoutNegativeZero(y1),\n x2: withoutNegativeZero(x2),\n y2: withoutNegativeZero(y2),\n };\n}\n\n/** Solve one column of the right-hand side. */\nfunction solveColumn(\n factorization: Factorization,\n top: number,\n bottom: number,\n): [number, number] {\n const { multiplier, pivots, upperRight } = factorization;\n\n const lower = fusedMultiplyAdd(-multiplier, top, bottom) / pivots[1];\n const upper = fusedMultiplyAdd(-upperRight, lower, top) / pivots[0];\n\n return [upper, lower];\n}\n\n/** Return the one-norm: the larger of the two absolute column sums. */\nfunction oneNorm(matrix: Matrix2): number {\n return Math.max(\n Math.abs(matrix.x1) + Math.abs(matrix.y1),\n Math.abs(matrix.x2) + Math.abs(matrix.y2),\n );\n}\n",
|
|
17
24
|
"/**\n * Principal components of a set of two-dimensional points.\n *\n * This is the statistics half of `plot_pca()` in the R package, which calls\n * `prcomp(mc_points, scale. = FALSE)`. Verified against R in `pca.test.ts`.\n *\n * Three things are worth knowing before reading the code.\n *\n * **The data is always centered.** R's `plot_pca()` has a `meancenter`\n * argument, but it does not decide whether the components are computed on\n * centered data: `prcomp()` centers again on its own, so `sdev`, `rotation`\n * and the scores come out identical either way (fixture F7 shows the two runs\n * bit for bit). All `meancenter` changes is where the arrows are anchored on\n * screen, which is a drawing decision. So this module has no such option, and\n * the plot layer owns the anchor.\n *\n * **The method is a closed form, not R's SVD.** R decomposes the centered\n * data matrix; this port takes the eigenvectors of the 2x2 covariance matrix,\n * which for two dimensions is a few lines of algebra with no iteration. The\n * covariance route squares the data and so gives up a few bits that an SVD\n * keeps, but at two dimensions the results agree with R far inside the\n * tolerance the tests demand.\n *\n * **Signs are this port's own.** `?prcomp` states that the signs of the\n * rotation columns are arbitrary and vary between programs and even between\n * builds of R. Rather than chase LAPACK, this module fixes its own rule: in\n * each column, the loading of larger magnitude is non-negative, and a tie\n * goes to a non-negative x. Nothing on screen changes — `plot_pca()` draws\n * each component as a two-headed arrow through the center, which is symmetric\n * under a sign flip — but a caller reading the numbers gets one answer for\n * one input instead of a platform's answer.\n */\n\nimport { mean, sum, withoutNegativeZero, zipWith } from \"./arith\";\nimport { completePointRows } from \"./regression\";\nimport type { Point } from \"./regression\";\n\n/**\n * One component's loading vector, as `[x, y]`.\n *\n * These are the two entries of one *column* of R's `rotation` matrix: R\n * prints that matrix with a row per input variable, so R's `rotation[\"x\",\n * \"PC1\"]` is `rotation[0][0]` here and `rotation[\"y\", \"PC1\"]` is\n * `rotation[0][1]`.\n */\nexport type Loadings = readonly [number, number];\n\n/** The components of a point set, in the shape of R's `prcomp` result. */\nexport interface PcaResult {\n /**\n * The standard deviation along each component, largest first. R's `sdev`,\n * computed with the n − 1 divisor.\n */\n readonly sdev: readonly [number, number];\n /**\n * The two loading vectors: `rotation[0]` is PC1, `rotation[1]` is PC2.\n * They are orthonormal, so `rotation[1]` is `rotation[0]` turned a quarter\n * turn, up to the sign rule described above.\n */\n readonly rotation: readonly [Loadings, Loadings];\n /**\n * The mean of each coordinate — the point the components pass through.\n *\n * R's own `pca$center` reports whatever `prcomp` had left to subtract,\n * which is near zero when `plot_pca()` centered the data first. This field\n * is instead the true column mean, which R prints as `mc_diff`.\n */\n readonly center: Point;\n /**\n * The points in component coordinates, in input order. R's `pca$x`, with\n * `x` holding the PC1 score and `y` the PC2 score. Both coordinates are\n * NaN where the point was dropped for a missing value.\n */\n readonly scores: readonly Point[];\n}\n\n/**\n * Compute the two principal components of the points.\n *\n * A single point is a valid input: it has no spread, so both standard\n * deviations are 0 and the components fall back to the coordinate axes,\n * which is what `prcomp` reports for the one component it returns at that\n * size. (R returns `min(n, p)` components and so gives one column there;\n * this port always returns two, matching its behavior on every other\n * degenerate input — see the note on rank below.) `plot_pca()` never gets\n * that far anyway: it draws points and no arrows below three of them.\n *\n * Rank is never reduced. R's `prcomp` drops a component only when given a\n * `tol`, which `plot_pca()` never passes, so collinear, identical and\n * constant-column inputs all still return two components. This function does\n * the same and lets a near-zero `sdev[1]` say that the second direction\n * carries no spread.\n *\n * A point with a non-finite coordinate is dropped before the components are\n * computed, R's `na.omit`; its scores report NaN in both coordinates,\n * keeping input order (the `na.exclude` padding `moderationSurface` uses).\n * R's own `prcomp()` errors on a missing value, so the R usage this mirrors\n * is `prcomp(na.omit(points))` — the fold-in keeps a spreadsheet with one\n * missing row from blanking the whole picture.\n *\n * @param points The observations. The function does not modify them.\n * @returns The components, or null if no point is complete.\n */\nexport function principalComponents(\n points: readonly Point[],\n): PcaResult | null {\n const rows = completePointRows(points);\n if (rows.length === 0) {\n return null;\n }\n const complete = rows.map((row) => points[row] as Point);\n\n const centerX = mean(complete.map((point) => point.x));\n const centerY = mean(complete.map((point) => point.y));\n const devX = complete.map((point) => point.x - centerX);\n const devY = complete.map((point) => point.y - centerY);\n\n // R's `prcomp` divides the singular values by sqrt(max(1, n - 1)), so the\n // variances carry the n - 1 divisor with the same guard at one point.\n const divisor = Math.max(1, complete.length - 1);\n const varX = sum(devX.map((d) => d * d)) / divisor;\n const varY = sum(devY.map((d) => d * d)) / divisor;\n const covariance = sum(zipWith(devX, devY, (dx, dy) => dx * dy)) / divisor;\n\n const [first, second] = componentsOf(varX, varY, covariance);\n\n // R's na.exclude padding: scores in input order, NaN where a point was\n // dropped.\n const scores = points.map(() => ({ x: Number.NaN, y: Number.NaN }));\n rows.forEach((row, survivor) => {\n const dx = devX[survivor] as number;\n const dy = devY[survivor] as number;\n scores[row] = {\n x: dx * first.loadings[0] + dy * first.loadings[1],\n y: dx * second.loadings[0] + dy * second.loadings[1],\n };\n });\n\n return {\n sdev: [sdevOf(first.variance), sdevOf(second.variance)],\n rotation: [first.loadings, second.loadings],\n center: { x: centerX, y: centerY },\n scores,\n };\n}\n\n/** One eigenpair of the covariance matrix. */\ninterface Component {\n readonly variance: number;\n readonly loadings: Loadings;\n}\n\n/**\n * Eigendecompose the symmetric 2x2 covariance matrix, larger eigenvalue\n * first.\n *\n * The eigenvalues of `[[a, b], [b, d]]` are `(a + d)/2 ± hypot((a - d)/2, b)`\n * and an eigenvector of `λ` solves `b·vy = (λ − a)·vx`.\n *\n * A zero off-diagonal is handled on its own path rather than falling out of\n * the formula. It is the case where the components are the coordinate axes\n * exactly — every point sharing one coordinate, which is a classroom input,\n * not a rarity — and the general formula would return the axes only to\n * within a rounding of `hypot`. Taking the branch keeps the answer exact:\n * an axis-aligned rotation of literal 0 and 1, and a literal zero second\n * standard deviation.\n */\nfunction componentsOf(\n varX: number,\n varY: number,\n covariance: number,\n): readonly [Component, Component] {\n if (covariance === 0) {\n const alongX: Component = { variance: varX, loadings: [1, 0] };\n const alongY: Component = { variance: varY, loadings: [0, 1] };\n return varX >= varY ? [alongX, alongY] : [alongY, alongX];\n }\n\n const middle = (varX + varY) / 2;\n const spread = Math.hypot((varX - varY) / 2, covariance);\n const larger = middle + spread;\n const smaller = middle - spread;\n\n // Both rows of (C − λI) give an eigenvector of the larger eigenvalue. They\n // agree in exact arithmetic; the longer one keeps more digits.\n const fromRowX = larger - varX;\n const fromRowY = larger - varY;\n const direction: Loadings =\n fromRowX >= fromRowY ? [covariance, fromRowX] : [fromRowY, covariance];\n const leading = signed(unit(direction));\n\n // A quarter turn of the leading direction: orthonormal by construction,\n // with no second normalization to drift from it.\n const trailing = signed([negated(leading[1]), leading[0]]);\n\n return [\n { variance: larger, loadings: leading },\n { variance: smaller, loadings: trailing },\n ];\n}\n\n/** Scale a vector to unit length. */\nfunction unit(vector: Loadings): Loadings {\n const length = Math.hypot(vector[0], vector[1]);\n return [vector[0] / length, vector[1] / length];\n}\n\n/**\n * Apply the sign rule: the loading of larger magnitude is non-negative, and a\n * tie goes to a non-negative x.\n */\nfunction signed(vector: Loadings): Loadings {\n const dominant =\n Math.abs(vector[0]) >= Math.abs(vector[1]) ? vector[0] : vector[1];\n return dominant >= 0 ? vector : [negated(vector[0]), negated(vector[1])];\n}\n\n/** Negate, mapping zero to positive zero so that no −0 reaches a caller. */\nfunction negated(value: number): number {\n return withoutNegativeZero(-value);\n}\n\n/**\n * Turn a variance into a standard deviation.\n *\n * Cancellation can push the smaller eigenvalue a hair below zero on data\n * that has no spread in that direction; the clamp reports the zero that is\n * meant rather than a NaN.\n */\nfunction sdevOf(variance: number): number {\n return Math.sqrt(Math.max(0, variance));\n}\n",
|
|
25
|
+
"/**\n * Dense (weighted) least squares for small designs.\n *\n * This is the equivalent of R's `lm.wfit()`, and of the solver R runs inside\n * every step of `glm.fit()`'s IRLS loop. R factors the design with `dqrdc2`,\n * a Householder QR with a limited column-pivoting rule: a column whose norm\n * has collapsed against the columns to its left is moved to the right edge\n * and its coefficient is reported as `NA`. That factorization lives in\n * `linalg/qr.ts` as R's `qr()`; this module is the `lm.wfit()` wrapper over\n * it — the square-root weighting, the row-array interface the fitting\n * functions use, and the fitted values as `X · β`. Verified against R in\n * `ols.test.ts`.\n */\n\nimport { sum, zipWith } from \"./arith\";\nimport { make } from \"./linalg/matrix\";\nimport { qr, qrCoef } from \"./linalg/qr\";\n\n/**\n * The result of a fit.\n *\n * A `null` coefficient is the equivalent of R's `NA`: the column carried no\n * information beyond the columns to its left, so R aliases it. `linearRegression`\n * uses the same convention.\n */\nexport interface LeastSquaresFit {\n /**\n * One coefficient per design column, in column order. An aliased column\n * reports null.\n */\n readonly coefficients: readonly (number | null)[];\n /** The fitted response of each row, in input order. */\n readonly fitted: readonly number[];\n /** Response minus fit, of each row, in input order. */\n readonly residuals: readonly number[];\n /** The number of columns the fit could identify. */\n readonly rank: number;\n}\n\nexport interface LeastSquaresOptions {\n /**\n * One weight per row, on R's `lm.wfit()` scale: the solver applies the\n * square root itself.\n *\n * IRLS is the trap here. `glm.fit` carries square-root weights `w` and\n * hands `x * w` to its QR routine, so a caller porting that loop passes\n * `w * w` here, not `w`.\n *\n * A weight of zero drops the row from the fit. The row still gets a fitted\n * value, predicted from the other rows, as it does in R.\n */\n readonly weights?: readonly number[];\n /**\n * How far a column's norm may collapse before the fit aliases it.\n *\n * A column is aliased when its norm, after the columns to its left are\n * projected out, falls below this fraction of its original norm. The\n * default is the value `lm.fit()` uses. `glm.fit()` passes\n * `min(1e-7, epsilon / 1000)`, which is `1e-11` at R's default epsilon.\n */\n readonly tolerance?: number;\n}\n\n/** The rank tolerance of R's `lm.fit()`. */\nexport const DEFAULT_LEAST_SQUARES_TOLERANCE = 1e-7;\n\n/**\n * Fit `y` on the columns of `design` by least squares.\n *\n * @param design One row per observation, each row one value per column. A\n * model with an intercept carries a leading column of ones. The function\n * does not modify it.\n * @param y The response, one value per row.\n * @param options Weights and the rank tolerance.\n * @returns The coefficients, the fit, and the rank.\n * @throws RangeError if there are no rows, if the shapes disagree, or if a\n * weight is negative. R refuses the same inputs: \"0 (non-NA) cases\" and\n * \"missing or negative weights not allowed\".\n */\nexport function leastSquares(\n design: readonly (readonly number[])[],\n y: readonly number[],\n options: LeastSquaresOptions = {},\n): LeastSquaresFit {\n const { weights, tolerance = DEFAULT_LEAST_SQUARES_TOLERANCE } = options;\n const rows = design.length;\n\n if (rows === 0) {\n throw new RangeError(\"least squares needs at least one row\");\n }\n const width = (design[0] as readonly number[]).length;\n if (design.some((row) => row.length !== width)) {\n throw new RangeError(\"every design row needs the same number of columns\");\n }\n if (y.length !== rows) {\n throw new RangeError(\n `the response has ${y.length} values but the design has ${rows} rows`,\n );\n }\n if (weights !== undefined) {\n if (weights.length !== rows) {\n throw new RangeError(\n `there are ${weights.length} weights but ${rows} rows`,\n );\n }\n if (weights.some((weight) => !(weight >= 0))) {\n throw new RangeError(\"weights cannot be negative or missing\");\n }\n }\n\n // Scale each row by the square root of its weight, which turns the weighted\n // problem into an ordinary one. This is what lm.wfit and glm.fit both do.\n const scale = weights?.map((weight) => Math.sqrt(weight));\n const scaled = (value: number, row: number): number =>\n scale === undefined ? value : value * (scale[row] as number);\n\n // The design goes straight into `qr`'s column-major buffer. Building the\n // nested rows first would copy the whole design twice on every call, and\n // `glm.fit`'s IRLS loop calls this once per iteration. Index loop: the\n // buffer is addressed by position.\n const buffer = new Float64Array(rows * width);\n design.forEach((row, index) => {\n for (let column = 0; column < width; column++) {\n buffer[column * rows + index] = scaled(row[column] as number, index);\n }\n });\n\n const factored = qr(make(rows, width, buffer, null), { tolerance });\n const coefficients = qrCoef(factored, y.map(scaled));\n\n const fitted = design.map((row) =>\n sum(\n zipWith(row, coefficients, (value, coefficient) =>\n coefficient === null ? 0 : value * coefficient,\n ),\n ),\n );\n const residuals = zipWith(y, fitted, (value, fit) => value - fit);\n\n return { coefficients, fitted, residuals, rank: factored.rank };\n}\n",
|
|
18
26
|
"/**\n * Logistic regression, the statistics half of `plot_logit()` in the R package.\n *\n * R gets these numbers from `glm(formula, family = binomial)`, which fits by\n * iteratively reweighted least squares: each pass builds a working response\n * and a set of weights from the current fit, then solves an ordinary weighted\n * least-squares problem. This module follows `stats::glm.fit` step for step,\n * down to its starting values, its convergence test, and the two clamped link\n * functions R implements in C. Verified against R in `logit.test.ts`.\n *\n * The clamps are not a detail. R's `linkinv` pins a linear predictor beyond\n * ±30 to a probability one machine epsilon away from 0 or 1, which is what\n * keeps a perfectly separated fit — the classroom case where every low x is a\n * 0 and every high x is a 1 — producing finite numbers instead of dividing by\n * zero.\n */\n\nimport { mean, sum, zipWith } from \"./arith\";\nimport { leastSquares } from \"./ols\";\nimport { completePointRows } from \"./regression\";\nimport type { Point } from \"./regression\";\n\n/** The convergence threshold and iteration cap of R's `glm.control()`. */\nexport const DEFAULT_LOGIT_EPSILON = 1e-8;\nexport const DEFAULT_LOGIT_MAX_ITERATIONS = 25;\n\nexport interface LogitOptions {\n /**\n * How small the relative change in deviance must be to stop. R's\n * `glm.control(epsilon =)`.\n */\n readonly epsilon?: number;\n /** How many IRLS passes to allow. R's `glm.control(maxit =)`. */\n readonly maxIterations?: number;\n}\n\n/**\n * The result of a fit.\n *\n * A `null` slope is the equivalent of R's `NA`: with no variation in x the\n * QR aliases the column and R reports \"1 not defined because of\n * singularities\". `linearRegression` uses the same convention.\n */\nexport interface LogitFit {\n /** The linear predictor at x = 0. */\n readonly intercept: number;\n /** The change in the log odds for each unit of x. Null if x is constant. */\n readonly slope: number | null;\n /**\n * The fitted probability of each point, in input order. NaN where the\n * point was dropped for a missing value.\n */\n readonly fitted: readonly number[];\n /**\n * The log odds of each point, in input order. NaN where the point was\n * dropped for a missing value.\n */\n readonly linearPredictors: readonly number[];\n /** Residual deviance of the fitted model. */\n readonly deviance: number;\n /** Deviance of the intercept-only model. */\n readonly nullDeviance: number;\n /** Akaike information criterion, the fit statistic `plot_logit` displays. */\n readonly aic: number;\n /** How many coefficients the fit could identify. */\n readonly rank: number;\n /** How many IRLS passes ran. */\n readonly iterations: number;\n /** Whether the deviance settled before the iteration cap. */\n readonly converged: boolean;\n /**\n * Whether any fitted probability landed within `10 * Number.EPSILON` of 0\n * or 1.\n *\n * This is the condition behind R's \"fitted probabilities numerically 0 or 1\n * occurred\" warning, which `plot_logit` suppresses. It reports separation:\n * the data admit no maximum likelihood estimate and only the iteration cap\n * stopped the coefficients from growing. A browser library cannot warn, so\n * the fit reports the condition and lets the caller decide.\n */\n readonly saturated: boolean;\n}\n\n/** Where R's C link functions stop computing and start clamping. */\nconst LINK_THRESHOLD = 30;\n/** R's warning threshold for a probability that has reached 0 or 1. */\nconst BOUND = 10 * Number.EPSILON;\n\n/**\n * Fit the log odds of y as a straight line in x.\n *\n * With no variation in x the fit reports an intercept and no slope, the way\n * R's aliasing does. A single point is that same case: R fits the intercept\n * and reports the slope as `NA`. `plot_logit` never reaches either — it draws\n * the points and returns before fitting fewer than two of them — so the guard\n * belongs to the plot layer and this function reports the honest degenerate\n * fit.\n *\n * A point with a non-finite coordinate is dropped before fitting, R's\n * `na.action = na.omit`; its fitted probability and linear predictor report\n * NaN, keeping input order (R's `na.exclude` padding, as `moderationSurface`\n * does). The 0-or-1 rule below applies to the rows that remain: R's\n * `na.omit` removes an incomplete row before `glm()` ever sees its outcome.\n *\n * @param points The observations. Each complete y must be 0 or 1. The\n * function does not modify them.\n * @param options The convergence controls.\n * @returns The fit, or null if no point is complete.\n * @throws RangeError if a complete row's y is not 0 or 1. R accepts any y in\n * [0, 1] for the binomial family; this port does not, because the points\n * come from clicks and because the AIC below assumes a 0/1 outcome.\n */\nexport function logisticRegression(\n points: readonly Point[],\n options: LogitOptions = {},\n): LogitFit | null {\n const {\n epsilon = DEFAULT_LOGIT_EPSILON,\n maxIterations = DEFAULT_LOGIT_MAX_ITERATIONS,\n } = options;\n\n const rows = completePointRows(points);\n if (rows.length === 0) {\n return null;\n }\n const complete = rows.map((row) => points[row] as Point);\n if (complete.some((point) => point.y !== 0 && point.y !== 1)) {\n throw new RangeError(\"every outcome must be 0 or 1\");\n }\n\n const outcomes = complete.map((point) => point.y);\n const design = complete.map((point) => [1, point.x]);\n\n // R's binomial starting values: (weights * y + 0.5) / (weights + 1), which\n // at unit weights puts a 0 at 0.25 and a 1 at 0.75, then takes the link.\n let fitted = outcomes.map((outcome) => (outcome + 0.5) / 2);\n let predictors = fitted.map(logit);\n let previousDeviance = totalDeviance(outcomes, fitted);\n let deviance = previousDeviance;\n\n let coefficients: readonly (number | null)[] = [Number.NaN, null];\n let rank = 0;\n let iterations = 0;\n let converged = false;\n\n for (let iteration = 1; iteration <= maxIterations; iteration++) {\n iterations = iteration;\n\n // One pass builds both IRLS quantities from the same row, so they are\n // computed together rather than in two walks over parallel arrays.\n const working = predictors.map((predictor, row) => {\n const probability = fitted[row] as number;\n const slope = linkSlope(predictor);\n return {\n weight: (slope * slope) / (probability * (1 - probability)),\n response: predictor + ((outcomes[row] as number) - probability) / slope,\n };\n });\n\n const step = leastSquares(\n design,\n working.map((row) => row.response),\n {\n weights: working.map((row) => row.weight),\n // R: min(1e-7, control$epsilon / 1000).\n tolerance: Math.min(1e-7, epsilon / 1000),\n },\n );\n\n // R abandons the fit rather than adopting coefficients it cannot use.\n if (\n step.coefficients.some(\n (coefficient) => coefficient !== null && !Number.isFinite(coefficient),\n )\n ) {\n break;\n }\n\n coefficients = step.coefficients;\n rank = step.rank;\n // An aliased coefficient counts as zero here. R's QR returns 0 for it\n // during the loop and only reports NA once the fit is over.\n predictors = design.map((row) =>\n sum(\n zipWith(row, coefficients, (value, coefficient) =>\n coefficient === null ? 0 : value * coefficient,\n ),\n ),\n );\n fitted = predictors.map(linkInverse);\n deviance = totalDeviance(outcomes, fitted);\n\n if (\n Math.abs(deviance - previousDeviance) / (0.1 + Math.abs(deviance)) <\n epsilon\n ) {\n converged = true;\n break;\n }\n previousDeviance = deviance;\n }\n\n const wholeMean = mean(outcomes);\n const nullDeviance = totalDeviance(\n outcomes,\n outcomes.map(() => wholeMean),\n );\n\n // R's na.exclude padding: report the fit in input order, NaN where a\n // point was dropped.\n const paddedFitted = new Array<number>(points.length).fill(Number.NaN);\n const paddedPredictors = new Array<number>(points.length).fill(Number.NaN);\n rows.forEach((row, survivor) => {\n paddedFitted[row] = fitted[survivor] as number;\n paddedPredictors[row] = predictors[survivor] as number;\n });\n\n return {\n // The leading column of ones always carries norm, so the QR cannot alias\n // the intercept.\n intercept: coefficients[0] ?? Number.NaN,\n slope: coefficients[1] ?? null,\n fitted: paddedFitted,\n linearPredictors: paddedPredictors,\n deviance,\n nullDeviance,\n // R evaluates the binomial log likelihood and adds 2 * rank. For a 0/1\n // outcome at unit weights the saturated log likelihood is 0, so that\n // evaluation is the deviance itself, term for term.\n aic: deviance + 2 * rank,\n rank,\n iterations,\n converged,\n saturated: fitted.some(\n (probability) => probability > 1 - BOUND || probability < BOUND,\n ),\n };\n}\n\n/**\n * The fitted probability at one x.\n *\n * `plot_logit` draws its curve from 500 of these. An aliased slope holds the\n * curve flat, which is what R's `predict()` does with an `NA` coefficient\n * dropped from the model.\n */\nexport function predictLogit(fit: LogitFit, x: number): number {\n return linkInverse(fit.intercept + (fit.slope ?? 0) * x);\n}\n\n/** The logit link: log odds of a probability. */\nfunction logit(probability: number): number {\n return Math.log(probability / (1 - probability));\n}\n\n/**\n * The inverse link, with R's clamps.\n *\n * R's `C_logit_linkinv` never lets a probability reach 0 or 1: beyond a linear\n * predictor of ±30 it substitutes odds of `eps` or `1 / eps`. That is what\n * produces the saturated 2.2204460492503126e-16 and 0.99999999999999978 of a\n * separated fit, and what keeps the deviance finite there.\n */\nfunction linkInverse(predictor: number): number {\n const odds =\n predictor < -LINK_THRESHOLD\n ? Number.EPSILON\n : predictor > LINK_THRESHOLD\n ? 1 / Number.EPSILON\n : Math.exp(predictor);\n return odds / (1 + odds);\n}\n\n/**\n * The derivative of the inverse link, with R's clamps.\n *\n * Algebraically this is the binomial variance `mu * (1 - mu)`, but R computes\n * it from the linear predictor as `exp(eta) / (1 + exp(eta))^2` and clamps it\n * to `eps` beyond ±30. The two differ in the last two digits — at\n * `eta = log(3)` R gives 0.18750000000000003 against 0.18749999999999994 —\n * and the IRLS weights carry that difference into every coefficient, so this\n * follows R rather than the tidier identity.\n */\nfunction linkSlope(predictor: number): number {\n if (predictor > LINK_THRESHOLD || predictor < -LINK_THRESHOLD) {\n return Number.EPSILON;\n }\n const odds = Math.exp(predictor);\n return odds / ((1 + odds) * (1 + odds));\n}\n\n/** R's binomial `dev.resids`, summed. */\nfunction totalDeviance(\n outcomes: readonly number[],\n probabilities: readonly number[],\n): number {\n return sum(\n zipWith(\n outcomes,\n probabilities,\n (outcome, probability) =>\n 2 *\n (surprise(outcome, probability) +\n surprise(1 - outcome, 1 - probability)),\n ),\n );\n}\n\n/** One side of a deviance residual. R writes this as `y_log_y`. */\nfunction surprise(outcome: number, probability: number): number {\n return outcome !== 0 ? outcome * Math.log(outcome / probability) : 0;\n}\n",
|
|
19
|
-
"/**\n * Special functions that the statistics in `core/` build on.\n *\n * JavaScript has no `lgamma` and no incomplete beta, so the distribution\n * functions need them here. R gets the same quantities from its own C\n * routines; this module is the port's replacement.\n *\n * Every function is pure. None of them touch the DOM or hold state.\n */\n\nimport { sum } from \"./arith\";\n\n/**\n * Lanczos parameter and coefficients, g = 607/128 with 15 terms.\n *\n * This set holds about 15 correct digits over the whole positive real line,\n * which is what the t quantiles need at 1e-12 relative tolerance.\n */\nconst LANCZOS_G = 607 / 128;\n\nconst LANCZOS_LEAD = 0.99999999999999709182;\n\nconst LANCZOS_TAIL: readonly number[] = [\n 57.156235665862923517, -59.597960355475491248, 14.136097974741747174,\n -0.49191381609762019978, 0.33994649984811888699e-4,\n 0.46523628927048575665e-4, -0.98374475304879564677e-4,\n 0.15808870322491248884e-3, -0.21026444172410488319e-3,\n 0.2174396181152126432e-3, -0.16431810653676389022e-3,\n 0.84418223983852743293e-4, -0.2619083840158140867e-4,\n 0.36899182659531622704e-5,\n];\n\nconst LOG_SQRT_TWO_PI = 0.5 * Math.log(2 * Math.PI);\n\n/**\n * The Lanczos series A(x), the slowly varying part of the approximation\n *\n * Γ(x) = √(2π) · (x + g − ½)^(x − ½) · e^−(x + g − ½) · A(x)\n */\nfunction lanczosSeries(x: number): number {\n return (\n LANCZOS_LEAD +\n sum(LANCZOS_TAIL.map((coefficient, index) => coefficient / (x + index)))\n );\n}\n\n/**\n * The natural log of the gamma function, R's `lgamma()`.\n *\n * @param x A positive number.\n * @returns log Γ(x), or NaN if x is zero or less.\n */\nexport function logGamma(x: number): number {\n if (!(x > 0)) {\n return Number.NaN;\n }\n const shifted = x + LANCZOS_G - 0.5;\n return (\n LOG_SQRT_TWO_PI +\n (x - 0.5) * Math.log(shifted) -\n shifted +\n Math.log(lanczosSeries(x))\n );\n}\n\n/**\n * The natural log of the beta function, R's `lbeta()`.\n *\n * The obvious route, `logGamma(a) + logGamma(b) - logGamma(a + b)`, subtracts\n * numbers near 600 for the degrees of freedom this package plots, and loses\n * about three digits doing so. Expanding the Lanczos form first cancels the\n * large terms by hand: the exponential parts collapse to the constant\n * −(g − ½), and the logarithmic parts become ratios that stay of order one.\n * What is left has no cancellation at all.\n *\n * Both ratios go through `log1p`. Each one sits just below 1, and taking the\n * quotient first would round away the small part that the log then reads —\n * a loss that grows with the larger argument, reaching 1e-13 by b = 2500.\n *\n * @param a A positive number.\n * @param b A positive number.\n * @returns log B(a, b), or NaN if either argument is zero or less.\n */\nexport function logBeta(a: number, b: number): number {\n if (!(a > 0) || !(b > 0)) {\n return Number.NaN;\n }\n const shiftedSum = a + b + LANCZOS_G - 0.5;\n return (\n LOG_SQRT_TWO_PI -\n (LANCZOS_G - 0.5) +\n Math.log(lanczosSeries(a)) +\n Math.log(lanczosSeries(b)) -\n Math.log(lanczosSeries(a + b)) +\n (a - 0.5) * Math.log1p(-b / shiftedSum) +\n (b - 0.5) * Math.log1p(-a / shiftedSum) -\n 0.5 * Math.log(shiftedSum)\n );\n}\n\n/** Iteration caps and guards for the continued fraction. */\nconst FRACTION_MAX_STEPS = 400;\nconst FRACTION_EPSILON = 3e-16;\nconst FRACTION_FLOOR = 1e-300;\n\n/**\n * The continued fraction of the incomplete beta function, by the modified\n * Lentz method.\n *\n * The loop is index based on purpose: it refines one running value step by\n * step and stops on a convergence test, so there is no array to map over.\n */\nfunction betaContinuedFraction(x: number, a: number, b: number): number {\n const total = a + b;\n const aPlus = a + 1;\n const aMinus = a - 1;\n\n let c = 1;\n let d = 1 - (total * x) / aPlus;\n if (Math.abs(d) < FRACTION_FLOOR) {\n d = FRACTION_FLOOR;\n }\n d = 1 / d;\n let value = d;\n\n for (let step = 1; step <= FRACTION_MAX_STEPS; step += 1) {\n const twice = 2 * step;\n\n const even = (step * (b - step) * x) / ((aMinus + twice) * (a + twice));\n d = 1 + even * d;\n if (Math.abs(d) < FRACTION_FLOOR) {\n d = FRACTION_FLOOR;\n }\n c = 1 + even / c;\n if (Math.abs(c) < FRACTION_FLOOR) {\n c = FRACTION_FLOOR;\n }\n d = 1 / d;\n value *= d * c;\n\n const odd = (-(a + step) * (total + step) * x) / ((a + twice) * (aPlus + twice));\n d = 1 + odd * d;\n if (Math.abs(d) < FRACTION_FLOOR) {\n d = FRACTION_FLOOR;\n }\n c = 1 + odd / c;\n if (Math.abs(c) < FRACTION_FLOOR) {\n c = FRACTION_FLOOR;\n }\n d = 1 / d;\n\n const delta = d * c;\n value *= delta;\n if (Math.abs(delta - 1) < FRACTION_EPSILON) {\n break;\n }\n }\n\n return value;\n}\n\n/**\n * The regularized incomplete beta function I_x(a, b), R's `pbeta()`.\n *\n * The continued fraction converges quickly only on one side of the\n * distribution, so the function evaluates the mirrored form when x sits above\n * the switch point and takes the complement.\n *\n * @param x A value between 0 and 1.\n * @param a A positive shape.\n * @param b A positive shape.\n * @returns The share of the beta density below x, or NaN for a bad shape.\n */\nexport function incompleteBeta(x: number, a: number, b: number): number {\n if (Number.isNaN(x)) {\n return Number.NaN;\n }\n if (x <= 0) {\n return 0;\n }\n if (x >= 1) {\n return 1;\n }\n return incompleteBetaSplit(x, 1 - x, a, b);\n}\n\n/**\n * The regularized incomplete beta function, told x and 1 − x separately.\n *\n * A caller that can write down both members of the pair should use this\n * instead of `incompleteBeta`. Once x is within 1e-16 of 1, the double\n * holding it has no room left for 1 − x, and rebuilding the complement by\n * subtraction throws away the very digits the answer rests on. `pt()` reads\n * both straight off t and df, so it gives up nothing.\n *\n * The two are treated as an exact pair, not as one value and a derived one:\n * each logarithm is taken from whichever member still carries its precision.\n *\n * @param x A value between 0 and 1.\n * @param complement The value of 1 − x, computed without subtracting.\n * @param a A positive shape.\n * @param b A positive shape.\n * @returns The share of the beta density below x, or NaN for a bad shape.\n */\nexport function incompleteBetaSplit(\n x: number,\n complement: number,\n a: number,\n b: number,\n): number {\n if (Number.isNaN(x) || Number.isNaN(complement) || !(a > 0) || !(b > 0)) {\n return Number.NaN;\n }\n if (x <= 0) {\n return 0;\n }\n if (complement <= 0) {\n return 1;\n }\n\n const logX = complement < 0.5 ? Math.log1p(-complement) : Math.log(x);\n const logComplement = x < 0.5 ? Math.log1p(-x) : Math.log(complement);\n const front = Math.exp(a * logX + b * logComplement - logBeta(a, b));\n\n if (x < (a + 1) / (a + b + 2)) {\n return (front * betaContinuedFraction(x, a, b)) / a;\n }\n return 1 - (front * betaContinuedFraction(complement, b, a)) / b;\n}\n\n/** Iteration cap and tolerance for the incomplete gamma routines. */\nconst GAMMA_MAX_STEPS = 1000;\nconst GAMMA_EPSILON = 3e-16;\n\n/**\n * P(a, x), the regularized lower incomplete gamma, by its power series.\n *\n * The series converges quickly while x stays below a + 1. Index loop with a\n * stated reason: it sums one term at a time and stops on a size test.\n */\nfunction lowerGammaSeries(a: number, x: number): number {\n let term = 1 / a;\n let total = term;\n for (let step = 1; step <= GAMMA_MAX_STEPS; step += 1) {\n term *= x / (a + step);\n total += term;\n if (Math.abs(term) < Math.abs(total) * GAMMA_EPSILON) {\n break;\n }\n }\n return total * Math.exp(-x + a * Math.log(x) - logGamma(a));\n}\n\n/**\n * Q(a, x), the regularized upper incomplete gamma, by the modified Lentz\n * method on its continued fraction.\n *\n * This is the branch that carries the far normal tail, where the answer runs\n * to 1e-70 and below and must stay accurate relative to itself.\n */\nfunction upperGammaFraction(a: number, x: number): number {\n let b = x + 1 - a;\n let c = 1 / FRACTION_FLOOR;\n let d = 1 / b;\n let value = d;\n\n for (let step = 1; step <= GAMMA_MAX_STEPS; step += 1) {\n const numerator = -step * (step - a);\n b += 2;\n d = numerator * d + b;\n if (Math.abs(d) < FRACTION_FLOOR) {\n d = FRACTION_FLOOR;\n }\n c = b + numerator / c;\n if (Math.abs(c) < FRACTION_FLOOR) {\n c = FRACTION_FLOOR;\n }\n d = 1 / d;\n const delta = d * c;\n value *= delta;\n if (Math.abs(delta - 1) < GAMMA_EPSILON) {\n break;\n }\n }\n\n return value * Math.exp(-x + a * Math.log(x) - logGamma(a));\n}\n\n/** Q(a, x), taking whichever of the two routes converges at this x. */\nfunction upperGamma(a: number, x: number): number {\n if (x <= 0) {\n return 1;\n }\n if (!Number.isFinite(x)) {\n return 0;\n }\n return x < a + 1 ? 1 - lowerGammaSeries(a, x) : upperGammaFraction(a, x);\n}\n\n/**\n * The standard normal distribution function, R's `pnorm()`.\n *\n * Built on the identity Φ(−z) = ½ · Q(½, z²/2), which keeps the far tail\n * accurate relative to itself rather than losing it against 1. The\n * non-central t needs Φ(−ncp) down to 1e-72 at the widest slider settings.\n *\n * @param z Where to evaluate the distribution.\n * @returns A probability between 0 and 1, or NaN for a NaN input.\n */\nexport function normalCdf(z: number): number {\n if (Number.isNaN(z)) {\n return Number.NaN;\n }\n const lower = 0.5 * upperGamma(0.5, 0.5 * z * z);\n return z > 0 ? 1 - lower : lower;\n}\n\n/** The largest double below 1. The inverse never returns 1 itself. */\nconst BELOW_ONE = 1 - Number.EPSILON / 2;\n\n/** Iteration cap for the inverse. Newton needs about 8 steps; 200 is slack. */\nconst INVERSE_MAX_STEPS = 200;\n\n/**\n * A starting point for the inverse, from Numerical Recipes.\n *\n * Both branches are approximations only. The Newton loop that follows carries\n * the value the rest of the way, so the guess needs to be in the right\n * neighborhood, not accurate.\n */\nfunction inverseGuess(p: number, a: number, b: number): number {\n if (a >= 1 && b >= 1) {\n const tail = p < 0.5 ? p : 1 - p;\n const t = Math.sqrt(-2 * Math.log(tail));\n const normal =\n (p < 0.5 ? -1 : 1) *\n ((2.30753 + t * 0.27061) / (1 + t * (0.99229 + t * 0.04481)) - t);\n const scale = (normal * normal - 3) / 6;\n const harmonic = 2 / (1 / (2 * a - 1) + 1 / (2 * b - 1));\n const w =\n (normal * Math.sqrt(scale + harmonic)) / harmonic -\n (1 / (2 * b - 1) - 1 / (2 * a - 1)) *\n (scale + 5 / 6 - 2 / (3 * harmonic));\n return a / (a + b * Math.exp(2 * w));\n }\n\n const lower = Math.exp(a * Math.log(a / (a + b))) / a;\n const upper = Math.exp(b * Math.log(b / (a + b))) / b;\n const total = lower + upper;\n if (p < lower / total) {\n return Math.pow(a * total * p, 1 / a);\n }\n return 1 - Math.pow(b * total * (1 - p), 1 / b);\n}\n\n/**\n * The inverse of the regularized incomplete beta function, R's `qbeta()`.\n *\n * Newton's method on I_x(a, b) − p, with the exact beta density as the\n * derivative. Every step keeps a bracket, and a step that leaves the bracket\n * falls back to bisection, so the loop cannot run away on a poor guess.\n *\n * @param p A probability between 0 and 1.\n * @param a A positive shape.\n * @param b A positive shape.\n * @returns The x where I_x(a, b) equals p, or NaN for a bad shape.\n */\nexport function inverseIncompleteBeta(\n p: number,\n a: number,\n b: number,\n): number {\n if (Number.isNaN(p) || !(a > 0) || !(b > 0)) {\n return Number.NaN;\n }\n if (p <= 0) {\n return 0;\n }\n if (p >= 1) {\n return 1;\n }\n\n const logBetaValue = logBeta(a, b);\n let lower = 0;\n let upper = 1;\n let x = inverseGuess(p, a, b);\n if (!(x > 0) || !(x < 1)) {\n x = 0.5;\n }\n\n // Index loop with a stated reason: this refines a single root and stops on\n // a convergence test.\n for (let step = 0; step < INVERSE_MAX_STEPS; step += 1) {\n const residual = incompleteBeta(x, a, b) - p;\n if (residual < 0) {\n lower = x;\n } else {\n upper = x;\n }\n\n const density = Math.exp(\n (a - 1) * Math.log(x) + (b - 1) * Math.log1p(-x) - logBetaValue,\n );\n let next =\n density > 0 && Number.isFinite(density) ? x - residual / density : Number.NaN;\n if (!(next > lower) || !(next < upper)) {\n next = 0.5 * (lower + upper);\n }\n if (next === x) {\n break;\n }\n\n const moved = Math.abs(next - x);\n x = next;\n if (moved <= Number.EPSILON * x) {\n break;\n }\n }\n\n return Math.min(x, BELOW_ONE);\n}\n",
|
|
20
|
-
"/**\n * The t distribution: density, cumulative probability, and quantile.\n *\n * These are the port of R's `dt()`, `pt()`, and `qt()`. `plot_t_test()` in\n * `../compstatslib/R/t_statistic_plot.R` draws both hypothesis curves from\n * them. Verified against R in `tdist.test.ts`.\n *\n * All three take an optional non-centrality, as in R. Left out or given as 0,\n * they run the central path, which `plot_t_test()` draws the null hypothesis\n * from; given a non-zero value they run the non-central path behind the\n * alternative-hypothesis curve, where the non-centrality is the t statistic\n * itself.\n *\n * A note on how close this comes to R. The non-central routines follow R's\n * own `pnt.c` and `dnt.c` step for step, down to the iteration cap and the\n * error bound. That is on purpose. Both stop the series on an *absolute*\n * bound, so where they stop is part of the answer, and a tidier stopping rule\n * would move the last digits away from R rather than toward the truth. It\n * also means this port inherits R's limits: at a large non-centrality the\n * series terms are built by repeated subtraction and go to noise once they\n * fall below about 1e-16, which is what R's own \"full precision may not have\n * been achieved\" warning reports. Densities near 1e-50 there agree with R in\n * absolute terms only.\n */\n\nimport {\n incompleteBetaSplit,\n inverseIncompleteBeta,\n logBeta,\n normalCdf,\n} from \"./special\";\n\n/** True when a non-centrality was given and is not the central case. */\nfunction isNonCentral(ncp: number | undefined): ncp is number {\n return ncp !== undefined && ncp !== 0;\n}\n\n/** True when any argument rules the answer out before any work starts. */\nfunction isBadArgument(value: number, df: number, ncp: number | undefined): boolean {\n return (\n Number.isNaN(value) ||\n !(df > 0) ||\n (ncp !== undefined && Number.isNaN(ncp))\n );\n}\n\n/**\n * The density of the t distribution, R's `dt()`.\n *\n * @param x Where to evaluate the density.\n * @param df Degrees of freedom. Any positive number, whole or not.\n * @param ncp The non-centrality. Left out, or 0, gives the central density.\n * @returns The density, or NaN if df is zero or less.\n */\nexport function dt(x: number, df: number, ncp?: number): number {\n if (isBadArgument(x, df, ncp)) {\n return Number.NaN;\n }\n return isNonCentral(ncp)\n ? nonCentralDensity(x, df, ncp)\n : centralDensity(x, df);\n}\n\n/**\n * The share of the distribution below x, R's `pt()`.\n *\n * @param x Where to evaluate the distribution.\n * @param df Degrees of freedom. Any positive number, whole or not.\n * @param ncp The non-centrality. Left out, or 0, gives the central case.\n * @returns A probability between 0 and 1, or NaN if df is zero or less.\n */\nexport function pt(x: number, df: number, ncp?: number): number {\n if (isBadArgument(x, df, ncp)) {\n return Number.NaN;\n }\n return isNonCentral(ncp)\n ? nonCentralProbability(x, df, ncp)\n : centralProbability(x, df);\n}\n\n/**\n * The value with probability p below it, R's `qt()`.\n *\n * @param p A probability between 0 and 1. The ends give infinities, as in R.\n * @param df Degrees of freedom. Any positive number, whole or not.\n * @param ncp The non-centrality. Left out, or 0, gives the central case.\n * @returns The quantile, or NaN for a p outside 0 to 1 or a df of zero or\n * less.\n */\nexport function qt(p: number, df: number, ncp?: number): number {\n if (isBadArgument(p, df, ncp) || p < 0 || p > 1) {\n return Number.NaN;\n }\n return isNonCentral(ncp)\n ? nonCentralQuantile(p, df, ncp)\n : centralQuantile(p, df);\n}\n\n/**\n * The density, computed in logs.\n *\n * f(x) = (1 + x²/df)^−(df+1)/2 / (√df · B(½, df/2))\n *\n * `log1p` keeps the small-x end accurate, and the log form keeps the large-df\n * end from overflowing on the way to a modest answer.\n */\nfunction centralDensity(x: number, df: number): number {\n if (!Number.isFinite(x)) {\n return 0;\n }\n const logDensity =\n -0.5 * Math.log(df) -\n logBeta(0.5, df / 2) -\n ((df + 1) / 2) * Math.log1p((x * x) / df);\n return Math.exp(logDensity);\n}\n\n/**\n * The cumulative probability, from the upper tail outward.\n *\n * Working from whichever tail holds the smaller mass avoids subtracting two\n * nearly equal numbers, which is what makes the far tails accurate.\n */\nfunction centralProbability(x: number, df: number): number {\n if (x === 0) {\n return 0.5;\n }\n if (x === Number.POSITIVE_INFINITY) {\n return 1;\n }\n if (x === Number.NEGATIVE_INFINITY) {\n return 0;\n }\n const tail = upperTail(Math.abs(x), df);\n return x < 0 ? tail : 1 - tail;\n}\n\n/**\n * The mass above t, for a t of zero or more.\n *\n * P(T > t) = ½ · I_z(df/2, ½), z = df / (df + t²)\n *\n * This is the incomplete-beta identity R's `pt()` uses. Both z and 1 − z come\n * straight out of t and df, each to full precision, so the pair goes to\n * `incompleteBetaSplit` rather than letting it subtract one from the other. A\n * small t drives z against 1, where a subtracted complement would keep only a\n * handful of digits; a large t makes the answer tiny, where building it as\n * ½ − something would cancel it away to nothing.\n */\nfunction upperTail(t: number, df: number): number {\n const squared = t * t;\n if (!Number.isFinite(squared)) {\n // t is past 1e154. The mass above it is far below the smallest double.\n return 0;\n }\n const total = df + squared;\n return 0.5 * incompleteBetaSplit(df / total, squared / total, df / 2, 0.5);\n}\n\n/** How many Newton steps the quantile takes after the beta inverse. */\nconst POLISH_MAX_STEPS = 4;\n\n/**\n * The quantile, by inverting the incomplete beta and then polishing.\n *\n * The symmetry of the distribution turns a one-sided probability into a\n * two-sided mass, which the beta inverse handles. Which shape goes first\n * depends on which side is small: taking the large side would compute the\n * answer as one minus something near one and throw away digits.\n */\nfunction centralQuantile(p: number, df: number): number {\n if (p === 0.5) {\n return 0;\n }\n if (p <= 0) {\n return Number.NEGATIVE_INFINITY;\n }\n if (p >= 1) {\n return Number.POSITIVE_INFINITY;\n }\n\n const tail = p < 0.5 ? p : 1 - p;\n const sign = p < 0.5 ? -1 : 1;\n const twoSided = 2 * tail;\n\n let squared: number;\n if (twoSided > 0.5) {\n // Near the middle: the answer is small, so solve for x²/(df + x²).\n const near = inverseIncompleteBeta(1 - twoSided, 0.5, df / 2);\n squared = (df * near) / (1 - near);\n } else {\n // Out in a tail: the answer is large, so solve for df/(df + x²).\n const far = inverseIncompleteBeta(twoSided, df / 2, 0.5);\n squared = (df * (1 - far)) / far;\n }\n\n return sign * polish(Math.sqrt(squared), tail, df);\n}\n\n/**\n * Newton steps on the upper tail, to take the last digits home.\n *\n * The beta inverse lands close but loses a little precision on the way\n * through x² and the square root. Solving P(T > t) = tail directly, with the\n * density as the derivative, recovers it. The step is measured against the\n * tail rather than against p, so a p near 1 does not lose its digits to the\n * subtraction.\n */\nfunction polish(start: number, tail: number, df: number): number {\n let t = start;\n\n // Index loop with a stated reason: this refines a single root and stops on\n // a convergence test.\n for (let step = 0; step < POLISH_MAX_STEPS; step += 1) {\n const density = centralDensity(t, df);\n if (!(density > 0) || !Number.isFinite(t)) {\n break;\n }\n\n const move = (upperTail(t, df) - tail) / density;\n const next = t + move;\n if (!(next > 0) || !Number.isFinite(next) || Math.abs(move) > 0.25 * t) {\n break;\n }\n if (next === t) {\n break;\n }\n\n t = next;\n if (Math.abs(move) <= Number.EPSILON * t) {\n break;\n }\n }\n\n return t;\n}\n\n/**\n * Iteration cap and error bound for the AS 243 series.\n *\n * These are R's own values from `pnt.c`. They are part of the answer, not a\n * detail: the series stops on an *absolute* bound, so where it stops decides\n * the last digits. Holding R's numbers here is what makes this port agree\n * with R rather than merely come close to the true value.\n */\nconst SERIES_MAX_STEPS = 1000;\nconst SERIES_ERROR_MAX = 1e-12;\n\n/** Above this non-centrality R leaves the series for a normal fit. */\nconst SERIES_NCP_LIMIT_SQUARED = 2 * Math.LN2 * 1022;\n\n/** Above this many degrees of freedom R does the same. */\nconst SERIES_DF_LIMIT = 4e5;\n\nconst SQRT_TWO_OVER_PI = Math.sqrt(2 / Math.PI);\n\n/**\n * The share of the non-central distribution below x, R's `pt(x, df, ncp)`.\n *\n * The series only runs on values of zero or more, so a negative x is\n * reflected through the origin along with the non-centrality. That names the\n * other tail, which the caller flips back.\n */\nfunction nonCentralProbability(x: number, df: number, ncp: number): number {\n if (x === Number.POSITIVE_INFINITY) {\n return 1;\n }\n if (x === Number.NEGATIVE_INFINITY) {\n return 0;\n }\n\n const reflected = x < 0;\n const t = reflected ? -x : x;\n const delta = reflected ? -ncp : ncp;\n const lower =\n df > SERIES_DF_LIMIT || delta * delta > SERIES_NCP_LIMIT_SQUARED\n ? normalApproximation(t, df, delta)\n : lenthSeries(t, df, delta);\n\n return reflected ? 1 - lower : lower;\n}\n\n/**\n * Abramowitz and Stegun 26.7.10, the fit R falls back on.\n *\n * Past a non-centrality of about 37.6 the leading Poisson weight\n * exp(−ncp²/2) drops below the smallest double and the series has nothing\n * left to sum. The sliders reach that: a difference of 4 with a standard\n * deviation of 1 over 500 observations puts the non-centrality near 89.\n */\nfunction normalApproximation(t: number, df: number, delta: number): number {\n const shrink = 1 / (4 * df);\n const spread = Math.sqrt(1 + t * t * 2 * shrink);\n return normalCdf((t * (1 - shrink) - delta) / spread);\n}\n\n/**\n * The AS 243 twin series of Lenth (1989), as R's `pnt.c` runs it.\n *\n * The distribution is a Poisson mixture of incomplete beta terms. Both\n * families of terms step by recurrence rather than being evaluated afresh,\n * and `remaining` carries the Poisson mass still to come, which bounds the\n * error of stopping early.\n *\n * @param t Where to evaluate, zero or more.\n * @param df Degrees of freedom.\n * @param delta The non-centrality, of either sign.\n */\nfunction lenthSeries(t: number, df: number, delta: number): number {\n const squared = t * t;\n const total = df + squared;\n const x = squared / total;\n const complement = df / total;\n\n let sum = 0;\n if (x > 0) {\n const lambda = delta * delta;\n let oddWeight = 0.5 * Math.exp(-0.5 * lambda);\n let evenWeight = SQRT_TWO_OVER_PI * oddWeight * delta;\n\n let remaining = 0.5 - oddWeight;\n if (remaining < 1e-7) {\n remaining = -0.5 * Math.expm1(-0.5 * lambda);\n }\n\n let a = 0.5;\n const b = 0.5 * df;\n const powered = Math.pow(complement, b);\n const logBetaValue = logBeta(0.5, b);\n\n let oddTerm = incompleteBetaSplit(x, complement, a, b);\n let oddStep = 2 * powered * Math.exp(a * Math.log(x) - logBetaValue);\n let evenTerm = 1 - powered;\n let evenStep = b * x * powered;\n sum = oddWeight * oddTerm + evenWeight * evenTerm;\n\n // Index loop with a stated reason: each pass advances one Poisson term by\n // recurrence and the loop stops on an error bound, not on a data length.\n for (let step = 1; step <= SERIES_MAX_STEPS; step += 1) {\n a += 1;\n oddTerm -= oddStep;\n evenTerm -= evenStep;\n oddStep *= (x * (a + b - 1)) / a;\n evenStep *= (x * (a + b - 0.5)) / (a + 0.5);\n oddWeight *= lambda / (2 * step);\n evenWeight *= lambda / (2 * step + 1);\n remaining -= oddWeight;\n if (remaining <= 0) {\n break;\n }\n sum += oddWeight * oddTerm + evenWeight * evenTerm;\n if (Math.abs(2 * remaining * (oddTerm - oddStep)) < SERIES_ERROR_MAX) {\n break;\n }\n }\n }\n\n return Math.min(Math.max(sum + normalCdf(-delta), 0), 1);\n}\n\n/**\n * The density of the non-central distribution, R's `dt(x, df, ncp)`.\n *\n * Away from zero the density is read off the distribution function, using\n * that its derivative can be written as a difference between two evaluations\n * two degrees of freedom apart. R notes in `dnt.c` that this still cancels,\n * and it does: at x = 1 the two probabilities agree to about two digits\n * before the difference is taken. Following R's route rather than a cleaner\n * one is deliberate, since the fixtures are R's own output.\n */\nfunction nonCentralDensity(x: number, df: number, ncp: number): number {\n if (!Number.isFinite(x)) {\n return 0;\n }\n\n if (Math.abs(x) > Math.sqrt(df * Number.EPSILON)) {\n const stepped = x * Math.sqrt((df + 2) / df);\n const difference =\n nonCentralProbability(stepped, df + 2, ncp) -\n nonCentralProbability(x, df, ncp);\n return (df / Math.abs(x)) * Math.abs(difference);\n }\n\n // At zero that difference is 0/0. The density there is the central one\n // damped by the non-centrality, exp(−ncp²/2).\n return Math.exp(\n -0.5 * Math.log(df) - logBeta(0.5, df / 2) - 0.5 * ncp * ncp,\n );\n}\n\n/** Iteration cap for the non-central quantile search. */\nconst QUANTILE_MAX_STEPS = 200;\n\n/**\n * The non-central quantile, R's `qt(p, df, ncp)`.\n *\n * There is no closed form to invert, so this brackets the root and then works\n * inward. R bisects to a relative 1e-13; Newton steps get there in a handful\n * of passes instead, with the bracket kept so that a step into the flat part\n * of a far tail cannot run away.\n */\nfunction nonCentralQuantile(p: number, df: number, ncp: number): number {\n if (p <= 0) {\n return Number.NEGATIVE_INFINITY;\n }\n if (p >= 1) {\n return Number.POSITIVE_INFINITY;\n }\n\n // Widen outward from the non-centrality until the root is enclosed.\n let upper = Math.max(1, ncp);\n while (\n Number.isFinite(upper) &&\n nonCentralProbability(upper, df, ncp) < p\n ) {\n upper *= 2;\n }\n let lower = Math.min(-1, -ncp);\n while (\n Number.isFinite(lower) &&\n nonCentralProbability(lower, df, ncp) > p\n ) {\n lower *= 2;\n }\n\n let t = 0.5 * (lower + upper);\n\n // Index loop with a stated reason: this refines a single root and stops on\n // a convergence test.\n for (let step = 0; step < QUANTILE_MAX_STEPS; step += 1) {\n const residual = nonCentralProbability(t, df, ncp) - p;\n if (residual < 0) {\n lower = t;\n } else {\n upper = t;\n }\n\n const density = nonCentralDensity(t, df, ncp);\n let next =\n density > 0 && Number.isFinite(density) ? t - residual / density : Number.NaN;\n if (!(next > lower) || !(next < upper)) {\n next = 0.5 * (lower + upper);\n }\n if (next === t) {\n break;\n }\n\n const moved = Math.abs(next - t);\n t = next;\n if (moved <= Number.EPSILON * Math.abs(t)) {\n break;\n }\n }\n\n return t;\n}\n",
|
|
21
27
|
"/**\n * The derived quantities of a one-sided t test.\n *\n * This is the statistics half of `plot_t_test()` in\n * `../compstatslib/R/t_statistic_plot.R`. R computes these while drawing,\n * scattered across `plot_t_test()`, `t_null_plot()`, `t_alt_lines()`, and\n * `plot_error_matrix()`; here they are one pure result that the plot layer\n * reads. Verified against R in `ttest.test.ts`.\n *\n * What the picture shows: a null distribution centerd at 0 and an alternative\n * distribution centerd at the t statistic the given difference produces. The\n * area of the null above the critical value is the significance level; the\n * area of the alternative above that same point is the power, and what falls\n * below it is beta.\n */\n\nimport { dt, pt, qt } from \"./tdist\";\n\n/** The four numbers `plot_t_test()` takes, all optional as in R. */\nexport interface TTestOptions {\n /** The difference the alternative hypothesis claims. */\n readonly diff?: number;\n /** The population standard deviation. */\n readonly sd?: number;\n /** The sample size. */\n readonly n?: number;\n /** The significance level. */\n readonly alpha?: number;\n}\n\n/**\n * R's defaults from the `plot_t_test()` signature.\n *\n * These live here rather than in the plot layer so that the plot and\n * interactive layers read one set of numbers, and so that `tTestStats()` on\n * its own yields the classroom demo, matching R's no-argument behavior.\n */\nexport const DEFAULT_T_TEST_OPTIONS = {\n diff: 0.5,\n sd: 4,\n n: 100,\n alpha: 0.05,\n} as const;\n\n/**\n * A span of the x axis to shade under a curve.\n *\n * `from` can be −Infinity. Once the difference is large enough, beta\n * underflows to exactly 0 and the shading starts at the quantile for 0, which\n * is unbounded — the whole alternative curve lies in the rejection region.\n * About one in thirty of the slider settings reaches this. The value is\n * honest and the plot layer must clamp it to the drawing window; R instead\n * hands the infinity to `seq()` and stops with an error, so this is one place\n * the port has to do better rather than follow.\n */\nexport interface FillRange {\n /** Where the shading starts. May be −Infinity; see above. */\n readonly from: number;\n /** Where the shading stops. R runs every fill out to the 0.999 quantile. */\n readonly to: number;\n}\n\n/**\n * The four cells of the error matrix, and which row R rings.\n *\n * The numbers here are raw. R prints two of the four through `round(x, 2)`\n * and the other two untouched: `plot_error_matrix()` writes `alpha` and\n * `1 - alpha` as they are, but `round(alt_stats[2], 2)` and\n * `round(alt_stats[1], 2)` for the power and beta cells. That asymmetry is\n * R's own. Rounding is a display concern, so it belongs to the plot layer;\n * this type carries full precision and lets the drawing decide.\n */\nexport interface TTestErrorMatrix {\n /** Top left: rejecting a true null. This is alpha. */\n readonly typeOne: number;\n /** Top right: rejecting a false null. This is the power. */\n readonly correctReject: number;\n /** Bottom left: keeping a true null. This is 1 − alpha. */\n readonly correctFailToReject: number;\n /** Bottom right: keeping a false null. This is beta. */\n readonly typeTwo: number;\n /**\n * Whether R rings the top row rather than the bottom one.\n *\n * R's test is `alt_stats[3] < alt_stats[4]`: the point where the alternative\n * fill begins, against the alternative's median. The fill begins at the\n * critical value, so this asks whether the critical value sits below the\n * median — that is, whether the test is more likely than not to reject. When\n * it is, the top row is the likely outcome and gets the ring.\n */\n readonly highlightTopRow: boolean;\n}\n\n/** Everything `plot_t_test()` derives before it draws anything. */\nexport interface TTestStats {\n /** The difference the statistics were computed from. */\n readonly diff: number;\n /** The standard deviation they were computed from. */\n readonly sd: number;\n /** The sample size they were computed from. */\n readonly n: number;\n /** The significance level they were computed from. */\n readonly alpha: number;\n /** Degrees of freedom, n − 1. */\n readonly df: number;\n /**\n * The t statistic, `diff / (sd / √n)`.\n *\n * This doubles as the non-centrality of the alternative distribution, which\n * is what makes the two curves in the picture the same shape shifted.\n */\n readonly t: number;\n /** Where the null distribution starts rejecting, `qt(1 − alpha, df)`. */\n readonly criticalValue: number;\n /** The chance of keeping a false null: the alternative below the critical value. */\n readonly beta: number;\n /** The chance of rejecting a false null, 1 − beta. */\n readonly power: number;\n /** The alternative distribution's midpoint, `qt(0.5, df, ncp)`. */\n readonly altMedian: number;\n /** The height of the alternative curve at its midpoint. */\n readonly altMedianDensity: number;\n /**\n * The shaded span under the alternative curve, the power.\n *\n * `from` is R's `alt_stats[3]`, `qt(beta, df, ncp)`. That inverts the beta\n * it was just built from, so it lands back on the critical value — but only\n * as closely as the two routines invert each other, which is why R's own\n * numbers differ in the last digits from `criticalValue`.\n */\n readonly altFill: FillRange;\n /**\n * The shaded span under the null curve, the significance level.\n *\n * `from` is the critical value, by the same expression.\n */\n readonly nullFill: FillRange;\n /** The four cells R draws beside the curves. */\n readonly errorMatrix: TTestErrorMatrix;\n}\n\n/** How far out R runs a fill. Both tails stop at the same quantile. */\nconst FILL_UPPER_QUANTILE = 0.999;\n\n/**\n * Work out everything the picture needs from the four test parameters.\n *\n * A missing option takes R's default, so calling this with nothing yields the\n * same demo `plot_t_test()` does. Nothing is validated: a sample size of 1\n * leaves no degrees of freedom and the quantiles come back as NaN, which is\n * what R does too.\n *\n * @param options The test parameters. Any left out take R's defaults.\n * @returns The derived quantities. No drawing, no state.\n */\nexport function tTestStats(options: TTestOptions = {}): TTestStats {\n const { diff, sd, n, alpha } = { ...DEFAULT_T_TEST_OPTIONS, ...options };\n\n const df = n - 1;\n const t = diff / (sd / Math.sqrt(n));\n\n // The critical value belongs to the null curve, but beta measures the\n // alternative's mass below it. That shared point is what ties the picture\n // together.\n const criticalValue = qt(1 - alpha, df);\n const beta = pt(criticalValue, df, t);\n const power = 1 - beta;\n\n const altMedian = qt(0.5, df, t);\n\n // Where the alternative fill starts. R reads this back out of beta rather\n // than reusing the critical value, and uses the same number again for the\n // highlight test, so it is computed once here and shared.\n const altFillFrom = qt(beta, df, t);\n\n return {\n diff,\n sd,\n n,\n alpha,\n df,\n t,\n criticalValue,\n beta,\n power,\n altMedian,\n altMedianDensity: dt(altMedian, df, t),\n altFill: {\n from: altFillFrom,\n to: qt(FILL_UPPER_QUANTILE, df, t),\n },\n nullFill: {\n from: criticalValue,\n to: qt(FILL_UPPER_QUANTILE, df),\n },\n errorMatrix: {\n typeOne: alpha,\n correctReject: power,\n correctFailToReject: 1 - alpha,\n typeTwo: beta,\n highlightTopRow: altFillFrom < altMedian,\n },\n };\n}\n",
|
|
22
|
-
"/**\n * The `moderation_data` dataset of the R package.\n *\n * Two hundred rows of a moderated relationship, used as the default data of\n * `plot_moderation_3d()` and `plot_scatter3d()` so that both work with no\n * arguments. R's `data.R` records the recipe: `x`, `z` and `w` are drawn\n * independently from a normal distribution with standard deviation 2, and\n *\n * ```text\n * y = 0.5 x + 0.3 z + 0.8 x z + N(0, 1)\n * ```\n *\n * so the effect of `x` on `y` grows with `z` — the interaction the surface\n * shows as a twist. Column `w` enters no equation: it is noise, and it is\n * there so an example can carry a control variable that means nothing.\n *\n * The values below are the exact doubles of the R data file\n * (`../compstatslib/data/moderation_data.rda`), printed at 17 significant\n * digits, which round-trips an IEEE-754 double. **Exported from R, never\n * regenerated** — the draw used `set.seed(42)` under R's own generator, so a\n * JavaScript regeneration would produce different numbers and silently change\n * every default demo. Source of the printed values:\n * `.claude/plans/moderation-data.tsv`, checked against the column checksums of\n * `.claude/plans/moderation-fixtures.md` in `moderationData.test.ts`.\n *\n * The columns are in the order of the R data frame — `y, x, z, w`, not\n * alphabetical and not `x, y, z`. That order is load-bearing: `plot_scatter3d()`\n * with no axis arguments takes the first three numeric columns, which is why\n * its default plot puts `y` on the horizontal axis.\n */\n\n/** The four columns of the R `moderation_data` data frame. */\nexport type ModerationData = {\n readonly y: readonly number[];\n readonly x: readonly number[];\n readonly z: readonly number[];\n readonly w: readonly number[];\n};\n\n/** The 200 rows of the R `moderation_data` data frame, in file order. */\nexport const moderationData: ModerationData = {\n y: [\n -7.2728972000711964, -1.8368504105536234,\n 2.4825030269210964, 6.0885502472158235,\n -2.7813932586215913, -1.4045477434849749,\n -2.3283702256411951, 0.24770227680217238,\n -1.0630104614416778, -2.0458910688111343,\n -5.1341052959159876, 18.102464141094789,\n -3.4663420296290077, -1.0047522093312424,\n -0.82474666408975483, 0.011971257899126564,\n -2.4321918294924254, -14.110628278307653,\n -1.5077118301445713, -3.3519580636316557,\n 0.34228397854096548, -1.4420566151665186,\n -0.09954101599791107, -4.1717572290618348,\n 5.638370200339164, -0.24209932633994577,\n -0.92942202986679767, -0.14306775813444911,\n -0.75191873199673909, -2.6149345603765624,\n 1.9162030995224288, 2.882308922335612,\n -4.1366719661768885, -1.5262757249783787,\n -0.13241561132928859, 1.0868995782488633,\n -5.4322398208224598, -1.0526454319438507,\n -5.3360807036936473, 0.80370589439224283,\n 0.64566701092436662, -0.58086531051744095,\n 5.9958208137315907, -3.748881331929856,\n 4.7991068639205681, 3.9170147432586608,\n -2.5205797162580499, 1.0052100508228277,\n -1.2592451123609627, -1.4191054380364576,\n -2.7688068774363885, -1.1283556266006958,\n -5.0155719117359876, 0.74436508929657408,\n 1.3457889732609731, -1.5775936354323048,\n 0.24940175331052905, 0.84534536563058338,\n 9.1086395504851989, -1.0895764398669741,\n -0.054834750835499602, 3.4396743692990768,\n 1.82777129315956, -9.0876817903961307,\n -1.6403441299936004, 6.3441120121592336,\n 3.0068415808329494, 1.0402916701960967,\n -10.792485667257104, 0.19774249672127087,\n -2.6230964327485333, -1.5340564759379902,\n 1.7265739813235901, -4.4727441322331023,\n 0.051358701883551766, 3.4112581498484817,\n 1.7155585583877218, -2.4096746494084527,\n -3.6580899543881662, -4.2196299413161089,\n 5.7706115536478979, -4.0368554837030199,\n -1.8534915424952012, -1.4551065653571458,\n -0.57333130613680428, 1.2587331393918402,\n -0.18074955316901531, -1.7541060455623132,\n -7.1816739672594787, 2.2681715762809351,\n -2.2618552849857134, -1.0033432551835315,\n -1.5998101004488254, 13.776336779706227,\n -1.3601934670356379, 0.84377053596043516,\n 0.26923062515768637, -6.1587204803542566,\n 0.28455942391067712, -3.7313390977173673,\n 2.209575611277963, 4.9573155152467479,\n -1.1074416328100625, 6.773590899689121,\n -1.1622855609602678, -0.1468882418607233,\n -1.8138297100034615, -0.88229772478568436,\n -2.5310587963205209, 0.92250684930151283,\n 1.0529999297345707, -1.0226841183124429,\n -0.62826191336833026, 0.047095104558446066,\n -2.1862971987559754, 1.9185432668727294,\n -1.4157898788687031, 3.8559400012867275,\n 4.8196910254616006, 1.1859049624611124,\n 2.1292032810255828, -2.5804694939165822,\n 0.7806460650847441, -0.77177474486716457,\n 4.3023231287427057, 1.1280497997890846,\n -3.3823450205179935, -2.8141768087650334,\n 1.9176969652481777, -1.8022438527307034,\n 0.56769922608595746, -1.1988798479187797,\n -0.81127142895301252, 3.0023694027723717,\n 6.3138141892914694, -0.72091317245731745,\n -0.49342129711845351, -5.3116450695380282,\n 1.5864321371634191, -1.3767448543412033,\n -0.32149297043332475, -2.7378068772633672,\n 0.44512957644982276, 1.0144155909083761,\n -0.33982995595512711, 3.6424411700938926,\n -0.80484964968788497, 0.26491344714041165,\n 1.0255159271802998, -3.4431481857611512,\n -1.2617728430815081, 2.4072718264535986,\n 4.1858481441966102, 0.84449896500128463,\n 0.68906644248057036, -4.9301730292087731,\n 1.3181686730513686, -3.9504745741065488,\n 0.69966539975680719, -7.7331713344467277,\n 0.37966613312994063, 2.0980485157760418,\n 0.58696762292169558, -0.095335203753901337,\n -1.3602473690753563, -1.8363341184552933,\n -5.3271971097587407, -2.4667878836756927,\n -0.84771180433706672, 1.794347325600735,\n -1.1215052328640052, 0.96938089278474238,\n -8.8525095689727635, -10.171192748327044,\n 5.5154793606449468, 0.81334743443491231,\n 1.5442257490953633, -2.3028072866769134,\n 0.68983698216899647, 1.9915198521027817,\n 2.8322478461703762, 0.34764862749885805,\n -0.50342712629907482, 1.1733004427545144,\n 0.18449984894824215, -1.9938893833160367,\n 0.8829064829548916, 0.62667972173052222,\n -3.9311936779928676, -4.6930573223273164,\n 0.5942425542793619, -0.040913228103484439,\n 1.5529759191506414, 0.52558975177612277,\n -0.51812524140199456, 5.7138238288601553,\n 0.80645695222572478, 2.7208395005315182,\n -1.9931388422548042, 2.0982441518090775,\n ],\n x: [\n 2.741916894293337, -1.1293963427921776,\n 0.72625682267467828, 1.265725209922081,\n 0.80853664628199817, -0.21224903218296798,\n 3.0230439948778778, -0.18931807682619511,\n 4.0368474277540827, -0.12542819810484199,\n 2.6097393084469704, 4.5732907854022136,\n -2.7777214022246786, -0.55757753363474283,\n -0.26664267278731602, 1.2719007961401489,\n -0.56850584283214478, -5.3129108418095523,\n -4.8809338571510379, 2.6402266914603838,\n -0.6132771881569492, -3.562616867960001,\n -0.34383471151924272, 2.4293493983451979,\n 3.7903869225299305, -0.86093826321239919,\n -0.51453876553785927, -3.5263261703895603,\n 0.9201947096625428, -1.2799897519202386,\n 0.91090024648243872, 1.4096746744576383,\n 2.0702070439398446, -1.2178527508144228,\n 1.0099102465959404, -3.434017358146686,\n -1.5689180167589927, -1.7018151883530368,\n -4.8284152998932646, 0.07224521378451125,\n 0.41199720040050775, -0.72211459709733239,\n 1.5163264713990341, -1.4534096541531503,\n -2.7365620888385891, 0.86563605177743408,\n -1.6227863523733432, 2.8882025234425055,\n -0.86289240522669086, 1.3112957668044132,\n 0.64385053040789308, -1.5676778817607508,\n 3.1514550395839547, 1.2857986114346329,\n 0.17952129319921128, 0.5531014945829259,\n 1.3585776321105416, 0.17966577315816343,\n -5.9861801663058696, 0.5697659070613188,\n -0.73446928548195067, 0.3704611297312187,\n 1.1636474547310138, 2.799473654585356,\n -1.4545841189489299, 2.6050852640882871,\n 0.67169623950414881, 2.0770121973952422,\n 1.8414571365812926, 1.4417563257337251,\n -2.08623787713571, -0.18037277322141337,\n 1.2470363239990871, -1.907046715544688,\n -1.0856576291477136, 1.1619929953633648,\n 1.536357475669182, 0.92753517708033439,\n -1.7715525948193589, -2.1995617972957109,\n 3.025414019609856, 0.51584287506406168,\n 0.17688045831917268, -0.24179307507817885,\n -2.3886577903210564, 1.2239937960807739,\n -0.43427969149304169, -0.36551341266384341,\n 1.8666926571423201, 1.6435462210164979,\n 2.7842327518685419, -0.95234784610934875,\n 1.3006971214526097, 2.7822209127800015,\n -2.2215777588957977, -1.7215851737556847,\n -2.2634773617075399, -2.9184279990047917,\n 0.15996510648232234, 1.30640867929838,\n 2.4019307511969883, 2.0895021743354505,\n -2.006417293679696, 3.696963803345493,\n -1.3335468175156342, 0.21102762491213886,\n -0.84451176373771208, -0.24470034390994258,\n 0.37638606900299576, 0.23832191599401276,\n -0.050185101734805754, 0.2161454558840652,\n -0.9708704716933354, -1.0084342613758068,\n -3.322198159829624, -0.76466745374763623,\n -1.025300515755601, 5.4037820006895947,\n -2.7242324623794376, 0.27451243711721379,\n -2.987250134632581, -2.9408714828735931,\n 0.2494047723940136, -1.9932782697680742,\n -0.0036452286094163897, -0.85651776285163062,\n -1.2273432128989903, -4.0493556908382153,\n -2.4494959007199721, 0.35903288223587582,\n 1.1352411888470701, -0.98575470710694957,\n 0.00012576813070224816, 2.2457792867599329,\n 2.87971148595238, -2.1942275368116433,\n -0.23463912050035363, 2.4029968018394023,\n -0.93945916113260175, -0.10493896987799263,\n -0.17221459647417905, -1.7753580358128629,\n -0.88936800976947616, -0.058889758176476292,\n -0.82773769811584708, 2.2267720467364067,\n -0.96198568330796386, -0.86633806520145806,\n 1.3937251531042052, -2.1127368263418163,\n -0.081396950302429855, -3.1030896446951792,\n 2.3343390984713639, -0.54729140274816135,\n -0.93569064934450719, -2.4765046559724295,\n -0.015524067554653256, -1.6005643559033189,\n -1.066984659900873, 2.5753504911691776,\n -0.35105174048425475, -2.1435647683013519,\n 0.32641376493476459, -0.72547683125589957,\n 1.1800270959746773, 2.8648438554619791,\n -1.9853850222189862, 0.90930059516056516,\n 0.16979611735697459, 1.7911311645290895,\n -0.45955627789253306, 1.6732381369212268,\n -3.4901117226733867, 3.378917842626747,\n 1.7295559570371559, -0.30155197777149562,\n -2.8980142602783352, 1.2860174000839635,\n 0.96638772762953518, -0.012711252842777425,\n 0.30291178572484884, -1.1682179406996087,\n 0.73761346526048421, 0.5893086794390312,\n -0.55851874668515011, -2.6724733097863078,\n 1.4014976368800685, 1.1083932445480671,\n -1.6726131856028299, -3.189176324012486,\n 0.40991716117526766, -0.69017595594577974,\n 0.50522340672890931, -2.5880049309691064,\n -1.9183408887607261, 2.1715497073598016,\n 0.80754980943142785, 1.1729750734385955,\n 3.6304568923079059, 0.25764285720476621,\n ],\n z: [\n -4.0018584754630222, 0.66755439486714041,\n 2.3426502547175891, 4.1190784845986084,\n -2.7537231964810425, -2.3017111312542111,\n -1.4116427895202421, -2.1081115641543828,\n -1.2914874462849828, -0.37075593535300683,\n -2.4024441014799702, 4.0739443339663,\n 0.21554948977109339, -0.16821620101116128,\n 0.99123928320918786, 0.074830372235930684,\n -0.2641760739118198, 2.9535748471041936,\n -0.43406042018420693, -2.5672044081844505,\n 0.77133578088680466, -0.70302574705818488,\n -1.0435921867125384, -2.1362624013743408,\n 0.85673180653338499, -0.34803646885398981,\n 1.0313354572960587, -0.46873055461184299,\n -1.3170068516435418, 2.500473208157433,\n -0.54352743022279359, 1.8959039917503921,\n -2.4031648602178755, -0.93223219275100444,\n -0.53870279030635992, -0.78193081626172145,\n 2.697414023983427, -0.04552940259682519,\n 0.48845170220690071, -1.8847434157278455,\n -1.4584345530191491, 1.9961378171096964,\n 2.5169633291911206, 2.4977273776201918,\n -2.7612740990506603, 4.0999213872727882,\n 2.0337456595990835, -0.053434928276515886,\n 1.4072155575965211, -1.9427704583037273,\n -2.1923124831177145, 0.098100901875194116,\n -2.3969917131155598, 0.38003799711949598,\n 2.5954117992093324, -2.067747445929502,\n -1.4768815084261278, 0.093127878901726704,\n -2.0351922396522117, -0.76656791977255634,\n 1.7455108233427969, 1.9390900279402341,\n 0.76769333005418883, -3.7031113261349291,\n -0.10799347365233136, 2.1295464286765675,\n 1.6263900748232101, -0.38163294820856347,\n -5.3998596171274054, 0.1219332776022331,\n 1.1475033949671558, 0.091607159450197734,\n 0.31482508035175089, 0.86313074573754156,\n -0.79309947210042442, 2.6199564515030986,\n 0.94078679974788604, -2.4853405411492027,\n 2.7631509127710658, 2.4089178740196484,\n 1.648147927363762, -3.3252588043711886,\n -1.1386126872109616, 1.2710276345790525,\n 0.087444015155715843, 0.69602460732261417,\n 4.9191870977408296, -1.6367606487993389,\n -4.2264002298582737, 0.54739054486082928,\n -1.3751936824868236, 0.89208210592373138,\n -1.6247694475811947, 4.424110960670272,\n -0.24741194315485965, -0.95467101206010463,\n -0.33252298297321642, 1.7251267672528618,\n 0.19468097040563787, -3.2512334784225763,\n -0.00924153565291559, 1.5204843353241098,\n 0.077981825745125244, 1.4701442832288814,\n -0.29294525399773952, -0.11577467076256517,\n 0.96473893220906526, 1.9858872735514685,\n -2.4927909960640844, -0.066975049691219368,\n -0.1419243624999926, -1.517841307461901,\n -2.0687187218783056, -1.2614639079416392,\n 1.1736154400259904, -0.83264531236730377,\n -1.5697756190106404, 0.32683263897219417,\n -2.4734284702186993, 2.0917475524733429,\n -0.96919083243741866, 0.37825762336133084,\n 0.10201266314994641, -0.00048133777288395359,\n 3.6187640848857319, -1.6506559142198896,\n 2.2909409044559705, 0.063146375106486144,\n -1.6704116106134392, -0.13752729803302502,\n 1.4935433740249338, -0.85103746878920816,\n -1.5441644703869135, 0.30552821349578935,\n 1.977193690357598, -0.14691666934434808,\n -2.7740531071194838, -2.6133518087507257,\n -1.5367906501558772, -1.0542162507489161,\n -0.042854130083249252, 1.3409961419925638,\n -0.86923407714481304, -2.2277595666256937,\n 1.2142119897569996, 0.5509139374791826,\n 2.3146941388294735, -3.3649617189565113,\n 0.17463817778974872, 2.7067237878853372,\n 1.4483476013667382, -1.665105651528423,\n 1.4650569735368288, -1.7438537399944254,\n -0.90679502245958543, 2.3750685572581554,\n -0.58029062358015848, 1.6570922899308729,\n -0.58245541755833752, -3.1527248094958122,\n -1.6976313938978438, -2.1770397239143895,\n -0.96858114223434699, -0.67262241801914557,\n -0.30671578132328758, -0.48649445714969192,\n 3.784404083200223, -2.7719966745708398,\n -0.82964860141556074, 0.69816305621366226,\n 3.256884531630813, 0.17704379142723264,\n 2.4783014168011261, -3.2891110715074134,\n 2.8927130507569592, -1.3811203433303656,\n -0.55286217090770406, -2.2188375197988743,\n 0.26773863285890354, 3.5706781034631039,\n 4.8443267105031795, -2.1536578042368233,\n 0.97188222080619802, 2.7770434774885837,\n -0.3913136345690878, -0.43634959541242196,\n -0.60955590909289048, 1.1956654482228859,\n 2.7948588216315193, 1.3752395224799268,\n 0.64037602859393727, -0.60373985155452159,\n 0.99669737111589907, -1.0990738358335126,\n -0.55851300727448538, 2.1930268862234645,\n 0.88402617635762248, 0.48203258805222476,\n -0.51121531071103665, 1.8620658029697648,\n ],\n w: [\n -0.49696586637986573, 0.84464077166478657,\n 1.9753065872793472, 1.6711363440700464,\n -1.321043718091411, 3.1281389865836706,\n -3.2459518705830939, 1.7277927469579759,\n -1.0232055468724002, -3.8347300508908027,\n -3.731627697239897, 0.4903581268793773,\n 4.447068603816132, 0.54675212828893049,\n 2.261569589056565, 1.6773387481201982,\n -1.3092305557564106, 1.9079219569587911,\n 0.70590293097864509, 0.41319858529922687,\n 2.0022264686204969, 1.4949039832805529,\n -1.2531496734462773, 0.79044737187342806,\n -1.7843359080911552, 1.2616368201835455,\n -0.86541036656913495, 0.90427728843703359,\n 0.73599809039269093, -0.54077497932381824,\n 0.9310252354259575, 1.1487124512539382,\n -0.46139998031482182, 2.3444850166049025,\n 2.7854054134662434, -1.3239825114191694,\n -1.5547384134500284, 1.0270771578175601,\n -1.8266244760825443, -0.89884761050060125,\n 1.6058653982072366, -1.1469537019622078,\n -3.8562503356966524, 1.3287816676442965,\n -3.205080447588506, -2.7092005149076992,\n -6.0358653588357924, 1.6624756444601259,\n 0.50219417769468799, 0.92458693188265906,\n 1.6895844464464735, -0.083943048643124199,\n -2.2111518114000552, 1.1275513046617478,\n 2.6067295116393412, -3.0004418755893147,\n -1.2139784702380723, -0.58449013131315453,\n -2.579366686647206, 1.3882116975493977,\n -1.1983638057942381, 2.5138132879432744,\n 0.10701602725472605, 1.4561850353437049,\n 3.1221961364212145, 0.53124950719437969,\n 2.1534525184145346, 0.42139586335849089,\n -3.0233470516447363, 0.044804519827250026,\n 1.4362724120842063, 0.97891403568453961,\n -0.34777669175653925, -2.435398977336801,\n 1.292796737418924, -1.8329120566957797,\n -2.5036468848511326, 1.1898554368110026,\n -2.465621330379653, 0.48872882981227517,\n 0.005544370687190118, -2.65641937205113,\n 2.3593928236655501, -1.1856099982978574,\n 2.3999566326733439, -0.95006735922426966,\n -1.1501141923016327, -0.062452049216998061,\n -0.71611399195691117, -0.7132021552954626,\n -1.7553287668674522, -2.4257942503559256,\n 1.2265732373740676, -1.6124066829249548,\n -2.7529138598177902, -1.0156957983270942,\n -1.6018709734746754, -4.3855713713401352,\n -0.58187429853534967, 0.33434824232103538,\n 0.5893847129713754, 0.7854825308414517,\n -2.0016874260016304, -0.65145423964686777,\n -2.0166976108576851, -1.2708629640675322,\n -2.4196813759746849, -2.2329276013053807,\n 1.2597623251518704, -0.54504314035725121,\n -0.5176823367573421, 3.4591163597829868,\n -0.11678433081474329, -1.0741275692178371,\n 1.4945733923314797, -0.97451567077946588,\n 2.7458155629590104, -0.75534472129244146,\n -1.2323052282367883, -2.3362501021493713,\n 0.65728071718217163, 2.9330212548803298,\n -0.71201909017782516, 0.5229352837548622,\n 0.66665771035146226, 2.8443864806190855,\n 1.3277532013323454, -2.1473103113906209,\n -1.3938035493334802, -1.4922609138691223,\n 0.28314574426443873, -0.0078944414613061446,\n 0.73587500218353108, -1.3146858293944941,\n -0.75269334032210411, 1.4827201208501692,\n -0.19921351289694036, -1.3085797572141897,\n 1.942328748122542, 0.02699262313677293,\n -1.8330693340430899, 3.4193771225232736,\n -2.3362019798933114, -3.5620725203050472,\n -4.5062648971364343, 1.3022519390933986,\n -1.0656652512055347, -0.55111871394456635,\n 0.57925394525809126, -0.93296812358152814,\n -3.2161203498893749, -3.8995675920839759,\n -0.68139983646196156, 0.3494510546626397,\n -4.5555551215544581, 0.58104896189416777,\n 0.84461271494722856, 2.5894747264134295,\n 0.32942803714790875, 0.40990768160047042,\n 1.2092072534516118, -0.038281538337862839,\n -0.15942869475761728, 0.2319689288056091,\n 1.4883467280967757, -0.86258120705538532,\n -0.99905790382246884, -1.7303241535114227,\n -1.915514566543747, 0.65359994267727539,\n 3.0947444513703499, -1.9377191377288612,\n -0.37688085251892567, -2.0600023229118372,\n 1.8161728837209921, -0.63476372941625703,\n 0.35800793308084394, 0.6960563754583543,\n -2.1085580425488804, -0.20948857622140291,\n -0.45668523418905876, 1.3507111248550778,\n -2.4664893870126186, -2.3999230888455583,\n 1.5317331532322156, -1.1761957225659538,\n -1.3205916599511518, 0.22602704439468746,\n -0.64079759937207748, 3.7327629938775755,\n 0.51906291153559747, 0.32312014183613985,\n 1.8621498186707084, -0.11989349851924225,\n 0.097479400154900323, -2.1457508014679263,\n -4.5859428609613451, -2.4144137001286841,\n 0.22821885959438232, -2.0665941582107541,\n ],\n};\n",
|
|
23
|
-
"/**\n * The `pca_degenerate` dataset of the R package.\n *\n * A small two-column dataset that shows a degenerate PCA case: the two\n * components carry almost the same variance (sdev 17.86 and 17.41), so the\n * principal axes are barely distinguishable and the arrows of `plot_pca()`\n * come out nearly the same length in nearly perpendicular directions.\n *\n * The 16 rows below are the exact doubles of the R data file\n * (`../compstatslib/data/pca_degenerate.rda`), printed at 17 significant\n * digits, which round-trips an IEEE-754 double. **Exported from R, never\n * regenerated** — a JavaScript regeneration would silently change the demo.\n * Source of the printed values: `.claude/plans/pca-fixtures.md`, section F1.\n */\n\nimport type { Point } from \"../core/regression\";\n\n/** The 16 rows of the R `pca_degenerate` data frame, in file order. */\nexport const pcaDegenerate: readonly Point[] = [\n { x: 0.054881767057370599, y: 34.740158547326999 },\n { x: 0.054881767057370599, y: 24.678501253472401 },\n { x: 0.054881767057370599, y: 10.0433633715021 },\n { x: -0.49393590351651601, y: -0.56711159292636404 },\n { x: -0.128057456467252, y: -10.0799512162071 },\n { x: 1.8842740023036699, y: -16.665763263093702 },\n { x: -40.7405650789349, y: -17.763398604241502 },\n { x: -22.812521173521201, y: -17.214580933667602 },\n { x: -7.4456263974523997, y: -16.848702486618301 },\n { x: 7.7383291550917903, y: -16.482824039569099 },\n { x: 22.373467037062099, y: -15.934006368995201 },\n { x: 38.472118707229498, y: -15.7510671454706 },\n { x: 14.872958872552299, y: -16.2998848160445 },\n { x: 0.237820990582013, y: 18.641506877159699 },\n { x: -1.0427535740903999, y: -18.312216274815398 },\n { x: -12.019106985568101, y: -16.848702486618301 },\n];\n",
|
|
28
|
+
"/**\n * The `moderation_data` dataset of the R package.\n *\n * Two hundred rows of a moderated relationship, used as the default data of\n * `plot_moderation_3d()` and `plot_scatter3d()` so that both work with no\n * arguments. R's `data.R` records the recipe: `x`, `z` and `w` are drawn\n * independently from a normal distribution with standard deviation 2, and\n *\n * ```text\n * y = 0.5 x + 0.3 z + 0.8 x z + N(0, 1)\n * ```\n *\n * so the effect of `x` on `y` grows with `z` — the interaction the surface\n * shows as a twist. Column `w` enters no equation: it is noise, and it is\n * there so an example can carry a control variable that means nothing.\n *\n * The values below are the exact doubles of the R data file\n * (`../compstatslib/data/moderation_data.rda`), printed at 17 significant\n * digits, which round-trips an IEEE-754 double. **Exported from R, never\n * regenerated** — the draw used `set.seed(42)` under R's own generator, so a\n * JavaScript regeneration would produce different numbers and silently change\n * every default demo. Source of the printed values:\n * `.claude/plans/001-PLAN-port/moderation-data.tsv`, checked against the column checksums of\n * `.claude/plans/001-PLAN-port/moderation-fixtures.md` in `moderationData.test.ts`.\n *\n * The columns are in the order of the R data frame — `y, x, z, w`, not\n * alphabetical and not `x, y, z`. That order is load-bearing: `plot_scatter3d()`\n * with no axis arguments takes the first three numeric columns, which is why\n * its default plot puts `y` on the horizontal axis.\n */\n\n/** The four columns of the R `moderation_data` data frame. */\nexport type ModerationData = {\n readonly y: readonly number[];\n readonly x: readonly number[];\n readonly z: readonly number[];\n readonly w: readonly number[];\n};\n\n/** The 200 rows of the R `moderation_data` data frame, in file order. */\nexport const moderationData: ModerationData = {\n y: [\n -7.2728972000711964, -1.8368504105536234,\n 2.4825030269210964, 6.0885502472158235,\n -2.7813932586215913, -1.4045477434849749,\n -2.3283702256411951, 0.24770227680217238,\n -1.0630104614416778, -2.0458910688111343,\n -5.1341052959159876, 18.102464141094789,\n -3.4663420296290077, -1.0047522093312424,\n -0.82474666408975483, 0.011971257899126564,\n -2.4321918294924254, -14.110628278307653,\n -1.5077118301445713, -3.3519580636316557,\n 0.34228397854096548, -1.4420566151665186,\n -0.09954101599791107, -4.1717572290618348,\n 5.638370200339164, -0.24209932633994577,\n -0.92942202986679767, -0.14306775813444911,\n -0.75191873199673909, -2.6149345603765624,\n 1.9162030995224288, 2.882308922335612,\n -4.1366719661768885, -1.5262757249783787,\n -0.13241561132928859, 1.0868995782488633,\n -5.4322398208224598, -1.0526454319438507,\n -5.3360807036936473, 0.80370589439224283,\n 0.64566701092436662, -0.58086531051744095,\n 5.9958208137315907, -3.748881331929856,\n 4.7991068639205681, 3.9170147432586608,\n -2.5205797162580499, 1.0052100508228277,\n -1.2592451123609627, -1.4191054380364576,\n -2.7688068774363885, -1.1283556266006958,\n -5.0155719117359876, 0.74436508929657408,\n 1.3457889732609731, -1.5775936354323048,\n 0.24940175331052905, 0.84534536563058338,\n 9.1086395504851989, -1.0895764398669741,\n -0.054834750835499602, 3.4396743692990768,\n 1.82777129315956, -9.0876817903961307,\n -1.6403441299936004, 6.3441120121592336,\n 3.0068415808329494, 1.0402916701960967,\n -10.792485667257104, 0.19774249672127087,\n -2.6230964327485333, -1.5340564759379902,\n 1.7265739813235901, -4.4727441322331023,\n 0.051358701883551766, 3.4112581498484817,\n 1.7155585583877218, -2.4096746494084527,\n -3.6580899543881662, -4.2196299413161089,\n 5.7706115536478979, -4.0368554837030199,\n -1.8534915424952012, -1.4551065653571458,\n -0.57333130613680428, 1.2587331393918402,\n -0.18074955316901531, -1.7541060455623132,\n -7.1816739672594787, 2.2681715762809351,\n -2.2618552849857134, -1.0033432551835315,\n -1.5998101004488254, 13.776336779706227,\n -1.3601934670356379, 0.84377053596043516,\n 0.26923062515768637, -6.1587204803542566,\n 0.28455942391067712, -3.7313390977173673,\n 2.209575611277963, 4.9573155152467479,\n -1.1074416328100625, 6.773590899689121,\n -1.1622855609602678, -0.1468882418607233,\n -1.8138297100034615, -0.88229772478568436,\n -2.5310587963205209, 0.92250684930151283,\n 1.0529999297345707, -1.0226841183124429,\n -0.62826191336833026, 0.047095104558446066,\n -2.1862971987559754, 1.9185432668727294,\n -1.4157898788687031, 3.8559400012867275,\n 4.8196910254616006, 1.1859049624611124,\n 2.1292032810255828, -2.5804694939165822,\n 0.7806460650847441, -0.77177474486716457,\n 4.3023231287427057, 1.1280497997890846,\n -3.3823450205179935, -2.8141768087650334,\n 1.9176969652481777, -1.8022438527307034,\n 0.56769922608595746, -1.1988798479187797,\n -0.81127142895301252, 3.0023694027723717,\n 6.3138141892914694, -0.72091317245731745,\n -0.49342129711845351, -5.3116450695380282,\n 1.5864321371634191, -1.3767448543412033,\n -0.32149297043332475, -2.7378068772633672,\n 0.44512957644982276, 1.0144155909083761,\n -0.33982995595512711, 3.6424411700938926,\n -0.80484964968788497, 0.26491344714041165,\n 1.0255159271802998, -3.4431481857611512,\n -1.2617728430815081, 2.4072718264535986,\n 4.1858481441966102, 0.84449896500128463,\n 0.68906644248057036, -4.9301730292087731,\n 1.3181686730513686, -3.9504745741065488,\n 0.69966539975680719, -7.7331713344467277,\n 0.37966613312994063, 2.0980485157760418,\n 0.58696762292169558, -0.095335203753901337,\n -1.3602473690753563, -1.8363341184552933,\n -5.3271971097587407, -2.4667878836756927,\n -0.84771180433706672, 1.794347325600735,\n -1.1215052328640052, 0.96938089278474238,\n -8.8525095689727635, -10.171192748327044,\n 5.5154793606449468, 0.81334743443491231,\n 1.5442257490953633, -2.3028072866769134,\n 0.68983698216899647, 1.9915198521027817,\n 2.8322478461703762, 0.34764862749885805,\n -0.50342712629907482, 1.1733004427545144,\n 0.18449984894824215, -1.9938893833160367,\n 0.8829064829548916, 0.62667972173052222,\n -3.9311936779928676, -4.6930573223273164,\n 0.5942425542793619, -0.040913228103484439,\n 1.5529759191506414, 0.52558975177612277,\n -0.51812524140199456, 5.7138238288601553,\n 0.80645695222572478, 2.7208395005315182,\n -1.9931388422548042, 2.0982441518090775,\n ],\n x: [\n 2.741916894293337, -1.1293963427921776,\n 0.72625682267467828, 1.265725209922081,\n 0.80853664628199817, -0.21224903218296798,\n 3.0230439948778778, -0.18931807682619511,\n 4.0368474277540827, -0.12542819810484199,\n 2.6097393084469704, 4.5732907854022136,\n -2.7777214022246786, -0.55757753363474283,\n -0.26664267278731602, 1.2719007961401489,\n -0.56850584283214478, -5.3129108418095523,\n -4.8809338571510379, 2.6402266914603838,\n -0.6132771881569492, -3.562616867960001,\n -0.34383471151924272, 2.4293493983451979,\n 3.7903869225299305, -0.86093826321239919,\n -0.51453876553785927, -3.5263261703895603,\n 0.9201947096625428, -1.2799897519202386,\n 0.91090024648243872, 1.4096746744576383,\n 2.0702070439398446, -1.2178527508144228,\n 1.0099102465959404, -3.434017358146686,\n -1.5689180167589927, -1.7018151883530368,\n -4.8284152998932646, 0.07224521378451125,\n 0.41199720040050775, -0.72211459709733239,\n 1.5163264713990341, -1.4534096541531503,\n -2.7365620888385891, 0.86563605177743408,\n -1.6227863523733432, 2.8882025234425055,\n -0.86289240522669086, 1.3112957668044132,\n 0.64385053040789308, -1.5676778817607508,\n 3.1514550395839547, 1.2857986114346329,\n 0.17952129319921128, 0.5531014945829259,\n 1.3585776321105416, 0.17966577315816343,\n -5.9861801663058696, 0.5697659070613188,\n -0.73446928548195067, 0.3704611297312187,\n 1.1636474547310138, 2.799473654585356,\n -1.4545841189489299, 2.6050852640882871,\n 0.67169623950414881, 2.0770121973952422,\n 1.8414571365812926, 1.4417563257337251,\n -2.08623787713571, -0.18037277322141337,\n 1.2470363239990871, -1.907046715544688,\n -1.0856576291477136, 1.1619929953633648,\n 1.536357475669182, 0.92753517708033439,\n -1.7715525948193589, -2.1995617972957109,\n 3.025414019609856, 0.51584287506406168,\n 0.17688045831917268, -0.24179307507817885,\n -2.3886577903210564, 1.2239937960807739,\n -0.43427969149304169, -0.36551341266384341,\n 1.8666926571423201, 1.6435462210164979,\n 2.7842327518685419, -0.95234784610934875,\n 1.3006971214526097, 2.7822209127800015,\n -2.2215777588957977, -1.7215851737556847,\n -2.2634773617075399, -2.9184279990047917,\n 0.15996510648232234, 1.30640867929838,\n 2.4019307511969883, 2.0895021743354505,\n -2.006417293679696, 3.696963803345493,\n -1.3335468175156342, 0.21102762491213886,\n -0.84451176373771208, -0.24470034390994258,\n 0.37638606900299576, 0.23832191599401276,\n -0.050185101734805754, 0.2161454558840652,\n -0.9708704716933354, -1.0084342613758068,\n -3.322198159829624, -0.76466745374763623,\n -1.025300515755601, 5.4037820006895947,\n -2.7242324623794376, 0.27451243711721379,\n -2.987250134632581, -2.9408714828735931,\n 0.2494047723940136, -1.9932782697680742,\n -0.0036452286094163897, -0.85651776285163062,\n -1.2273432128989903, -4.0493556908382153,\n -2.4494959007199721, 0.35903288223587582,\n 1.1352411888470701, -0.98575470710694957,\n 0.00012576813070224816, 2.2457792867599329,\n 2.87971148595238, -2.1942275368116433,\n -0.23463912050035363, 2.4029968018394023,\n -0.93945916113260175, -0.10493896987799263,\n -0.17221459647417905, -1.7753580358128629,\n -0.88936800976947616, -0.058889758176476292,\n -0.82773769811584708, 2.2267720467364067,\n -0.96198568330796386, -0.86633806520145806,\n 1.3937251531042052, -2.1127368263418163,\n -0.081396950302429855, -3.1030896446951792,\n 2.3343390984713639, -0.54729140274816135,\n -0.93569064934450719, -2.4765046559724295,\n -0.015524067554653256, -1.6005643559033189,\n -1.066984659900873, 2.5753504911691776,\n -0.35105174048425475, -2.1435647683013519,\n 0.32641376493476459, -0.72547683125589957,\n 1.1800270959746773, 2.8648438554619791,\n -1.9853850222189862, 0.90930059516056516,\n 0.16979611735697459, 1.7911311645290895,\n -0.45955627789253306, 1.6732381369212268,\n -3.4901117226733867, 3.378917842626747,\n 1.7295559570371559, -0.30155197777149562,\n -2.8980142602783352, 1.2860174000839635,\n 0.96638772762953518, -0.012711252842777425,\n 0.30291178572484884, -1.1682179406996087,\n 0.73761346526048421, 0.5893086794390312,\n -0.55851874668515011, -2.6724733097863078,\n 1.4014976368800685, 1.1083932445480671,\n -1.6726131856028299, -3.189176324012486,\n 0.40991716117526766, -0.69017595594577974,\n 0.50522340672890931, -2.5880049309691064,\n -1.9183408887607261, 2.1715497073598016,\n 0.80754980943142785, 1.1729750734385955,\n 3.6304568923079059, 0.25764285720476621,\n ],\n z: [\n -4.0018584754630222, 0.66755439486714041,\n 2.3426502547175891, 4.1190784845986084,\n -2.7537231964810425, -2.3017111312542111,\n -1.4116427895202421, -2.1081115641543828,\n -1.2914874462849828, -0.37075593535300683,\n -2.4024441014799702, 4.0739443339663,\n 0.21554948977109339, -0.16821620101116128,\n 0.99123928320918786, 0.074830372235930684,\n -0.2641760739118198, 2.9535748471041936,\n -0.43406042018420693, -2.5672044081844505,\n 0.77133578088680466, -0.70302574705818488,\n -1.0435921867125384, -2.1362624013743408,\n 0.85673180653338499, -0.34803646885398981,\n 1.0313354572960587, -0.46873055461184299,\n -1.3170068516435418, 2.500473208157433,\n -0.54352743022279359, 1.8959039917503921,\n -2.4031648602178755, -0.93223219275100444,\n -0.53870279030635992, -0.78193081626172145,\n 2.697414023983427, -0.04552940259682519,\n 0.48845170220690071, -1.8847434157278455,\n -1.4584345530191491, 1.9961378171096964,\n 2.5169633291911206, 2.4977273776201918,\n -2.7612740990506603, 4.0999213872727882,\n 2.0337456595990835, -0.053434928276515886,\n 1.4072155575965211, -1.9427704583037273,\n -2.1923124831177145, 0.098100901875194116,\n -2.3969917131155598, 0.38003799711949598,\n 2.5954117992093324, -2.067747445929502,\n -1.4768815084261278, 0.093127878901726704,\n -2.0351922396522117, -0.76656791977255634,\n 1.7455108233427969, 1.9390900279402341,\n 0.76769333005418883, -3.7031113261349291,\n -0.10799347365233136, 2.1295464286765675,\n 1.6263900748232101, -0.38163294820856347,\n -5.3998596171274054, 0.1219332776022331,\n 1.1475033949671558, 0.091607159450197734,\n 0.31482508035175089, 0.86313074573754156,\n -0.79309947210042442, 2.6199564515030986,\n 0.94078679974788604, -2.4853405411492027,\n 2.7631509127710658, 2.4089178740196484,\n 1.648147927363762, -3.3252588043711886,\n -1.1386126872109616, 1.2710276345790525,\n 0.087444015155715843, 0.69602460732261417,\n 4.9191870977408296, -1.6367606487993389,\n -4.2264002298582737, 0.54739054486082928,\n -1.3751936824868236, 0.89208210592373138,\n -1.6247694475811947, 4.424110960670272,\n -0.24741194315485965, -0.95467101206010463,\n -0.33252298297321642, 1.7251267672528618,\n 0.19468097040563787, -3.2512334784225763,\n -0.00924153565291559, 1.5204843353241098,\n 0.077981825745125244, 1.4701442832288814,\n -0.29294525399773952, -0.11577467076256517,\n 0.96473893220906526, 1.9858872735514685,\n -2.4927909960640844, -0.066975049691219368,\n -0.1419243624999926, -1.517841307461901,\n -2.0687187218783056, -1.2614639079416392,\n 1.1736154400259904, -0.83264531236730377,\n -1.5697756190106404, 0.32683263897219417,\n -2.4734284702186993, 2.0917475524733429,\n -0.96919083243741866, 0.37825762336133084,\n 0.10201266314994641, -0.00048133777288395359,\n 3.6187640848857319, -1.6506559142198896,\n 2.2909409044559705, 0.063146375106486144,\n -1.6704116106134392, -0.13752729803302502,\n 1.4935433740249338, -0.85103746878920816,\n -1.5441644703869135, 0.30552821349578935,\n 1.977193690357598, -0.14691666934434808,\n -2.7740531071194838, -2.6133518087507257,\n -1.5367906501558772, -1.0542162507489161,\n -0.042854130083249252, 1.3409961419925638,\n -0.86923407714481304, -2.2277595666256937,\n 1.2142119897569996, 0.5509139374791826,\n 2.3146941388294735, -3.3649617189565113,\n 0.17463817778974872, 2.7067237878853372,\n 1.4483476013667382, -1.665105651528423,\n 1.4650569735368288, -1.7438537399944254,\n -0.90679502245958543, 2.3750685572581554,\n -0.58029062358015848, 1.6570922899308729,\n -0.58245541755833752, -3.1527248094958122,\n -1.6976313938978438, -2.1770397239143895,\n -0.96858114223434699, -0.67262241801914557,\n -0.30671578132328758, -0.48649445714969192,\n 3.784404083200223, -2.7719966745708398,\n -0.82964860141556074, 0.69816305621366226,\n 3.256884531630813, 0.17704379142723264,\n 2.4783014168011261, -3.2891110715074134,\n 2.8927130507569592, -1.3811203433303656,\n -0.55286217090770406, -2.2188375197988743,\n 0.26773863285890354, 3.5706781034631039,\n 4.8443267105031795, -2.1536578042368233,\n 0.97188222080619802, 2.7770434774885837,\n -0.3913136345690878, -0.43634959541242196,\n -0.60955590909289048, 1.1956654482228859,\n 2.7948588216315193, 1.3752395224799268,\n 0.64037602859393727, -0.60373985155452159,\n 0.99669737111589907, -1.0990738358335126,\n -0.55851300727448538, 2.1930268862234645,\n 0.88402617635762248, 0.48203258805222476,\n -0.51121531071103665, 1.8620658029697648,\n ],\n w: [\n -0.49696586637986573, 0.84464077166478657,\n 1.9753065872793472, 1.6711363440700464,\n -1.321043718091411, 3.1281389865836706,\n -3.2459518705830939, 1.7277927469579759,\n -1.0232055468724002, -3.8347300508908027,\n -3.731627697239897, 0.4903581268793773,\n 4.447068603816132, 0.54675212828893049,\n 2.261569589056565, 1.6773387481201982,\n -1.3092305557564106, 1.9079219569587911,\n 0.70590293097864509, 0.41319858529922687,\n 2.0022264686204969, 1.4949039832805529,\n -1.2531496734462773, 0.79044737187342806,\n -1.7843359080911552, 1.2616368201835455,\n -0.86541036656913495, 0.90427728843703359,\n 0.73599809039269093, -0.54077497932381824,\n 0.9310252354259575, 1.1487124512539382,\n -0.46139998031482182, 2.3444850166049025,\n 2.7854054134662434, -1.3239825114191694,\n -1.5547384134500284, 1.0270771578175601,\n -1.8266244760825443, -0.89884761050060125,\n 1.6058653982072366, -1.1469537019622078,\n -3.8562503356966524, 1.3287816676442965,\n -3.205080447588506, -2.7092005149076992,\n -6.0358653588357924, 1.6624756444601259,\n 0.50219417769468799, 0.92458693188265906,\n 1.6895844464464735, -0.083943048643124199,\n -2.2111518114000552, 1.1275513046617478,\n 2.6067295116393412, -3.0004418755893147,\n -1.2139784702380723, -0.58449013131315453,\n -2.579366686647206, 1.3882116975493977,\n -1.1983638057942381, 2.5138132879432744,\n 0.10701602725472605, 1.4561850353437049,\n 3.1221961364212145, 0.53124950719437969,\n 2.1534525184145346, 0.42139586335849089,\n -3.0233470516447363, 0.044804519827250026,\n 1.4362724120842063, 0.97891403568453961,\n -0.34777669175653925, -2.435398977336801,\n 1.292796737418924, -1.8329120566957797,\n -2.5036468848511326, 1.1898554368110026,\n -2.465621330379653, 0.48872882981227517,\n 0.005544370687190118, -2.65641937205113,\n 2.3593928236655501, -1.1856099982978574,\n 2.3999566326733439, -0.95006735922426966,\n -1.1501141923016327, -0.062452049216998061,\n -0.71611399195691117, -0.7132021552954626,\n -1.7553287668674522, -2.4257942503559256,\n 1.2265732373740676, -1.6124066829249548,\n -2.7529138598177902, -1.0156957983270942,\n -1.6018709734746754, -4.3855713713401352,\n -0.58187429853534967, 0.33434824232103538,\n 0.5893847129713754, 0.7854825308414517,\n -2.0016874260016304, -0.65145423964686777,\n -2.0166976108576851, -1.2708629640675322,\n -2.4196813759746849, -2.2329276013053807,\n 1.2597623251518704, -0.54504314035725121,\n -0.5176823367573421, 3.4591163597829868,\n -0.11678433081474329, -1.0741275692178371,\n 1.4945733923314797, -0.97451567077946588,\n 2.7458155629590104, -0.75534472129244146,\n -1.2323052282367883, -2.3362501021493713,\n 0.65728071718217163, 2.9330212548803298,\n -0.71201909017782516, 0.5229352837548622,\n 0.66665771035146226, 2.8443864806190855,\n 1.3277532013323454, -2.1473103113906209,\n -1.3938035493334802, -1.4922609138691223,\n 0.28314574426443873, -0.0078944414613061446,\n 0.73587500218353108, -1.3146858293944941,\n -0.75269334032210411, 1.4827201208501692,\n -0.19921351289694036, -1.3085797572141897,\n 1.942328748122542, 0.02699262313677293,\n -1.8330693340430899, 3.4193771225232736,\n -2.3362019798933114, -3.5620725203050472,\n -4.5062648971364343, 1.3022519390933986,\n -1.0656652512055347, -0.55111871394456635,\n 0.57925394525809126, -0.93296812358152814,\n -3.2161203498893749, -3.8995675920839759,\n -0.68139983646196156, 0.3494510546626397,\n -4.5555551215544581, 0.58104896189416777,\n 0.84461271494722856, 2.5894747264134295,\n 0.32942803714790875, 0.40990768160047042,\n 1.2092072534516118, -0.038281538337862839,\n -0.15942869475761728, 0.2319689288056091,\n 1.4883467280967757, -0.86258120705538532,\n -0.99905790382246884, -1.7303241535114227,\n -1.915514566543747, 0.65359994267727539,\n 3.0947444513703499, -1.9377191377288612,\n -0.37688085251892567, -2.0600023229118372,\n 1.8161728837209921, -0.63476372941625703,\n 0.35800793308084394, 0.6960563754583543,\n -2.1085580425488804, -0.20948857622140291,\n -0.45668523418905876, 1.3507111248550778,\n -2.4664893870126186, -2.3999230888455583,\n 1.5317331532322156, -1.1761957225659538,\n -1.3205916599511518, 0.22602704439468746,\n -0.64079759937207748, 3.7327629938775755,\n 0.51906291153559747, 0.32312014183613985,\n 1.8621498186707084, -0.11989349851924225,\n 0.097479400154900323, -2.1457508014679263,\n -4.5859428609613451, -2.4144137001286841,\n 0.22821885959438232, -2.0665941582107541,\n ],\n};\n",
|
|
29
|
+
"/**\n * The `pca_degenerate` dataset of the R package.\n *\n * A small two-column dataset that shows a degenerate PCA case: the two\n * components carry almost the same variance (sdev 17.86 and 17.41), so the\n * principal axes are barely distinguishable and the arrows of `plot_pca()`\n * come out nearly the same length in nearly perpendicular directions.\n *\n * The 16 rows below are the exact doubles of the R data file\n * (`../compstatslib/data/pca_degenerate.rda`), printed at 17 significant\n * digits, which round-trips an IEEE-754 double. **Exported from R, never\n * regenerated** — a JavaScript regeneration would silently change the demo.\n * Source of the printed values: `.claude/plans/001-PLAN-port/pca-fixtures.md`, section F1.\n */\n\nimport type { Point } from \"../core/regression\";\n\n/** The 16 rows of the R `pca_degenerate` data frame, in file order. */\nexport const pcaDegenerate: readonly Point[] = [\n { x: 0.054881767057370599, y: 34.740158547326999 },\n { x: 0.054881767057370599, y: 24.678501253472401 },\n { x: 0.054881767057370599, y: 10.0433633715021 },\n { x: -0.49393590351651601, y: -0.56711159292636404 },\n { x: -0.128057456467252, y: -10.0799512162071 },\n { x: 1.8842740023036699, y: -16.665763263093702 },\n { x: -40.7405650789349, y: -17.763398604241502 },\n { x: -22.812521173521201, y: -17.214580933667602 },\n { x: -7.4456263974523997, y: -16.848702486618301 },\n { x: 7.7383291550917903, y: -16.482824039569099 },\n { x: 22.373467037062099, y: -15.934006368995201 },\n { x: 38.472118707229498, y: -15.7510671454706 },\n { x: 14.872958872552299, y: -16.2998848160445 },\n { x: 0.237820990582013, y: 18.641506877159699 },\n { x: -1.0427535740903999, y: -18.312216274815398 },\n { x: -12.019106985568101, y: -16.848702486618301 },\n];\n",
|
|
24
30
|
"/**\n * The drawing surface that every 2D plot writes to.\n *\n * R's base graphics draw to a current device. Nothing here does: a plot\n * function receives its target and draws only to that target.\n *\n * `Context2D` lists the exact members of `CanvasRenderingContext2D` that this\n * library uses. A real context satisfies the type, and a test can pass any\n * object that implements those members. This matters because happy-dom has no\n * 2D canvas context, so a DOM alone cannot exercise a plot function. See\n * `test/recording-context.ts` for the stub the plot tests use.\n */\n\n/** The part of a canvas 2D context that the plot functions draw through. */\nexport type Context2D = Pick<\n CanvasRenderingContext2D,\n | \"fillStyle\"\n | \"strokeStyle\"\n | \"lineWidth\"\n | \"font\"\n | \"textAlign\"\n | \"textBaseline\"\n | \"save\"\n | \"restore\"\n | \"beginPath\"\n | \"moveTo\"\n | \"lineTo\"\n | \"arc\"\n | \"rect\"\n | \"fillRect\"\n | \"clip\"\n | \"fill\"\n | \"stroke\"\n | \"fillText\"\n | \"setLineDash\"\n | \"translate\"\n | \"rotate\"\n>;\n\n/** A context together with the pixel size of its surface. */\nexport interface RenderTarget {\n readonly ctx: Context2D;\n readonly width: number;\n readonly height: number;\n}\n\n/**\n * What a plot function accepts.\n *\n * Pass a canvas in a browser. Pass a `RenderTarget` to draw through your own\n * context, which is how the tests run without a DOM.\n */\nexport type PlotTarget = HTMLCanvasElement | RenderTarget;\n\n/**\n * Reduce a plot target to a context and a size.\n *\n * A canvas reports the size of its pixel store, which is the size the plot\n * draws in. On a dense screen those two part company: the store has to hold\n * more pixels than the layout does, or the browser stretches the image and\n * softens every edge.\n *\n * This function never touches a canvas the caller passed in — the caller owns\n * it, and resizing it under them would throw away whatever else they drew. So\n * a caller who wants a crisp picture on such a screen does three things:\n *\n * 1. size the store at the layout size times `devicePixelRatio`, and set the\n * CSS width and height to the layout size;\n * 2. call `ctx.scale(ratio, ratio)` once, so drawing carries on in layout\n * pixels;\n * 3. pass `{ ctx, width, height }` with the **layout** size, rather than the\n * canvas.\n *\n * The third step matters. Handing over the canvas would report the store size\n * on top of a context that already scales, and the picture would come out at\n * the square of the ratio. Reporting layout pixels also keeps `eventPixel`\n * right, since it divides the surface size by the size of the client\n * rectangle. `resolveControlTarget` in `../interactive/target.ts` does all\n * three for the canvas it builds itself.\n */\nexport function resolveTarget(target: PlotTarget): RenderTarget {\n if (\"ctx\" in target) {\n return target;\n }\n const ctx = target.getContext(\"2d\");\n if (ctx === null) {\n throw new Error(\n \"plot target: the canvas gave no 2D context. In tests, pass \" +\n \"{ ctx, width, height } instead of a canvas element.\",\n );\n }\n return { ctx, width: target.width, height: target.height };\n}\n",
|
|
25
31
|
"/**\n * Shared 2D scales, ticks, and axis drawing.\n *\n * Every 2D plot in this library maps a world window onto a pixel rectangle and\n * draws the same style of axis box. That work lives here so no plot repeats\n * it. R gets the equivalent from `plot()` and `pretty()`.\n *\n * The scale is pure geometry: it holds numbers and returns numbers. Only\n * `drawAxes` touches a context, and it receives that context as an argument.\n */\n\nimport type { Context2D } from \"./target\";\n\n/** A closed range of world values. */\nexport interface Extent {\n readonly min: number;\n readonly max: number;\n}\n\n/** Pixels reserved outside the plot area for ticks, labels, and titles. */\nexport interface Margins {\n readonly top: number;\n readonly right: number;\n readonly bottom: number;\n readonly left: number;\n}\n\n/** The pixel rectangle that holds the data. */\nexport interface PlotArea {\n readonly left: number;\n readonly right: number;\n readonly top: number;\n readonly bottom: number;\n readonly width: number;\n readonly height: number;\n}\n\n/** What `createScale` needs: a surface size and a world window. */\nexport interface ScaleOptions {\n readonly width: number;\n readonly height: number;\n readonly x: Extent;\n readonly y: Extent;\n readonly margins?: Margins;\n}\n\n/** A two-way map between world values and pixels. */\nexport interface Scale {\n readonly area: PlotArea;\n readonly world: { readonly x: Extent; readonly y: Extent };\n /** Return the pixel column of a world x value. */\n toPixelX(x: number): number;\n /** Return the pixel row of a world y value. Pixel rows grow downward. */\n toPixelY(y: number): number;\n /** Return the world x value of a pixel column. */\n toWorldX(px: number): number;\n /** Return the world y value of a pixel row. */\n toWorldY(py: number): number;\n}\n\n/** What to draw around the plot area. */\nexport interface AxesOptions {\n /** Title under the x axis. Omit for no title. */\n readonly xLabel?: string;\n /** Title beside the y axis, rotated. Omit for no title. */\n readonly yLabel?: string;\n /** Ticks to aim for on each axis. The tick rule may give a few more or less. */\n readonly tickCount?: number;\n /**\n * Draw the box around the plot area. True by default.\n *\n * R's `plot()` draws the box under `frame.plot = TRUE` and drops it under\n * `frame.plot = FALSE`, keeping the two axis lines either way. The t-test\n * plot passes `frame = FALSE`, as its R original does.\n */\n readonly frame?: boolean;\n /**\n * Draw the y axis, its ticks and its labels. True by default.\n *\n * R's `yaxt = \"n\"` drops the vertical axis and leaves the horizontal one.\n * The sampling plot asks for that on each of its three panels, where the\n * height is a density or a count that no reader needs to measure.\n */\n readonly yAxis?: boolean;\n}\n\n/** Margins wide enough for two-digit tick labels and an axis title. */\nexport const DEFAULT_MARGINS: Margins = {\n top: 20,\n right: 20,\n bottom: 44,\n left: 52,\n};\n\nconst DEFAULT_TICK_COUNT = 5;\nconst TICK_LENGTH = 5;\nconst LABEL_GAP = 4;\n/** Pixels between a tick label and the axis title beyond it. */\nconst TITLE_GAP = 26;\nconst AXIS_COLOR = \"#000000\";\nconst AXIS_FONT = \"12px sans-serif\";\n\n/** Read a pair of limits as a range, whichever way round it was written. */\nexport function extentOf(limits: readonly [number, number]): Extent {\n return { min: Math.min(...limits), max: Math.max(...limits) };\n}\n\n/**\n * Build a scale for one surface and one world window.\n *\n * A world range of zero width maps to the middle of the plot area, which keeps\n * a degenerate data set visible instead of dividing by zero.\n */\nexport function createScale(options: ScaleOptions): Scale {\n const margins = options.margins ?? DEFAULT_MARGINS;\n const left = margins.left;\n const top = margins.top;\n const right = options.width - margins.right;\n const bottom = options.height - margins.bottom;\n const area: PlotArea = {\n left,\n right,\n top,\n bottom,\n width: right - left,\n height: bottom - top,\n };\n\n const world = { x: options.x, y: options.y };\n const spanX = options.x.max - options.x.min;\n const spanY = options.y.max - options.y.min;\n\n return {\n area,\n world,\n toPixelX(x) {\n if (spanX === 0) {\n return left + area.width / 2;\n }\n return left + ((x - options.x.min) / spanX) * area.width;\n },\n toPixelY(y) {\n if (spanY === 0) {\n return top + area.height / 2;\n }\n return bottom - ((y - options.y.min) / spanY) * area.height;\n },\n toWorldX(px) {\n if (area.width === 0) {\n return options.x.min;\n }\n return options.x.min + ((px - left) / area.width) * spanX;\n },\n toWorldY(py) {\n if (area.height === 0) {\n return options.y.min;\n }\n return options.y.min + ((bottom - py) / area.height) * spanY;\n },\n };\n}\n\n/**\n * Report whether a pixel lies in the plot area. An edge counts as inside.\n *\n * The interactive components ask this of every click, to keep a click on the\n * margin — the tick labels and the axis titles — from becoming a data point.\n *\n * @param area The plot area, from a scale.\n * @param pixel A position on the surface, in layout pixels.\n * @returns Whether the position is in the area, edges included.\n */\nexport function pixelInArea(\n area: PlotArea,\n pixel: { readonly x: number; readonly y: number },\n): boolean {\n return (\n pixel.x >= area.left &&\n pixel.x <= area.right &&\n pixel.y >= area.top &&\n pixel.y <= area.bottom\n );\n}\n\n/**\n * Choose readable tick values inside an extent.\n *\n * The step is 1, 2, or 5 times a power of ten, as in R's `pretty()`. Unlike\n * `pretty()`, this keeps every tick inside the extent instead of widening the\n * range to round numbers, because the plot window is fixed before the ticks\n * are chosen.\n *\n * @param extent The range to cover. A reversed range gives the same ticks.\n * @param count The number of intervals to aim for.\n * @returns The tick values, ascending. A range of zero width gives one tick.\n */\nexport function prettyTicks(\n extent: Extent,\n count: number = DEFAULT_TICK_COUNT,\n): number[] {\n const min = Math.min(extent.min, extent.max);\n const max = Math.max(extent.min, extent.max);\n if (min === max) {\n return [min];\n }\n\n const step = niceStep((max - min) / Math.max(1, count));\n const decimals = decimalsFor(step);\n // Nudge the bounds by a fraction of a step, so a tick that lands on the\n // bound survives the rounding error of the division.\n const guard = step * 1e-9;\n const first = Math.ceil((min - guard) / step);\n const last = Math.floor((max + guard) / step);\n\n return Array.from({ length: last - first + 1 }, (_unused, index) =>\n roundTo((first + index) * step, decimals),\n );\n}\n\n/**\n * Draw the axis box, the ticks, the tick labels, and the axis titles.\n *\n * @param ctx The context to draw to.\n * @param scale The scale that fixes the plot area and the world window.\n * @param options Titles and tick count. All are optional.\n */\nexport function drawAxes(\n ctx: Context2D,\n scale: Scale,\n options: AxesOptions = {},\n): void {\n const { area } = scale;\n const showYAxis = options.yAxis ?? true;\n const xTicks = prettyTicks(scale.world.x, options.tickCount);\n const yTicks = showYAxis ? prettyTicks(scale.world.y, options.tickCount) : [];\n\n ctx.save();\n ctx.setLineDash([]);\n ctx.strokeStyle = AXIS_COLOR;\n ctx.fillStyle = AXIS_COLOR;\n ctx.lineWidth = 1;\n ctx.font = AXIS_FONT;\n\n ctx.beginPath();\n if (options.frame ?? true) {\n ctx.rect(area.left, area.top, area.width, area.height);\n } else if (showYAxis) {\n // Without the box, the two axis lines still carry the ticks.\n ctx.moveTo(area.left, area.top);\n ctx.lineTo(area.left, area.bottom);\n ctx.lineTo(area.right, area.bottom);\n } else {\n ctx.moveTo(area.left, area.bottom);\n ctx.lineTo(area.right, area.bottom);\n }\n for (const tick of xTicks) {\n const px = scale.toPixelX(tick);\n ctx.moveTo(px, area.bottom);\n ctx.lineTo(px, area.bottom + TICK_LENGTH);\n }\n for (const tick of yTicks) {\n const py = scale.toPixelY(tick);\n ctx.moveTo(area.left, py);\n ctx.lineTo(area.left - TICK_LENGTH, py);\n }\n ctx.stroke();\n\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"top\";\n for (const tick of xTicks) {\n ctx.fillText(\n String(tick),\n scale.toPixelX(tick),\n area.bottom + TICK_LENGTH + LABEL_GAP,\n );\n }\n\n ctx.textAlign = \"right\";\n ctx.textBaseline = \"middle\";\n for (const tick of yTicks) {\n ctx.fillText(\n String(tick),\n area.left - TICK_LENGTH - LABEL_GAP,\n scale.toPixelY(tick),\n );\n }\n\n if (options.xLabel !== undefined) {\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"bottom\";\n ctx.fillText(\n options.xLabel,\n (area.left + area.right) / 2,\n area.bottom + TICK_LENGTH + LABEL_GAP + TITLE_GAP,\n );\n }\n\n if (options.yLabel !== undefined) {\n ctx.save();\n ctx.translate(\n area.left - TICK_LENGTH - LABEL_GAP - TITLE_GAP,\n (area.top + area.bottom) / 2,\n );\n ctx.rotate(-Math.PI / 2);\n ctx.textAlign = \"center\";\n ctx.textBaseline = \"middle\";\n ctx.fillText(options.yLabel, 0, 0);\n ctx.restore();\n }\n\n ctx.restore();\n}\n\n/** Round a step up or down to 1, 2, or 5 times a power of ten. */\nfunction niceStep(rawStep: number): number {\n const magnitude = 10 ** Math.floor(Math.log10(rawStep));\n const normalized = rawStep / magnitude;\n if (normalized < 1.5) {\n return magnitude;\n }\n if (normalized < 3) {\n return 2 * magnitude;\n }\n if (normalized < 7) {\n return 5 * magnitude;\n }\n return 10 * magnitude;\n}\n\n/** Return the decimal places a step of this size needs. */\nfunction decimalsFor(step: number): number {\n return Math.min(20, Math.max(0, -Math.floor(Math.log10(step))));\n}\n\n/** Round away the error of repeated addition, so 0.6 prints as \"0.6\". */\nfunction roundTo(value: number, decimals: number): number {\n return Number(value.toFixed(decimals));\n}\n",
|
|
26
32
|
"/**\n * Shared drawing primitives for the 2D plots.\n *\n * The post-port reuse audit found each of these written out in most of the\n * `plot/` modules, byte for byte. They live here so a change to any of them\n * reaches every plot at once. `axes.ts` keeps what belongs to an axis: the\n * world-to-pixel scale, the tick rule, and the frame.\n *\n * Nothing here reads a scale's world window. Each function takes pixels, so a\n * caller keeps its own world geometry and this file stays about the canvas.\n */\n\nimport type { PlotArea, Scale } from \"./axes\";\nimport type { Context2D } from \"./target\";\nimport type { Point } from \"../core/regression\";\n\n/** R: `lty = \"dotted\"`. */\nexport const DOTTED = [1, 3];\n\n/** R's `col = \"gray\"` is #BEBEBE. The CSS color of that name is darker. */\nconst POINT_COLOR = \"#bebebe\";\n/** R: `pch = 19, cex = 2`. */\nconst POINT_RADIUS = 6;\n\n/** R's `arrows()` draws in `par(\"fg\")`, which is black. */\nconst ARROW_COLOR = \"#000000\";\nconst ARROW_WIDTH = 1;\n/** R: `angle = 30`, the default, measured from the shaft. */\nconst HEAD_ANGLE = Math.PI / 6;\n/**\n * The shortest arrow that still gets drawn, in pixels.\n *\n * `?arrows`: \"The direction of a zero-length arrow is indeterminate, and\n * hence so is the direction of the arrowheads. To allow for rounding error,\n * arrowheads are omitted (with a warning) on any arrow of length less than\n * 1/1000 inch.\" That is this many pixels at the 96 pixels per inch a browser\n * calls an inch. R still draws the shaft, which covers no distance and so\n * paints nothing; this skips the whole arrow, which leaves the same picture\n * and keeps an indeterminate direction from reaching the arrowhead as a NaN.\n *\n * Both callers reach it in ordinary use: a principal component with no spread\n * — identical points, or points on a line — and a matrix with one column near\n * zero, which still has an inverse.\n */\nconst MIN_ARROW_PIXELS = 96 / 1000;\n\n/** Paint the whole surface white, the color of a fresh R device. */\nexport function clearSurface(\n ctx: Context2D,\n width: number,\n height: number,\n): void {\n ctx.setLineDash([]);\n ctx.fillStyle = \"#ffffff\";\n ctx.fillRect(0, 0, width, height);\n}\n\n/**\n * Keep drawing inside the plot area, as base graphics does by default.\n *\n * R's device clips the plot region and canvas clips nothing, so every plot\n * that can put ink outside its window needs this. The caller saves and\n * restores around it: the clip lifts with the state it was set in.\n */\nexport function clipToArea(ctx: Context2D, area: PlotArea): void {\n ctx.beginPath();\n ctx.rect(area.left, area.top, area.width, area.height);\n ctx.clip();\n}\n\n/** Draw each point as a filled dot. R: `pch = 19, cex = 2, col = \"gray\"`. */\nexport function drawDots(\n ctx: Context2D,\n scale: Scale,\n points: readonly Point[],\n): void {\n ctx.save();\n ctx.setLineDash([]);\n ctx.fillStyle = POINT_COLOR;\n for (const point of points) {\n ctx.beginPath();\n ctx.arc(\n scale.toPixelX(point.x),\n scale.toPixelY(point.y),\n POINT_RADIUS,\n 0,\n 2 * Math.PI,\n );\n ctx.fill();\n }\n ctx.restore();\n}\n\n/** How an arrow is drawn. The defaults are R's `arrows()` defaults. */\nexport interface ArrowOptions {\n /** The length of an arrowhead edge, in pixels. R measures it in inches. */\n readonly headLength: number;\n /** The dash pattern. R's `lty` covers the head as well as the shaft. */\n readonly dash?: readonly number[];\n readonly color?: string;\n readonly lineWidth?: number;\n}\n\n/**\n * Draw one arrow between two pixel positions.\n *\n * The head goes at the tip alone, which is what `arrows()` does with its\n * default `code = 2`. An arrow too short to have a direction is skipped\n * whole: see `MIN_ARROW_PIXELS`.\n */\nexport function drawArrow(\n ctx: Context2D,\n tail: readonly [number, number],\n tip: readonly [number, number],\n options: ArrowOptions,\n): void {\n const {\n headLength,\n dash = [],\n color = ARROW_COLOR,\n lineWidth = ARROW_WIDTH,\n } = options;\n\n const length = Math.hypot(tip[0] - tail[0], tip[1] - tail[1]);\n if (!Number.isFinite(length) || length < MIN_ARROW_PIXELS) {\n return;\n }\n\n // Back along the shaft from the tip, then a turn each way for the head.\n const back = Math.atan2(tail[1] - tip[1], tail[0] - tip[0]);\n const edge = (turn: number): readonly [number, number] => [\n tip[0] + headLength * Math.cos(back + turn),\n tip[1] + headLength * Math.sin(back + turn),\n ];\n\n ctx.save();\n ctx.strokeStyle = color;\n ctx.lineWidth = lineWidth;\n ctx.setLineDash([...dash]);\n ctx.beginPath();\n ctx.moveTo(tail[0], tail[1]);\n ctx.lineTo(tip[0], tip[1]);\n const [firstX, firstY] = edge(HEAD_ANGLE);\n const [secondX, secondY] = edge(-HEAD_ANGLE);\n ctx.moveTo(firstX, firstY);\n ctx.lineTo(tip[0], tip[1]);\n ctx.lineTo(secondX, secondY);\n ctx.stroke();\n ctx.restore();\n}\n",
|
|
@@ -41,7 +47,7 @@
|
|
|
41
47
|
"/**\n * The interactive PCA: click to add a point, and watch the components turn.\n *\n * This is the port of `interactive_pca()` in\n * `../compstatslib/R/pca_interactive.R`. R holds the points in a reactive\n * value and calls `plot_pca()` on every change. This module does the same: it\n * owns the points and the clicks, and it hands every draw to `plotPca`. It\n * contains no drawing code and no statistics.\n *\n * R's `runGadget()` blocks and returns `list(points, pca)` when the user\n * clicks \"Done\". A browser blocks at nothing, so this returns a handle at\n * once. Read the two through `getPoints()` and `getFit()`, or call `done()` to\n * hand both to the `onDone` callback.\n *\n * **A click is taken as it comes.** R appends `data.frame(x = click$x,\n * y = click$y)` with no clamp, no rounding, and no test that the click landed\n * inside the plot area — and shiny reports a coordinate for a click anywhere\n * on the plot image, margins included. So this accepts a click anywhere on the\n * surface and keeps the world coordinate whole. That is a deliberate\n * difference from `interactiveRegression`, which ignores a click outside the\n * plot area because its window ends there, and from `interactiveLogit`, which\n * must clamp and round because its outcome is 0 or 1. Here a point outside the\n * window is a real state, and the plot clips it out of sight while it goes on\n * counting towards the components.\n */\n\nimport type { PcaResult } from \"../core/pca\";\nimport type { Point } from \"../core/regression\";\nimport { pcaScale, plotPca } from \"../plot/pca\";\nimport type { PlotPcaOptions } from \"../plot/pca\";\nimport { eventPixel, resolveInteractiveTarget } from \"./target\";\nimport type { InteractiveTarget } from \"./target\";\n\n/**\n * What `done()` hands over: R's `list(points = ..., pca = ...)`.\n *\n * R's `pca` field is `fit` here. Inside a component that is already about\n * PCA, a field called `pca` says nothing, and \"the fit\" is what this port\n * calls the thing a plot computed from a set of points everywhere else —\n * `plotRegression` and `plotLogit` both return one.\n */\nexport interface InteractivePcaResult {\n /** The points collected, in click order. */\n readonly points: readonly Point[];\n /** What the last draw computed, or null below three points. */\n readonly fit: PcaResult | null;\n}\n\n/**\n * What the component accepts.\n *\n * The options of `plotPca` pass through to it unchanged. This is the\n * equivalent of R's `...` forwarding, though R's own `interactive_pca()`\n * exposes only `meancenter` and leaves the window at the `plot_pca` defaults.\n */\nexport interface InteractivePcaOptions extends PlotPcaOptions {\n /** Points to start from. R starts from an empty data frame. */\n readonly initialPoints?: readonly Point[];\n /** What to run on `done()`. */\n readonly onDone?: (result: InteractivePcaResult) => void;\n}\n\n/** What the caller holds after the component starts. */\nexport interface InteractivePcaHandle {\n /** Return the points collected so far, in click order. */\n getPoints(): readonly Point[];\n /**\n * Return what the last draw computed.\n *\n * Null below three points, which is `plot_pca`'s own guard: R's\n * `pca_result` holds whatever the last `plot_pca()` returned, and that is\n * NULL there too.\n */\n getFit(): PcaResult | null;\n /** Drop every point and redraw. This drops the initial points too. */\n reset(): void;\n /** Hand the points and the fit to the `onDone` callback. */\n done(): void;\n /** Stop listening. The points and the fit stay readable. */\n destroy(): void;\n}\n\n/**\n * Start an interactive PCA on a target.\n *\n * The component draws at once, so an empty start shows empty axes. Each click\n * adds one point and redraws. From the third point the two component arrows\n * appear and turn with every point after it.\n *\n * @param target A canvas, or a surface and an element. See `./target.ts`.\n * @param options Points to start from, a done callback, and the options of\n * `plotPca`.\n * @returns The handle to the running component.\n * @throws Error If a canvas gives no 2D context.\n */\nexport function interactivePca(\n target: InteractiveTarget,\n options: InteractivePcaOptions = {},\n): InteractivePcaHandle {\n const { initialPoints, onDone, ...plotOptions } = options;\n const { surface, element } = resolveInteractiveTarget(target);\n\n let points: readonly Point[] = initialPoints ?? [];\n let fit: PcaResult | null = null;\n\n function draw(): void {\n fit = plotPca(surface, points, plotOptions);\n }\n\n function handleClick(event: MouseEvent): void {\n // Built fresh for every click. The window is fixed, but `asp = 1` ties it\n // to the size of the surface, so a scale kept from an earlier size would\n // put the point somewhere plausible and wrong.\n const scale = pcaScale(surface.width, surface.height, plotOptions);\n const pixel = eventPixel(element, surface, event);\n points = [\n ...points,\n { x: scale.toWorldX(pixel.x), y: scale.toWorldY(pixel.y) },\n ];\n draw();\n }\n\n draw();\n element.addEventListener(\"click\", handleClick);\n\n return {\n getPoints: () => [...points],\n getFit: () => fit,\n reset() {\n points = [];\n draw();\n },\n done() {\n onDone?.({ points: [...points], fit });\n },\n destroy() {\n element.removeEventListener(\"click\", handleClick);\n },\n };\n}\n",
|
|
42
48
|
"/**\n * The interactive regression: click to add a point, and watch the line move.\n *\n * This is the port of `interactive_regression()` in\n * `../compstatslib/R/regression_interactive.R`. R holds the points in a\n * reactive value and calls `plot_regression()` on every change, forwarding its `...`\n * arguments. This module does the same: it owns the points and the clicks, and\n * it hands every draw to `plotRegression`. It contains no drawing code and no\n * statistics.\n *\n * R's `runGadget()` blocks and returns the points when the user clicks \"Done\".\n * A browser blocks at nothing, so this returns a handle at once. Read the\n * points from `getPoints()`, or call `done()` to hand them to the `onDone`\n * callback.\n */\n\nimport type { Point } from \"../core/regression\";\nimport { pixelInArea } from \"../plot/axes\";\nimport { plotRegression, regressionScale } from \"../plot/regression\";\nimport type { PlotRegressionOptions } from \"../plot/regression\";\nimport { eventPixel, resolveInteractiveTarget } from \"./target\";\nimport type { InteractiveTarget } from \"./target\";\n\n/**\n * What the component accepts.\n *\n * The options of `plotRegression` pass through to it unchanged. This is the\n * equivalent of R's `...` forwarding.\n */\nexport interface InteractiveRegressionOptions extends PlotRegressionOptions {\n /** Points to start from. R takes these as its `points` argument. */\n readonly initialPoints?: readonly Point[];\n /** What to run on `done()`. */\n readonly onDone?: (points: readonly Point[]) => void;\n}\n\n/** What the caller holds after the component starts. */\nexport interface InteractiveRegressionHandle {\n /** Return the points collected so far, in click order. */\n getPoints(): readonly Point[];\n /** Drop every point and redraw. This drops the initial points too. */\n reset(): void;\n /** Hand the points to the `onDone` callback. */\n done(): void;\n /** Stop listening. The points stay readable. */\n destroy(): void;\n}\n\n/**\n * Start an interactive regression on a target.\n *\n * The component draws at once, so an empty start shows empty axes. Each click\n * inside the plot area adds one point and redraws. A click outside the plot\n * area does nothing, because the world window of the plot ends at the edge of\n * that area and a point beyond it would not appear.\n *\n * @param target A canvas, or a surface and an element. See `./target.ts`.\n * @param options Points to start from, a done callback, and the options of\n * `plotRegression`.\n * @returns The handle to the running component.\n * @throws Error If a canvas gives no 2D context.\n */\nexport function interactiveRegression(\n target: InteractiveTarget,\n options: InteractiveRegressionOptions = {},\n): InteractiveRegressionHandle {\n const { initialPoints, onDone, ...plotOptions } = options;\n const { surface, element } = resolveInteractiveTarget(target);\n const scale = regressionScale(surface.width, surface.height);\n\n let points: readonly Point[] = initialPoints ?? [];\n\n function draw(): void {\n plotRegression(surface, points, plotOptions);\n }\n\n function handleClick(event: MouseEvent): void {\n const pixel = eventPixel(element, surface, event);\n if (!pixelInArea(scale.area, pixel)) {\n return;\n }\n points = [\n ...points,\n { x: scale.toWorldX(pixel.x), y: scale.toWorldY(pixel.y) },\n ];\n draw();\n }\n\n draw();\n element.addEventListener(\"click\", handleClick);\n\n return {\n getPoints: () => [...points],\n reset() {\n points = [];\n draw();\n },\n done() {\n onDone?.([...points]);\n },\n destroy() {\n element.removeEventListener(\"click\", handleClick);\n },\n };\n}\n"
|
|
43
49
|
],
|
|
44
|
-
"mappings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