@iyulab/u-doe 0.6.2 → 0.7.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/README.md CHANGED
@@ -204,11 +204,14 @@ Estimate main effects and interactions for a 2-level factorial design.
204
204
  { "name": "A", "columns": [0], "estimate": 21.6, "sum_of_squares": 1870.6, "percent_contribution": 45.2 },
205
205
  { "name": "A:C", "columns": [0, 2], "estimate": -18.1, "sum_of_squares": 1314.1, "percent_contribution": 31.7 }
206
206
  ],
207
- "half_normal": [[18.1, 0.57], [21.6, 1.15]] }
207
+ "half_normal": [{ "term_index": 1, "abs_effect": 18.1, "quantile": 0.57 },
208
+ { "term_index": 0, "abs_effect": 21.6, "quantile": 1.15 }] }
208
209
  ```
209
210
 
210
211
  Interaction names join factor names with `":"` (since 0.5.0; previously bare concatenation `"AC"`). `columns` holds the design-matrix column indices of the term's factors — use it for display formatting (e.g. `"A × C"`) instead of parsing `name`.
211
212
 
213
+ Each `half_normal` point carries `term_index` — an index into `effects` — so a point can be labelled directly (e.g. `effects[point.term_index].name`). The points are sorted by `|effect|`, a **different order** from `effects` (model-term order), so pairing them positionally (`effects[i]` ↔ `half_normal[i]`) mislabels every point; always use `term_index`.
214
+
212
215
  #### `fit_rsm(design, responses, factor_names) -> RsmModel`
213
216
 
214
217
  Fit a second-order Response Surface Model via OLS.
@@ -231,13 +234,17 @@ Compute the steepest ascent path from a fitted RSM model.
231
234
 
232
235
  Compute Derringer-Suich desirability for multiple responses.
233
236
 
234
- **Input:** `specs`: `[{ "goal": "Maximize"|"Minimize"|"Target", "lower": 0, "target": 100, "upper": 100, "s1": 1, "s2": 1 }]`, `responses`: `Float64Array`
237
+ **Input:** `specs`: `[{ "goal": "Maximize"|"Minimize"|"Target", "lower": 0, "target": 100, "upper": 100, "s1": 1, "s2": 1, "importance": 1 }]`, `responses`: `Float64Array`
238
+
239
+ `s1`/`s2` are curve-shape exponents (`s = 1` linear, `> 1` convex/stricter, `< 1` concave). `importance` (optional, default `1`) is the Derringer-Suich response weight rᵢ — it is **distinct from** the shape exponents: raise `importance` to make a response count more in the aggregate, not to reshape its curve.
235
240
 
236
241
  **Output:**
237
242
  ```json
238
243
  { "individual": [0.8, 0.6], "overall": 0.69 }
239
244
  ```
240
245
 
246
+ `overall` is the importance-weighted geometric mean D = (∏ dᵢ^rᵢ)^(1/Σrᵢ); with all weights at the default `1` this is the plain geometric mean.
247
+
241
248
  #### `two_level_factorial_power(k, p, n_replicates, effect_size, sigma, alpha) -> f64`
242
249
 
243
250
  Compute statistical power of a 2^(k-p) factorial design. Returns power in [0, 1].
package/node/u_doe.cjs CHANGED
@@ -73,10 +73,13 @@ exports.definitive_screening = definitive_screening;
73
73
  * Compute Derringer-Suich desirability for multiple responses.
74
74
  *
75
75
  * `specs`: native array of response specification objects, each:
76
- * `{ goal: "Maximize"|"Minimize"|"Target", lower, target, upper, s1, s2 }`
76
+ * `{ goal: "Maximize"|"Minimize"|"Target", lower, target, upper, s1, s2, importance? }`
77
+ * where `s1`/`s2` are curve-shape exponents and the optional `importance`
78
+ * (default 1.0) is the Derringer-Suich weight rᵢ for the overall aggregation.
77
79
  * `responses`: flat array of observed response values (one per spec).
78
80
  *
79
- * Returns `{ individual: [f64], overall: f64 }`.
81
+ * Returns `{ individual: [f64], overall: f64 }` where `overall` is the
82
+ * importance-weighted geometric mean (∏ dᵢ^rᵢ)^(1/Σrᵢ).
80
83
  *
81
84
  * # Errors
82
85
  * Returns an error string if `specs` has the wrong shape (native JS values,
@@ -138,7 +141,10 @@ exports.doe_anova = doe_anova;
138
141
  * `max_order`: maximum interaction order (1 = main effects only, 2 = + 2FI, 3 = + 3FI).
139
142
  *
140
143
  * Returns `{ effects: [{ name, columns, estimate, sum_of_squares, percent_contribution }],
141
- * half_normal: [[abs_effect, quantile]] }`.
144
+ * half_normal: [{ term_index, abs_effect, quantile }] }`.
145
+ * Each `half_normal` point carries `term_index` (an index into `effects`) so the
146
+ * point can be labelled directly — the points are sorted by `|effect|`, a
147
+ * different order from `effects`, so positional pairing would mislabel them.
142
148
  *
143
149
  * # Errors
144
150
  * Returns an error string if dimensions do not match or an argument has the
package/node/u_doe.d.cts CHANGED
@@ -42,10 +42,13 @@ export function definitive_screening(k: number): any;
42
42
  * Compute Derringer-Suich desirability for multiple responses.
43
43
  *
44
44
  * `specs`: native array of response specification objects, each:
45
- * `{ goal: "Maximize"|"Minimize"|"Target", lower, target, upper, s1, s2 }`
45
+ * `{ goal: "Maximize"|"Minimize"|"Target", lower, target, upper, s1, s2, importance? }`
46
+ * where `s1`/`s2` are curve-shape exponents and the optional `importance`
47
+ * (default 1.0) is the Derringer-Suich weight rᵢ for the overall aggregation.
46
48
  * `responses`: flat array of observed response values (one per spec).
47
49
  *
48
- * Returns `{ individual: [f64], overall: f64 }`.
50
+ * Returns `{ individual: [f64], overall: f64 }` where `overall` is the
51
+ * importance-weighted geometric mean (∏ dᵢ^rᵢ)^(1/Σrᵢ).
49
52
  *
50
53
  * # Errors
51
54
  * Returns an error string if `specs` has the wrong shape (native JS values,
@@ -81,7 +84,10 @@ export function doe_anova(design: any, responses: Float64Array, factor_names: an
81
84
  * `max_order`: maximum interaction order (1 = main effects only, 2 = + 2FI, 3 = + 3FI).
82
85
  *
83
86
  * Returns `{ effects: [{ name, columns, estimate, sum_of_squares, percent_contribution }],
84
- * half_normal: [[abs_effect, quantile]] }`.
87
+ * half_normal: [{ term_index, abs_effect, quantile }] }`.
88
+ * Each `half_normal` point carries `term_index` (an index into `effects`) so the
89
+ * point can be labelled directly — the points are sorted by `|effect|`, a
90
+ * different order from `effects`, so positional pairing would mislabel them.
85
91
  *
86
92
  * # Errors
87
93
  * Returns an error string if dimensions do not match or an argument has the
Binary file
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "iyulab"
6
6
  ],
7
7
  "description": "Design of Experiments (DOE) framework: factorial, Plackett-Burman, CCD, Box-Behnken, Taguchi, effects analysis, RSM, and desirability optimization.",
8
- "version": "0.6.2",
8
+ "version": "0.7.0",
9
9
  "license": "MIT",
10
10
  "repository": {
11
11
  "type": "git",
package/u_doe.d.ts CHANGED
@@ -42,10 +42,13 @@ export function definitive_screening(k: number): any;
42
42
  * Compute Derringer-Suich desirability for multiple responses.
43
43
  *
44
44
  * `specs`: native array of response specification objects, each:
45
- * `{ goal: "Maximize"|"Minimize"|"Target", lower, target, upper, s1, s2 }`
45
+ * `{ goal: "Maximize"|"Minimize"|"Target", lower, target, upper, s1, s2, importance? }`
46
+ * where `s1`/`s2` are curve-shape exponents and the optional `importance`
47
+ * (default 1.0) is the Derringer-Suich weight rᵢ for the overall aggregation.
46
48
  * `responses`: flat array of observed response values (one per spec).
47
49
  *
48
- * Returns `{ individual: [f64], overall: f64 }`.
50
+ * Returns `{ individual: [f64], overall: f64 }` where `overall` is the
51
+ * importance-weighted geometric mean (∏ dᵢ^rᵢ)^(1/Σrᵢ).
49
52
  *
50
53
  * # Errors
51
54
  * Returns an error string if `specs` has the wrong shape (native JS values,
@@ -81,7 +84,10 @@ export function doe_anova(design: any, responses: Float64Array, factor_names: an
81
84
  * `max_order`: maximum interaction order (1 = main effects only, 2 = + 2FI, 3 = + 3FI).
82
85
  *
83
86
  * Returns `{ effects: [{ name, columns, estimate, sum_of_squares, percent_contribution }],
84
- * half_normal: [[abs_effect, quantile]] }`.
87
+ * half_normal: [{ term_index, abs_effect, quantile }] }`.
88
+ * Each `half_normal` point carries `term_index` (an index into `effects`) so the
89
+ * point can be labelled directly — the points are sorted by `|effect|`, a
90
+ * different order from `effects`, so positional pairing would mislabel them.
85
91
  *
86
92
  * # Errors
87
93
  * Returns an error string if dimensions do not match or an argument has the
package/u_doe_bg.js CHANGED
@@ -68,10 +68,13 @@ export function definitive_screening(k) {
68
68
  * Compute Derringer-Suich desirability for multiple responses.
69
69
  *
70
70
  * `specs`: native array of response specification objects, each:
71
- * `{ goal: "Maximize"|"Minimize"|"Target", lower, target, upper, s1, s2 }`
71
+ * `{ goal: "Maximize"|"Minimize"|"Target", lower, target, upper, s1, s2, importance? }`
72
+ * where `s1`/`s2` are curve-shape exponents and the optional `importance`
73
+ * (default 1.0) is the Derringer-Suich weight rᵢ for the overall aggregation.
72
74
  * `responses`: flat array of observed response values (one per spec).
73
75
  *
74
- * Returns `{ individual: [f64], overall: f64 }`.
76
+ * Returns `{ individual: [f64], overall: f64 }` where `overall` is the
77
+ * importance-weighted geometric mean (∏ dᵢ^rᵢ)^(1/Σrᵢ).
75
78
  *
76
79
  * # Errors
77
80
  * Returns an error string if `specs` has the wrong shape (native JS values,
@@ -131,7 +134,10 @@ export function doe_anova(design, responses, factor_names, effect_names) {
131
134
  * `max_order`: maximum interaction order (1 = main effects only, 2 = + 2FI, 3 = + 3FI).
132
135
  *
133
136
  * Returns `{ effects: [{ name, columns, estimate, sum_of_squares, percent_contribution }],
134
- * half_normal: [[abs_effect, quantile]] }`.
137
+ * half_normal: [{ term_index, abs_effect, quantile }] }`.
138
+ * Each `half_normal` point carries `term_index` (an index into `effects`) so the
139
+ * point can be labelled directly — the points are sorted by `|effect|`, a
140
+ * different order from `effects`, so positional pairing would mislabel them.
135
141
  *
136
142
  * # Errors
137
143
  * Returns an error string if dimensions do not match or an argument has the
package/u_doe_bg.wasm CHANGED
Binary file