@iyulab/u-doe 0.2.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/README.md +109 -0
- package/package.json +1 -1
- package/u_doe.d.ts +110 -0
- package/u_doe.js +1 -1
- package/u_doe_bg.js +236 -33
- package/u_doe_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -121,6 +121,115 @@ println!("Required replicates: {n}");
|
|
|
121
121
|
- Jones, B. & Nachtsheim, C.J. (2011). A Class of Three-Level Designs for Definitive Screening in the Presence of Second-Order Effects. *Journal of Quality Technology* 43(1), 1–15.
|
|
122
122
|
- Taguchi, G. (1986). *Introduction to Quality Engineering*. Asian Productivity Organization.
|
|
123
123
|
|
|
124
|
+
## WebAssembly / npm
|
|
125
|
+
|
|
126
|
+
Available as an npm package via [wasm-pack](https://rustwasm.github.io/wasm-pack/).
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
npm install @iyulab/u-doe
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Quick Start
|
|
133
|
+
|
|
134
|
+
```javascript
|
|
135
|
+
import init, { full_factorial, doe_anova } from '@iyulab/u-doe';
|
|
136
|
+
|
|
137
|
+
await init();
|
|
138
|
+
const design = full_factorial(3); // 2^3 = 8 runs
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Functions
|
|
142
|
+
|
|
143
|
+
#### `full_factorial(k) -> DesignMatrix`
|
|
144
|
+
|
|
145
|
+
Generate a 2^k full factorial design (k = 1..7).
|
|
146
|
+
|
|
147
|
+
**Output:**
|
|
148
|
+
```json
|
|
149
|
+
{ "data": [[...]], "factor_names": ["X1","X2"], "run_count": 4, "factor_count": 2 }
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
#### `fractional_factorial(k, p) -> DesignMatrix`
|
|
153
|
+
|
|
154
|
+
Generate a 2^(k-p) fractional factorial design (k = 4..7, p = 1..3).
|
|
155
|
+
|
|
156
|
+
#### `plackett_burman(k) -> DesignMatrix`
|
|
157
|
+
|
|
158
|
+
Generate a Plackett-Burman screening design (k = 1..19).
|
|
159
|
+
|
|
160
|
+
#### `ccd(k, design_type, n_center) -> DesignMatrix`
|
|
161
|
+
|
|
162
|
+
Generate a Central Composite Design. `design_type`: `"FaceCentered"` | `"Rotatable"` | `"Inscribed"`. k = 2..6.
|
|
163
|
+
|
|
164
|
+
#### `box_behnken(k, n_center) -> DesignMatrix`
|
|
165
|
+
|
|
166
|
+
Generate a Box-Behnken design (k = 3, 4, or 5).
|
|
167
|
+
|
|
168
|
+
#### `taguchi_array(name, k) -> DesignMatrix`
|
|
169
|
+
|
|
170
|
+
Get a Taguchi orthogonal array. `name`: `"L4"` | `"L8"` | `"L9"` | `"L12"` | `"L16"` | `"L18"` | `"L27"`.
|
|
171
|
+
|
|
172
|
+
#### `definitive_screening(k) -> DesignMatrix`
|
|
173
|
+
|
|
174
|
+
Generate a Definitive Screening Design (k = 2..12).
|
|
175
|
+
|
|
176
|
+
#### `doe_anova(design, responses, factor_names, effect_names) -> AnovaResult`
|
|
177
|
+
|
|
178
|
+
Perform DOE ANOVA on a coded design matrix.
|
|
179
|
+
|
|
180
|
+
**Input:** `design`: `[[f64]]`, `responses`: `Float64Array`, `factor_names`: `["A","B"]`, `effect_names`: `["A","B","AB"]`
|
|
181
|
+
|
|
182
|
+
**Output:**
|
|
183
|
+
```json
|
|
184
|
+
{ "effects": [{ "name": "A", "sum_of_squares": 10.0, "df": 1, "mean_square": 10.0, "f_statistic": 5.0, "p_value": 0.03 }], "residual_ss": 4.0, "residual_df": 2, "total_ss": 14.0, "r_squared": 0.71, "r_squared_adj": 0.57 }
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
#### `signal_to_noise(responses, goal) -> [f64]`
|
|
188
|
+
|
|
189
|
+
Compute Taguchi S/N ratios. `responses`: `[[f64]]` (replicates per run). `goal`: `"LargerIsBetter"` | `"SmallerIsBetter"` | `"NominalIsBest"`.
|
|
190
|
+
|
|
191
|
+
#### `estimate_effects(design, responses, factor_names, max_order) -> EffectsResult`
|
|
192
|
+
|
|
193
|
+
Estimate main effects and interactions for a 2-level factorial design.
|
|
194
|
+
|
|
195
|
+
**Output:**
|
|
196
|
+
```json
|
|
197
|
+
{ "effects": [{ "name": "A", "estimate": 21.6, "sum_of_squares": 1870.6, "percent_contribution": 45.2 }], "half_normal": [[21.6, 1.15]] }
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
#### `fit_rsm(design, responses, factor_names) -> RsmModel`
|
|
201
|
+
|
|
202
|
+
Fit a second-order Response Surface Model via OLS.
|
|
203
|
+
|
|
204
|
+
**Output:**
|
|
205
|
+
```json
|
|
206
|
+
{ "coefficients": [10.0, 2.5, -1.3, 0.5, 0.8, -0.2], "r_squared": 0.95, "factor_count": 2 }
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
#### `steepest_ascent(coefficients, factor_count, n_steps, step_size) -> AscentResult`
|
|
210
|
+
|
|
211
|
+
Compute the steepest ascent path from a fitted RSM model.
|
|
212
|
+
|
|
213
|
+
**Output:**
|
|
214
|
+
```json
|
|
215
|
+
{ "steps": [{ "coded": [0.5, 0.3], "step_number": 1 }] }
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
#### `desirability(specs, responses) -> DesirabilityResult`
|
|
219
|
+
|
|
220
|
+
Compute Derringer-Suich desirability for multiple responses.
|
|
221
|
+
|
|
222
|
+
**Input:** `specs`: `[{ "goal": "Maximize"|"Minimize"|"Target", "lower": 0, "target": 100, "upper": 100, "s1": 1, "s2": 1 }]`, `responses`: `Float64Array`
|
|
223
|
+
|
|
224
|
+
**Output:**
|
|
225
|
+
```json
|
|
226
|
+
{ "individual": [0.8, 0.6], "overall": 0.69 }
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### `two_level_factorial_power(k, p, n_replicates, effect_size, sigma, alpha) -> f64`
|
|
230
|
+
|
|
231
|
+
Compute statistical power of a 2^(k-p) factorial design. Returns power in [0, 1].
|
|
232
|
+
|
|
124
233
|
## Related
|
|
125
234
|
|
|
126
235
|
- [`u-analytics`](https://crates.io/crates/u-analytics) — SPC, process capability, statistical analysis
|
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.
|
|
8
|
+
"version": "0.4.0",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
package/u_doe.d.ts
CHANGED
|
@@ -38,6 +38,21 @@ export function ccd(k: number, design_type: string, n_center: number): any;
|
|
|
38
38
|
*/
|
|
39
39
|
export function definitive_screening(k: number): any;
|
|
40
40
|
|
|
41
|
+
/**
|
|
42
|
+
* Compute Derringer-Suich desirability for multiple responses.
|
|
43
|
+
*
|
|
44
|
+
* `specs_json`: JSON array of response specifications, each:
|
|
45
|
+
* `{ goal: "Maximize"|"Minimize"|"Target", lower, target, upper, s1, s2 }`
|
|
46
|
+
* `responses`: flat array of observed response values (one per spec).
|
|
47
|
+
*
|
|
48
|
+
* Returns `{ individual: [f64], overall: f64 }`.
|
|
49
|
+
*
|
|
50
|
+
* # Errors
|
|
51
|
+
* Returns an error string if JSON is malformed, specs/responses length mismatch,
|
|
52
|
+
* or goal string is unrecognised.
|
|
53
|
+
*/
|
|
54
|
+
export function desirability(specs_json: any, responses: Float64Array): any;
|
|
55
|
+
|
|
41
56
|
/**
|
|
42
57
|
* Perform DOE ANOVA.
|
|
43
58
|
*
|
|
@@ -54,6 +69,52 @@ export function definitive_screening(k: number): any;
|
|
|
54
69
|
*/
|
|
55
70
|
export function doe_anova(design_json: any, responses: Float64Array, factor_names_json: any, effect_names_json: any): any;
|
|
56
71
|
|
|
72
|
+
/**
|
|
73
|
+
* Estimate main effects and interactions for a 2-level factorial design,
|
|
74
|
+
* plus half-normal plot data for identifying active effects.
|
|
75
|
+
*
|
|
76
|
+
* `design_json`: JSON array-of-arrays `[[f64]]` — the coded design matrix (rows = runs).
|
|
77
|
+
* `responses`: flat array of response values, one per run.
|
|
78
|
+
* `factor_names_json`: JSON array of factor name strings.
|
|
79
|
+
* `max_order`: maximum interaction order (1 = main effects only, 2 = + 2FI, 3 = + 3FI).
|
|
80
|
+
*
|
|
81
|
+
* Returns `{ effects: [{ name, estimate, sum_of_squares, percent_contribution }],
|
|
82
|
+
* half_normal: [[abs_effect, quantile]] }`.
|
|
83
|
+
*
|
|
84
|
+
* # Errors
|
|
85
|
+
* Returns an error string if dimensions do not match or JSON is malformed.
|
|
86
|
+
*/
|
|
87
|
+
export function estimate_effects(design_json: any, responses: Float64Array, factor_names_json: any, max_order: number): any;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Fit a second-order Response Surface Model (RSM) using OLS.
|
|
91
|
+
*
|
|
92
|
+
* `design_json`: JSON array-of-arrays `[[f64]]` — the coded design matrix.
|
|
93
|
+
* `responses`: flat array of response values, one per run.
|
|
94
|
+
* `factor_names_json`: JSON array of factor name strings.
|
|
95
|
+
*
|
|
96
|
+
* Returns `{ coefficients: [f64], r_squared: f64, factor_count: usize }`.
|
|
97
|
+
* Coefficient order: [intercept, linear..., quadratic..., interactions...].
|
|
98
|
+
*
|
|
99
|
+
* # Errors
|
|
100
|
+
* Returns an error string if dimensions do not match, JSON is malformed,
|
|
101
|
+
* or the model matrix is singular.
|
|
102
|
+
*/
|
|
103
|
+
export function fit_rsm(design_json: any, responses: Float64Array, factor_names_json: any): any;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Generate a 2^(k-p) fractional factorial design.
|
|
107
|
+
*
|
|
108
|
+
* Uses standard generators from Montgomery (2019) Table 8.14.
|
|
109
|
+
* Supported: k=4..7, p=1..3 (standard combinations only).
|
|
110
|
+
*
|
|
111
|
+
* Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
|
|
112
|
+
*
|
|
113
|
+
* # Errors
|
|
114
|
+
* Returns an error string if the (k, p) combination is not in the standard table.
|
|
115
|
+
*/
|
|
116
|
+
export function fractional_factorial(k: number, p: number): any;
|
|
117
|
+
|
|
57
118
|
/**
|
|
58
119
|
* Generate a 2^k full factorial design.
|
|
59
120
|
*
|
|
@@ -64,6 +125,18 @@ export function doe_anova(design_json: any, responses: Float64Array, factor_name
|
|
|
64
125
|
*/
|
|
65
126
|
export function full_factorial(k: number): any;
|
|
66
127
|
|
|
128
|
+
/**
|
|
129
|
+
* Generate a Plackett-Burman screening design for `k` factors (1 ≤ k ≤ 19).
|
|
130
|
+
*
|
|
131
|
+
* Automatically selects the smallest N (multiple of 4) such that N − 1 ≥ k.
|
|
132
|
+
*
|
|
133
|
+
* Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
|
|
134
|
+
*
|
|
135
|
+
* # Errors
|
|
136
|
+
* Returns an error string if `k == 0` or `k > 19`.
|
|
137
|
+
*/
|
|
138
|
+
export function plackett_burman(k: number): any;
|
|
139
|
+
|
|
67
140
|
/**
|
|
68
141
|
* Compute Taguchi Signal-to-Noise ratios.
|
|
69
142
|
*
|
|
@@ -79,6 +152,43 @@ export function full_factorial(k: number): any;
|
|
|
79
152
|
*/
|
|
80
153
|
export function signal_to_noise(responses_json: any, goal: string): any;
|
|
81
154
|
|
|
155
|
+
/**
|
|
156
|
+
* Generate a Simplex Centroid Design for `q`-component mixture experiments.
|
|
157
|
+
*
|
|
158
|
+
* Produces 2^q − 1 points: the centroid of every non-empty subset of the
|
|
159
|
+
* q components. Example: q=3 → 7 points (3 vertices + 3 edge midpoints +
|
|
160
|
+
* 1 overall centroid), q=4 → 15 points.
|
|
161
|
+
*
|
|
162
|
+
* Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
|
|
163
|
+
* Factor names are "X1", "X2", ..., "Xq".
|
|
164
|
+
*/
|
|
165
|
+
export function simplex_centroid(q: number): any;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Generate a Simplex Lattice Design {q, m} for mixture experiments.
|
|
169
|
+
*
|
|
170
|
+
* Each of the `q` components takes values in {0, 1/m, 2/m, ..., 1} subject
|
|
171
|
+
* to the constraint that all components sum to 1.0 for every run.
|
|
172
|
+
*
|
|
173
|
+
* Run count: C(q + m − 1, m) (e.g. {3,2} → 6 runs, {3,3} → 10 runs).
|
|
174
|
+
*
|
|
175
|
+
* Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
|
|
176
|
+
* Factor names are "X1", "X2", ..., "Xq".
|
|
177
|
+
*/
|
|
178
|
+
export function simplex_lattice(q: number, m: number): any;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Compute the steepest ascent path from a fitted RSM model.
|
|
182
|
+
*
|
|
183
|
+
* `coefficients_json`: JSON array of model coefficients (from `fit_rsm`).
|
|
184
|
+
* `factor_count`: number of factors in the model.
|
|
185
|
+
* `n_steps`: number of steps along the ascent path.
|
|
186
|
+
* `step_size`: step size in coded units.
|
|
187
|
+
*
|
|
188
|
+
* Returns `{ steps: [{ coded: [f64], step_number: usize }] }`.
|
|
189
|
+
*/
|
|
190
|
+
export function steepest_ascent(coefficients_json: any, factor_count: number, n_steps: number, step_size: number): any;
|
|
191
|
+
|
|
82
192
|
/**
|
|
83
193
|
* Get a Taguchi orthogonal array.
|
|
84
194
|
*
|
package/u_doe.js
CHANGED
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./u_doe_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
wasm.__wbindgen_start();
|
|
7
7
|
export {
|
|
8
|
-
box_behnken, ccd, definitive_screening, doe_anova, full_factorial, signal_to_noise, taguchi_array, two_level_factorial_power
|
|
8
|
+
box_behnken, ccd, definitive_screening, desirability, doe_anova, estimate_effects, fit_rsm, fractional_factorial, full_factorial, plackett_burman, signal_to_noise, simplex_centroid, simplex_lattice, steepest_ascent, taguchi_array, two_level_factorial_power
|
|
9
9
|
} from "./u_doe_bg.js";
|
package/u_doe_bg.js
CHANGED
|
@@ -64,6 +64,32 @@ export function definitive_screening(k) {
|
|
|
64
64
|
return takeFromExternrefTable0(ret[0]);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
+
/**
|
|
68
|
+
* Compute Derringer-Suich desirability for multiple responses.
|
|
69
|
+
*
|
|
70
|
+
* `specs_json`: JSON array of response specifications, each:
|
|
71
|
+
* `{ goal: "Maximize"|"Minimize"|"Target", lower, target, upper, s1, s2 }`
|
|
72
|
+
* `responses`: flat array of observed response values (one per spec).
|
|
73
|
+
*
|
|
74
|
+
* Returns `{ individual: [f64], overall: f64 }`.
|
|
75
|
+
*
|
|
76
|
+
* # Errors
|
|
77
|
+
* Returns an error string if JSON is malformed, specs/responses length mismatch,
|
|
78
|
+
* or goal string is unrecognised.
|
|
79
|
+
* @param {any} specs_json
|
|
80
|
+
* @param {Float64Array} responses
|
|
81
|
+
* @returns {any}
|
|
82
|
+
*/
|
|
83
|
+
export function desirability(specs_json, responses) {
|
|
84
|
+
const ptr0 = passArrayF64ToWasm0(responses, wasm.__wbindgen_malloc);
|
|
85
|
+
const len0 = WASM_VECTOR_LEN;
|
|
86
|
+
const ret = wasm.desirability(specs_json, ptr0, len0);
|
|
87
|
+
if (ret[2]) {
|
|
88
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
89
|
+
}
|
|
90
|
+
return takeFromExternrefTable0(ret[0]);
|
|
91
|
+
}
|
|
92
|
+
|
|
67
93
|
/**
|
|
68
94
|
* Perform DOE ANOVA.
|
|
69
95
|
*
|
|
@@ -93,6 +119,86 @@ export function doe_anova(design_json, responses, factor_names_json, effect_name
|
|
|
93
119
|
return takeFromExternrefTable0(ret[0]);
|
|
94
120
|
}
|
|
95
121
|
|
|
122
|
+
/**
|
|
123
|
+
* Estimate main effects and interactions for a 2-level factorial design,
|
|
124
|
+
* plus half-normal plot data for identifying active effects.
|
|
125
|
+
*
|
|
126
|
+
* `design_json`: JSON array-of-arrays `[[f64]]` — the coded design matrix (rows = runs).
|
|
127
|
+
* `responses`: flat array of response values, one per run.
|
|
128
|
+
* `factor_names_json`: JSON array of factor name strings.
|
|
129
|
+
* `max_order`: maximum interaction order (1 = main effects only, 2 = + 2FI, 3 = + 3FI).
|
|
130
|
+
*
|
|
131
|
+
* Returns `{ effects: [{ name, estimate, sum_of_squares, percent_contribution }],
|
|
132
|
+
* half_normal: [[abs_effect, quantile]] }`.
|
|
133
|
+
*
|
|
134
|
+
* # Errors
|
|
135
|
+
* Returns an error string if dimensions do not match or JSON is malformed.
|
|
136
|
+
* @param {any} design_json
|
|
137
|
+
* @param {Float64Array} responses
|
|
138
|
+
* @param {any} factor_names_json
|
|
139
|
+
* @param {number} max_order
|
|
140
|
+
* @returns {any}
|
|
141
|
+
*/
|
|
142
|
+
export function estimate_effects(design_json, responses, factor_names_json, max_order) {
|
|
143
|
+
const ptr0 = passArrayF64ToWasm0(responses, wasm.__wbindgen_malloc);
|
|
144
|
+
const len0 = WASM_VECTOR_LEN;
|
|
145
|
+
const ret = wasm.estimate_effects(design_json, ptr0, len0, factor_names_json, max_order);
|
|
146
|
+
if (ret[2]) {
|
|
147
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
148
|
+
}
|
|
149
|
+
return takeFromExternrefTable0(ret[0]);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Fit a second-order Response Surface Model (RSM) using OLS.
|
|
154
|
+
*
|
|
155
|
+
* `design_json`: JSON array-of-arrays `[[f64]]` — the coded design matrix.
|
|
156
|
+
* `responses`: flat array of response values, one per run.
|
|
157
|
+
* `factor_names_json`: JSON array of factor name strings.
|
|
158
|
+
*
|
|
159
|
+
* Returns `{ coefficients: [f64], r_squared: f64, factor_count: usize }`.
|
|
160
|
+
* Coefficient order: [intercept, linear..., quadratic..., interactions...].
|
|
161
|
+
*
|
|
162
|
+
* # Errors
|
|
163
|
+
* Returns an error string if dimensions do not match, JSON is malformed,
|
|
164
|
+
* or the model matrix is singular.
|
|
165
|
+
* @param {any} design_json
|
|
166
|
+
* @param {Float64Array} responses
|
|
167
|
+
* @param {any} factor_names_json
|
|
168
|
+
* @returns {any}
|
|
169
|
+
*/
|
|
170
|
+
export function fit_rsm(design_json, responses, factor_names_json) {
|
|
171
|
+
const ptr0 = passArrayF64ToWasm0(responses, wasm.__wbindgen_malloc);
|
|
172
|
+
const len0 = WASM_VECTOR_LEN;
|
|
173
|
+
const ret = wasm.fit_rsm(design_json, ptr0, len0, factor_names_json);
|
|
174
|
+
if (ret[2]) {
|
|
175
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
176
|
+
}
|
|
177
|
+
return takeFromExternrefTable0(ret[0]);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* Generate a 2^(k-p) fractional factorial design.
|
|
182
|
+
*
|
|
183
|
+
* Uses standard generators from Montgomery (2019) Table 8.14.
|
|
184
|
+
* Supported: k=4..7, p=1..3 (standard combinations only).
|
|
185
|
+
*
|
|
186
|
+
* Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
|
|
187
|
+
*
|
|
188
|
+
* # Errors
|
|
189
|
+
* Returns an error string if the (k, p) combination is not in the standard table.
|
|
190
|
+
* @param {number} k
|
|
191
|
+
* @param {number} p
|
|
192
|
+
* @returns {any}
|
|
193
|
+
*/
|
|
194
|
+
export function fractional_factorial(k, p) {
|
|
195
|
+
const ret = wasm.fractional_factorial(k, p);
|
|
196
|
+
if (ret[2]) {
|
|
197
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
198
|
+
}
|
|
199
|
+
return takeFromExternrefTable0(ret[0]);
|
|
200
|
+
}
|
|
201
|
+
|
|
96
202
|
/**
|
|
97
203
|
* Generate a 2^k full factorial design.
|
|
98
204
|
*
|
|
@@ -111,6 +217,26 @@ export function full_factorial(k) {
|
|
|
111
217
|
return takeFromExternrefTable0(ret[0]);
|
|
112
218
|
}
|
|
113
219
|
|
|
220
|
+
/**
|
|
221
|
+
* Generate a Plackett-Burman screening design for `k` factors (1 ≤ k ≤ 19).
|
|
222
|
+
*
|
|
223
|
+
* Automatically selects the smallest N (multiple of 4) such that N − 1 ≥ k.
|
|
224
|
+
*
|
|
225
|
+
* Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
|
|
226
|
+
*
|
|
227
|
+
* # Errors
|
|
228
|
+
* Returns an error string if `k == 0` or `k > 19`.
|
|
229
|
+
* @param {number} k
|
|
230
|
+
* @returns {any}
|
|
231
|
+
*/
|
|
232
|
+
export function plackett_burman(k) {
|
|
233
|
+
const ret = wasm.plackett_burman(k);
|
|
234
|
+
if (ret[2]) {
|
|
235
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
236
|
+
}
|
|
237
|
+
return takeFromExternrefTable0(ret[0]);
|
|
238
|
+
}
|
|
239
|
+
|
|
114
240
|
/**
|
|
115
241
|
* Compute Taguchi Signal-to-Noise ratios.
|
|
116
242
|
*
|
|
@@ -137,6 +263,71 @@ export function signal_to_noise(responses_json, goal) {
|
|
|
137
263
|
return takeFromExternrefTable0(ret[0]);
|
|
138
264
|
}
|
|
139
265
|
|
|
266
|
+
/**
|
|
267
|
+
* Generate a Simplex Centroid Design for `q`-component mixture experiments.
|
|
268
|
+
*
|
|
269
|
+
* Produces 2^q − 1 points: the centroid of every non-empty subset of the
|
|
270
|
+
* q components. Example: q=3 → 7 points (3 vertices + 3 edge midpoints +
|
|
271
|
+
* 1 overall centroid), q=4 → 15 points.
|
|
272
|
+
*
|
|
273
|
+
* Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
|
|
274
|
+
* Factor names are "X1", "X2", ..., "Xq".
|
|
275
|
+
* @param {number} q
|
|
276
|
+
* @returns {any}
|
|
277
|
+
*/
|
|
278
|
+
export function simplex_centroid(q) {
|
|
279
|
+
const ret = wasm.simplex_centroid(q);
|
|
280
|
+
if (ret[2]) {
|
|
281
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
282
|
+
}
|
|
283
|
+
return takeFromExternrefTable0(ret[0]);
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Generate a Simplex Lattice Design {q, m} for mixture experiments.
|
|
288
|
+
*
|
|
289
|
+
* Each of the `q` components takes values in {0, 1/m, 2/m, ..., 1} subject
|
|
290
|
+
* to the constraint that all components sum to 1.0 for every run.
|
|
291
|
+
*
|
|
292
|
+
* Run count: C(q + m − 1, m) (e.g. {3,2} → 6 runs, {3,3} → 10 runs).
|
|
293
|
+
*
|
|
294
|
+
* Returns `{ data: [[f64]], factor_names: [str], run_count: usize, factor_count: usize }`.
|
|
295
|
+
* Factor names are "X1", "X2", ..., "Xq".
|
|
296
|
+
* @param {number} q
|
|
297
|
+
* @param {number} m
|
|
298
|
+
* @returns {any}
|
|
299
|
+
*/
|
|
300
|
+
export function simplex_lattice(q, m) {
|
|
301
|
+
const ret = wasm.simplex_lattice(q, m);
|
|
302
|
+
if (ret[2]) {
|
|
303
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
304
|
+
}
|
|
305
|
+
return takeFromExternrefTable0(ret[0]);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Compute the steepest ascent path from a fitted RSM model.
|
|
310
|
+
*
|
|
311
|
+
* `coefficients_json`: JSON array of model coefficients (from `fit_rsm`).
|
|
312
|
+
* `factor_count`: number of factors in the model.
|
|
313
|
+
* `n_steps`: number of steps along the ascent path.
|
|
314
|
+
* `step_size`: step size in coded units.
|
|
315
|
+
*
|
|
316
|
+
* Returns `{ steps: [{ coded: [f64], step_number: usize }] }`.
|
|
317
|
+
* @param {any} coefficients_json
|
|
318
|
+
* @param {number} factor_count
|
|
319
|
+
* @param {number} n_steps
|
|
320
|
+
* @param {number} step_size
|
|
321
|
+
* @returns {any}
|
|
322
|
+
*/
|
|
323
|
+
export function steepest_ascent(coefficients_json, factor_count, n_steps, step_size) {
|
|
324
|
+
const ret = wasm.steepest_ascent(coefficients_json, factor_count, n_steps, step_size);
|
|
325
|
+
if (ret[2]) {
|
|
326
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
327
|
+
}
|
|
328
|
+
return takeFromExternrefTable0(ret[0]);
|
|
329
|
+
}
|
|
330
|
+
|
|
140
331
|
/**
|
|
141
332
|
* Get a Taguchi orthogonal array.
|
|
142
333
|
*
|
|
@@ -187,7 +378,7 @@ export function two_level_factorial_power(k, p, n_replicates, effect_size, sigma
|
|
|
187
378
|
const ret = wasm.two_level_factorial_power(k, p, n_replicates, effect_size, sigma, alpha);
|
|
188
379
|
return ret;
|
|
189
380
|
}
|
|
190
|
-
export function
|
|
381
|
+
export function __wbg_Error_2e59b1b37a9a34c3(arg0, arg1) {
|
|
191
382
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
192
383
|
return ret;
|
|
193
384
|
}
|
|
@@ -198,38 +389,46 @@ export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
|
198
389
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
199
390
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
200
391
|
}
|
|
201
|
-
export function
|
|
392
|
+
export function __wbg___wbindgen_boolean_get_a86c216575a75c30(arg0) {
|
|
202
393
|
const v = arg0;
|
|
203
394
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
204
395
|
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
205
396
|
}
|
|
206
|
-
export function
|
|
397
|
+
export function __wbg___wbindgen_debug_string_dd5d2d07ce9e6c57(arg0, arg1) {
|
|
207
398
|
const ret = debugString(arg1);
|
|
208
399
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
209
400
|
const len1 = WASM_VECTOR_LEN;
|
|
210
401
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
211
402
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
212
403
|
}
|
|
213
|
-
export function
|
|
404
|
+
export function __wbg___wbindgen_in_4bd7a57e54337366(arg0, arg1) {
|
|
405
|
+
const ret = arg0 in arg1;
|
|
406
|
+
return ret;
|
|
407
|
+
}
|
|
408
|
+
export function __wbg___wbindgen_is_function_49868bde5eb1e745(arg0) {
|
|
214
409
|
const ret = typeof(arg0) === 'function';
|
|
215
410
|
return ret;
|
|
216
411
|
}
|
|
217
|
-
export function
|
|
412
|
+
export function __wbg___wbindgen_is_object_40c5a80572e8f9d3(arg0) {
|
|
218
413
|
const val = arg0;
|
|
219
414
|
const ret = typeof(val) === 'object' && val !== null;
|
|
220
415
|
return ret;
|
|
221
416
|
}
|
|
222
|
-
export function
|
|
417
|
+
export function __wbg___wbindgen_is_undefined_c0cca72b82b86f4d(arg0) {
|
|
418
|
+
const ret = arg0 === undefined;
|
|
419
|
+
return ret;
|
|
420
|
+
}
|
|
421
|
+
export function __wbg___wbindgen_jsval_loose_eq_3a72ae764d46d944(arg0, arg1) {
|
|
223
422
|
const ret = arg0 == arg1;
|
|
224
423
|
return ret;
|
|
225
424
|
}
|
|
226
|
-
export function
|
|
425
|
+
export function __wbg___wbindgen_number_get_7579aab02a8a620c(arg0, arg1) {
|
|
227
426
|
const obj = arg1;
|
|
228
427
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
229
428
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
230
429
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
231
430
|
}
|
|
232
|
-
export function
|
|
431
|
+
export function __wbg___wbindgen_string_get_914df97fcfa788f2(arg0, arg1) {
|
|
233
432
|
const obj = arg1;
|
|
234
433
|
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
235
434
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -237,26 +436,30 @@ export function __wbg___wbindgen_string_get_395e606bd0ee4427(arg0, arg1) {
|
|
|
237
436
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
238
437
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
239
438
|
}
|
|
240
|
-
export function
|
|
439
|
+
export function __wbg___wbindgen_throw_81fc77679af83bc6(arg0, arg1) {
|
|
241
440
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
242
441
|
}
|
|
243
|
-
export function
|
|
442
|
+
export function __wbg_call_7f2987183bb62793() { return handleError(function (arg0, arg1) {
|
|
244
443
|
const ret = arg0.call(arg1);
|
|
245
444
|
return ret;
|
|
246
445
|
}, arguments); }
|
|
247
|
-
export function
|
|
446
|
+
export function __wbg_done_547d467e97529006(arg0) {
|
|
248
447
|
const ret = arg0.done;
|
|
249
448
|
return ret;
|
|
250
449
|
}
|
|
251
|
-
export function
|
|
450
|
+
export function __wbg_get_ed0642c4b9d31ddf() { return handleError(function (arg0, arg1) {
|
|
252
451
|
const ret = Reflect.get(arg0, arg1);
|
|
253
452
|
return ret;
|
|
254
453
|
}, arguments); }
|
|
255
|
-
export function
|
|
454
|
+
export function __wbg_get_unchecked_7d7babe32e9e6a54(arg0, arg1) {
|
|
256
455
|
const ret = arg0[arg1 >>> 0];
|
|
257
456
|
return ret;
|
|
258
457
|
}
|
|
259
|
-
export function
|
|
458
|
+
export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
459
|
+
const ret = arg0[arg1];
|
|
460
|
+
return ret;
|
|
461
|
+
}
|
|
462
|
+
export function __wbg_instanceof_ArrayBuffer_ff7c1337a5e3b33a(arg0) {
|
|
260
463
|
let result;
|
|
261
464
|
try {
|
|
262
465
|
result = arg0 instanceof ArrayBuffer;
|
|
@@ -266,7 +469,7 @@ export function __wbg_instanceof_ArrayBuffer_101e2bf31071a9f6(arg0) {
|
|
|
266
469
|
const ret = result;
|
|
267
470
|
return ret;
|
|
268
471
|
}
|
|
269
|
-
export function
|
|
472
|
+
export function __wbg_instanceof_Uint8Array_4b8da683deb25d72(arg0) {
|
|
270
473
|
let result;
|
|
271
474
|
try {
|
|
272
475
|
result = arg0 instanceof Uint8Array;
|
|
@@ -276,52 +479,52 @@ export function __wbg_instanceof_Uint8Array_740438561a5b956d(arg0) {
|
|
|
276
479
|
const ret = result;
|
|
277
480
|
return ret;
|
|
278
481
|
}
|
|
279
|
-
export function
|
|
482
|
+
export function __wbg_isArray_db61795ad004c139(arg0) {
|
|
280
483
|
const ret = Array.isArray(arg0);
|
|
281
484
|
return ret;
|
|
282
485
|
}
|
|
283
|
-
export function
|
|
486
|
+
export function __wbg_iterator_de403ef31815a3e6() {
|
|
284
487
|
const ret = Symbol.iterator;
|
|
285
488
|
return ret;
|
|
286
489
|
}
|
|
287
|
-
export function
|
|
490
|
+
export function __wbg_length_0c32cb8543c8e4c8(arg0) {
|
|
288
491
|
const ret = arg0.length;
|
|
289
492
|
return ret;
|
|
290
493
|
}
|
|
291
|
-
export function
|
|
494
|
+
export function __wbg_length_6e821edde497a532(arg0) {
|
|
292
495
|
const ret = arg0.length;
|
|
293
496
|
return ret;
|
|
294
497
|
}
|
|
295
|
-
export function
|
|
498
|
+
export function __wbg_new_4f9fafbb3909af72() {
|
|
499
|
+
const ret = new Object();
|
|
500
|
+
return ret;
|
|
501
|
+
}
|
|
502
|
+
export function __wbg_new_a560378ea1240b14(arg0) {
|
|
296
503
|
const ret = new Uint8Array(arg0);
|
|
297
504
|
return ret;
|
|
298
505
|
}
|
|
299
|
-
export function
|
|
506
|
+
export function __wbg_new_f3c9df4f38f3f798() {
|
|
300
507
|
const ret = new Array();
|
|
301
508
|
return ret;
|
|
302
509
|
}
|
|
303
|
-
export function
|
|
304
|
-
const ret =
|
|
510
|
+
export function __wbg_next_01132ed6134b8ef5(arg0) {
|
|
511
|
+
const ret = arg0.next;
|
|
305
512
|
return ret;
|
|
306
513
|
}
|
|
307
|
-
export function
|
|
514
|
+
export function __wbg_next_b3713ec761a9dbfd() { return handleError(function (arg0) {
|
|
308
515
|
const ret = arg0.next();
|
|
309
516
|
return ret;
|
|
310
517
|
}, arguments); }
|
|
311
|
-
export function
|
|
312
|
-
const ret = arg0.next;
|
|
313
|
-
return ret;
|
|
314
|
-
}
|
|
315
|
-
export function __wbg_prototypesetcall_d62e5099504357e6(arg0, arg1, arg2) {
|
|
518
|
+
export function __wbg_prototypesetcall_3e05eb9545565046(arg0, arg1, arg2) {
|
|
316
519
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
317
520
|
}
|
|
318
|
-
export function __wbg_set_282384002438957f(arg0, arg1, arg2) {
|
|
319
|
-
arg0[arg1 >>> 0] = arg2;
|
|
320
|
-
}
|
|
321
521
|
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
322
522
|
arg0[arg1] = arg2;
|
|
323
523
|
}
|
|
324
|
-
export function
|
|
524
|
+
export function __wbg_set_6c60b2e8ad0e9383(arg0, arg1, arg2) {
|
|
525
|
+
arg0[arg1 >>> 0] = arg2;
|
|
526
|
+
}
|
|
527
|
+
export function __wbg_value_7f6052747ccf940f(arg0) {
|
|
325
528
|
const ret = arg0.value;
|
|
326
529
|
return ret;
|
|
327
530
|
}
|
package/u_doe_bg.wasm
CHANGED
|
Binary file
|