@elaraai/e3-ui 1.0.11 → 1.0.13
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/dist/src/experiment/index.d.ts +694 -0
- package/dist/src/experiment/index.d.ts.map +1 -0
- package/dist/src/experiment/index.js +147 -0
- package/dist/src/experiment/index.js.map +1 -0
- package/dist/src/experiment/types.d.ts +575 -0
- package/dist/src/experiment/types.d.ts.map +1 -0
- package/dist/src/experiment/types.js +292 -0
- package/dist/src/experiment/types.js.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +7 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal.d.ts +1 -0
- package/dist/src/internal.d.ts.map +1 -1
- package/dist/src/internal.js +3 -0
- package/dist/src/internal.js.map +1 -1
- package/dist/src/runtime/experiment.d.ts +48 -0
- package/dist/src/runtime/experiment.d.ts.map +1 -0
- package/dist/src/runtime/experiment.js +10 -0
- package/dist/src/runtime/experiment.js.map +1 -0
- package/dist/src/runtime/index.d.ts +1 -0
- package/dist/src/runtime/index.d.ts.map +1 -1
- package/dist/src/runtime/index.js +1 -0
- package/dist/src/runtime/index.js.map +1 -1
- package/dist/test/experiment/experiment.examples.d.ts +294 -0
- package/dist/test/experiment/experiment.examples.d.ts.map +1 -0
- package/dist/test/experiment/experiment.examples.js +208 -0
- package/dist/test/experiment/experiment.examples.js.map +1 -0
- package/package.json +7 -7
- package/dist/src/buttons.d.ts +0 -2
- package/dist/src/buttons.d.ts.map +0 -1
- package/dist/src/buttons.js +0 -2
- package/dist/src/buttons.js.map +0 -1
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* The `Experiment` render contract.
|
|
7
|
+
*
|
|
8
|
+
* These types are **replicated verbatim (snake_case)** from
|
|
9
|
+
* `east-py-datascience`'s `Causal.Types.*`, so the engine's `Causal.experiment`
|
|
10
|
+
* result unifies **structurally** with the component's binding — replicate, don't
|
|
11
|
+
* share (East type equality is structural; `e3-ui` never imports
|
|
12
|
+
* `east-py-datascience`). Keep these byte-identical to the datascience
|
|
13
|
+
* definitions — they are kept in sync by hand.
|
|
14
|
+
*
|
|
15
|
+
* The user edits an {@link ExperimentConfigType} (the staged "question + method")
|
|
16
|
+
* and **Apply** runs the one bound `experiment` function, which returns an
|
|
17
|
+
* {@link ExperimentResultType} — the naive vs adjusted effect, confounder
|
|
18
|
+
* balance, propensity overlap, a robustness summary, and an honesty
|
|
19
|
+
* {@link ExperimentVerdictType}. `adjusted` is `none` when the engine refuses.
|
|
20
|
+
*
|
|
21
|
+
* @packageDocumentation
|
|
22
|
+
*/
|
|
23
|
+
import { StructType, VariantType, OptionType, ArrayType, DictType, FloatType, IntegerType, BooleanType, StringType, NullType, DateTimeType, VectorType } from '@elaraai/east';
|
|
24
|
+
/** A confidence interval. */
|
|
25
|
+
export declare const CiType: StructType<{
|
|
26
|
+
readonly lower: FloatType;
|
|
27
|
+
readonly upper: FloatType;
|
|
28
|
+
}>;
|
|
29
|
+
/** Type alias for {@link CiType}. */
|
|
30
|
+
export type CiType = typeof CiType;
|
|
31
|
+
/** Inverse-propensity weighting scheme. */
|
|
32
|
+
export declare const WeightingSchemeType: VariantType<{
|
|
33
|
+
readonly ips_weight: NullType;
|
|
34
|
+
readonly ips_stabilized_weight: NullType;
|
|
35
|
+
readonly ips_normalized_weight: NullType;
|
|
36
|
+
}>;
|
|
37
|
+
/** Type alias for {@link WeightingSchemeType}. */
|
|
38
|
+
export type WeightingSchemeType = typeof WeightingSchemeType;
|
|
39
|
+
/** Backdoor-adjusted effect estimator. */
|
|
40
|
+
export declare const EstimatorType: VariantType<{
|
|
41
|
+
readonly linear_regression: NullType;
|
|
42
|
+
readonly propensity_score_weighting: StructType<{
|
|
43
|
+
readonly weighting_scheme: OptionType<VariantType<{
|
|
44
|
+
readonly ips_weight: NullType;
|
|
45
|
+
readonly ips_stabilized_weight: NullType;
|
|
46
|
+
readonly ips_normalized_weight: NullType;
|
|
47
|
+
}>>;
|
|
48
|
+
}>;
|
|
49
|
+
}>;
|
|
50
|
+
/** Type alias for {@link EstimatorType}. */
|
|
51
|
+
export type EstimatorType = typeof EstimatorType;
|
|
52
|
+
/** Population the effect is reported for. */
|
|
53
|
+
export declare const TargetUnitsType: VariantType<{
|
|
54
|
+
readonly ate: NullType;
|
|
55
|
+
readonly att: NullType;
|
|
56
|
+
readonly atc: NullType;
|
|
57
|
+
}>;
|
|
58
|
+
/** Type alias for {@link TargetUnitsType}. */
|
|
59
|
+
export type TargetUnitsType = typeof TargetUnitsType;
|
|
60
|
+
/** Bootstrap confidence-interval configuration. */
|
|
61
|
+
export declare const BootstrapConfigType: StructType<{
|
|
62
|
+
readonly reps: IntegerType;
|
|
63
|
+
readonly cluster_column: OptionType<StringType>;
|
|
64
|
+
readonly confidence_level: OptionType<FloatType>;
|
|
65
|
+
}>;
|
|
66
|
+
/** Type alias for {@link BootstrapConfigType}. */
|
|
67
|
+
export type BootstrapConfigType = typeof BootstrapConfigType;
|
|
68
|
+
/** Which robustness checks to run. */
|
|
69
|
+
export declare const RefuteSpecType: StructType<{
|
|
70
|
+
/** Permuted-treatment negative control — a real effect should vanish. */
|
|
71
|
+
readonly placebo: BooleanType;
|
|
72
|
+
/** Inject an independent random common cause — the effect should hold. */
|
|
73
|
+
readonly random_common_cause: BooleanType;
|
|
74
|
+
/** Re-estimate on random subsamples — the effect should be stable. */
|
|
75
|
+
readonly data_subset: BooleanType;
|
|
76
|
+
/** Unobserved-confounder strengths to simulate → the sensitivity / tipping curve. */
|
|
77
|
+
readonly sensitivity: OptionType<ArrayType<FloatType>>;
|
|
78
|
+
}>;
|
|
79
|
+
/** Type alias for {@link RefuteSpecType}. */
|
|
80
|
+
export type RefuteSpecType = typeof RefuteSpecType;
|
|
81
|
+
/**
|
|
82
|
+
* The experiment the user framed — the staged value the pickers write and
|
|
83
|
+
* **Apply** feeds to the bound `experiment` function.
|
|
84
|
+
*
|
|
85
|
+
* `treatment` / `outcome` / `common_causes` / `categorical` are **column names**
|
|
86
|
+
* introspected from the bound dataset's row struct (the `Table` pattern). The
|
|
87
|
+
* `method` / `estimand` advanced choices and the `min_*` guard thresholds are
|
|
88
|
+
* optional developer-defaulted, user-adjustable knobs.
|
|
89
|
+
*/
|
|
90
|
+
export declare const ExperimentConfigType: StructType<{
|
|
91
|
+
readonly treatment: StringType;
|
|
92
|
+
readonly outcome: StringType;
|
|
93
|
+
readonly common_causes: ArrayType<StringType>;
|
|
94
|
+
readonly categorical: OptionType<ArrayType<StringType>>;
|
|
95
|
+
readonly method: OptionType<VariantType<{
|
|
96
|
+
readonly linear_regression: NullType;
|
|
97
|
+
readonly propensity_score_weighting: StructType<{
|
|
98
|
+
readonly weighting_scheme: OptionType<VariantType<{
|
|
99
|
+
readonly ips_weight: NullType;
|
|
100
|
+
readonly ips_stabilized_weight: NullType;
|
|
101
|
+
readonly ips_normalized_weight: NullType;
|
|
102
|
+
}>>;
|
|
103
|
+
}>;
|
|
104
|
+
}>>;
|
|
105
|
+
readonly estimand: OptionType<VariantType<{
|
|
106
|
+
readonly ate: NullType;
|
|
107
|
+
readonly att: NullType;
|
|
108
|
+
readonly atc: NullType;
|
|
109
|
+
}>>;
|
|
110
|
+
readonly refute: OptionType<StructType<{
|
|
111
|
+
/** Permuted-treatment negative control — a real effect should vanish. */
|
|
112
|
+
readonly placebo: BooleanType;
|
|
113
|
+
/** Inject an independent random common cause — the effect should hold. */
|
|
114
|
+
readonly random_common_cause: BooleanType;
|
|
115
|
+
/** Re-estimate on random subsamples — the effect should be stable. */
|
|
116
|
+
readonly data_subset: BooleanType;
|
|
117
|
+
/** Unobserved-confounder strengths to simulate → the sensitivity / tipping curve. */
|
|
118
|
+
readonly sensitivity: OptionType<ArrayType<FloatType>>;
|
|
119
|
+
}>>;
|
|
120
|
+
/** Continuous column for the ALE dose-response curve (the "How much?" view). */
|
|
121
|
+
readonly dose_feature: OptionType<StringType>;
|
|
122
|
+
readonly min_overlap: OptionType<FloatType>;
|
|
123
|
+
readonly min_treatment_variation: OptionType<FloatType>;
|
|
124
|
+
readonly bootstrap: OptionType<StructType<{
|
|
125
|
+
readonly reps: IntegerType;
|
|
126
|
+
readonly cluster_column: OptionType<StringType>;
|
|
127
|
+
readonly confidence_level: OptionType<FloatType>;
|
|
128
|
+
}>>;
|
|
129
|
+
readonly random_state: OptionType<IntegerType>;
|
|
130
|
+
}>;
|
|
131
|
+
/** Type alias for {@link ExperimentConfigType}. */
|
|
132
|
+
export type ExperimentConfigType = typeof ExperimentConfigType;
|
|
133
|
+
/** One confounder's before-adjustment imbalance (categoricals → one row per level). */
|
|
134
|
+
export declare const BalanceRowType: StructType<{
|
|
135
|
+
readonly column: StringType;
|
|
136
|
+
/** The original confounder this row belongs to — equals `column` for a numeric
|
|
137
|
+
* confounder; the base confounder for a one-hot categorical level. */
|
|
138
|
+
readonly base_column: StringType;
|
|
139
|
+
readonly treated_mean: FloatType;
|
|
140
|
+
readonly control_mean: FloatType;
|
|
141
|
+
readonly std_diff: FloatType;
|
|
142
|
+
}>;
|
|
143
|
+
/** Type alias for {@link BalanceRowType}. */
|
|
144
|
+
export type BalanceRowType = typeof BalanceRowType;
|
|
145
|
+
/** Positivity / common-support diagnostic (binary treatment). */
|
|
146
|
+
export declare const OverlapDiagnosticType: StructType<{
|
|
147
|
+
readonly treated_propensity: VectorType<FloatType>;
|
|
148
|
+
readonly control_propensity: VectorType<FloatType>;
|
|
149
|
+
readonly common_support_frac: FloatType;
|
|
150
|
+
readonly positivity_ok: BooleanType;
|
|
151
|
+
}>;
|
|
152
|
+
/** Type alias for {@link OverlapDiagnosticType}. */
|
|
153
|
+
export type OverlapDiagnosticType = typeof OverlapDiagnosticType;
|
|
154
|
+
/** The robustness summary the verdict + trust tab consume. */
|
|
155
|
+
export declare const RefutationType: StructType<{
|
|
156
|
+
/** Effect under a permuted (placebo) treatment — should be ≈ 0. */
|
|
157
|
+
readonly placebo_effect: OptionType<FloatType>;
|
|
158
|
+
/** Whether the placebo effect vanished. */
|
|
159
|
+
readonly placebo_passes: OptionType<BooleanType>;
|
|
160
|
+
/** Whether a decoy random common cause left the estimate inside its CI. */
|
|
161
|
+
readonly random_cc_within_ci: OptionType<BooleanType>;
|
|
162
|
+
/** Mean effect across data subsamples (stability). */
|
|
163
|
+
readonly data_subset_effect: OptionType<FloatType>;
|
|
164
|
+
/** Std of the effect across data subsamples. */
|
|
165
|
+
readonly data_subset_std: OptionType<FloatType>;
|
|
166
|
+
/** Closed-form E-value — confounder strength needed to explain the effect away. */
|
|
167
|
+
readonly robustness_value: OptionType<FloatType>;
|
|
168
|
+
/** Unobserved-confounder sensitivity (tipping) curve: effect at each simulated strength. */
|
|
169
|
+
readonly sensitivity: OptionType<StructType<{
|
|
170
|
+
readonly strengths: VectorType<FloatType>;
|
|
171
|
+
readonly effects: VectorType<FloatType>;
|
|
172
|
+
}>>;
|
|
173
|
+
}>;
|
|
174
|
+
/** Type alias for {@link RefutationType}. */
|
|
175
|
+
export type RefutationType = typeof RefutationType;
|
|
176
|
+
/** A dose-response (ALE) curve of a continuous feature on the outcome. */
|
|
177
|
+
export declare const DoseResponseType: StructType<{
|
|
178
|
+
readonly feature: StringType;
|
|
179
|
+
readonly grid: VectorType<FloatType>;
|
|
180
|
+
readonly effect: VectorType<FloatType>;
|
|
181
|
+
readonly lower: OptionType<VectorType<FloatType>>;
|
|
182
|
+
readonly upper: OptionType<VectorType<FloatType>>;
|
|
183
|
+
/** Rows per dose bin — drives the surface's "you are here" (busiest bin) marker. */
|
|
184
|
+
readonly size: VectorType<IntegerType>;
|
|
185
|
+
}>;
|
|
186
|
+
/** Type alias for {@link DoseResponseType}. */
|
|
187
|
+
export type DoseResponseType = typeof DoseResponseType;
|
|
188
|
+
/**
|
|
189
|
+
* The honesty verdict — a thin tag; the numbers live top-level on the result.
|
|
190
|
+
* Only `not_estimable` carries a human-readable reason.
|
|
191
|
+
*/
|
|
192
|
+
export declare const ExperimentVerdictType: VariantType<{
|
|
193
|
+
readonly causal: NullType;
|
|
194
|
+
readonly modest: NullType;
|
|
195
|
+
readonly adjustment_insufficient: NullType;
|
|
196
|
+
readonly non_identifiable_positivity: NullType;
|
|
197
|
+
readonly not_estimable: StringType;
|
|
198
|
+
}>;
|
|
199
|
+
/** Type alias for {@link ExperimentVerdictType}. */
|
|
200
|
+
export type ExperimentVerdictType = typeof ExperimentVerdictType;
|
|
201
|
+
/**
|
|
202
|
+
* The complete, honest result. `adjusted` is `none` when the engine refuses
|
|
203
|
+
* (positivity / no-variation); the `verdict` tag carries the headline; every
|
|
204
|
+
* word/colour on the surface is derived from these numbers.
|
|
205
|
+
*/
|
|
206
|
+
export declare const ExperimentResultType: StructType<{
|
|
207
|
+
readonly naive: FloatType;
|
|
208
|
+
readonly naive_ci: OptionType<StructType<{
|
|
209
|
+
readonly lower: FloatType;
|
|
210
|
+
readonly upper: FloatType;
|
|
211
|
+
}>>;
|
|
212
|
+
readonly adjusted: OptionType<StructType<{
|
|
213
|
+
readonly effect: FloatType;
|
|
214
|
+
readonly ci: OptionType<StructType<{
|
|
215
|
+
readonly lower: FloatType;
|
|
216
|
+
readonly upper: FloatType;
|
|
217
|
+
}>>;
|
|
218
|
+
}>>;
|
|
219
|
+
readonly n_total: IntegerType;
|
|
220
|
+
readonly n_treated: IntegerType;
|
|
221
|
+
readonly n_control: IntegerType;
|
|
222
|
+
readonly n_dropped: IntegerType;
|
|
223
|
+
readonly balance: ArrayType<StructType<{
|
|
224
|
+
readonly column: StringType;
|
|
225
|
+
/** The original confounder this row belongs to — equals `column` for a numeric
|
|
226
|
+
* confounder; the base confounder for a one-hot categorical level. */
|
|
227
|
+
readonly base_column: StringType;
|
|
228
|
+
readonly treated_mean: FloatType;
|
|
229
|
+
readonly control_mean: FloatType;
|
|
230
|
+
readonly std_diff: FloatType;
|
|
231
|
+
}>>;
|
|
232
|
+
readonly overlap: StructType<{
|
|
233
|
+
readonly treated_propensity: VectorType<FloatType>;
|
|
234
|
+
readonly control_propensity: VectorType<FloatType>;
|
|
235
|
+
readonly common_support_frac: FloatType;
|
|
236
|
+
readonly positivity_ok: BooleanType;
|
|
237
|
+
}>;
|
|
238
|
+
readonly refutation: OptionType<StructType<{
|
|
239
|
+
/** Effect under a permuted (placebo) treatment — should be ≈ 0. */
|
|
240
|
+
readonly placebo_effect: OptionType<FloatType>;
|
|
241
|
+
/** Whether the placebo effect vanished. */
|
|
242
|
+
readonly placebo_passes: OptionType<BooleanType>;
|
|
243
|
+
/** Whether a decoy random common cause left the estimate inside its CI. */
|
|
244
|
+
readonly random_cc_within_ci: OptionType<BooleanType>;
|
|
245
|
+
/** Mean effect across data subsamples (stability). */
|
|
246
|
+
readonly data_subset_effect: OptionType<FloatType>;
|
|
247
|
+
/** Std of the effect across data subsamples. */
|
|
248
|
+
readonly data_subset_std: OptionType<FloatType>;
|
|
249
|
+
/** Closed-form E-value — confounder strength needed to explain the effect away. */
|
|
250
|
+
readonly robustness_value: OptionType<FloatType>;
|
|
251
|
+
/** Unobserved-confounder sensitivity (tipping) curve: effect at each simulated strength. */
|
|
252
|
+
readonly sensitivity: OptionType<StructType<{
|
|
253
|
+
readonly strengths: VectorType<FloatType>;
|
|
254
|
+
readonly effects: VectorType<FloatType>;
|
|
255
|
+
}>>;
|
|
256
|
+
}>>;
|
|
257
|
+
/** ALE dose-response of `dose_feature` (present when `config.dose_feature` is set). */
|
|
258
|
+
readonly dose_response: OptionType<StructType<{
|
|
259
|
+
readonly feature: StringType;
|
|
260
|
+
readonly grid: VectorType<FloatType>;
|
|
261
|
+
readonly effect: VectorType<FloatType>;
|
|
262
|
+
readonly lower: OptionType<VectorType<FloatType>>;
|
|
263
|
+
readonly upper: OptionType<VectorType<FloatType>>;
|
|
264
|
+
/** Rows per dose bin — drives the surface's "you are here" (busiest bin) marker. */
|
|
265
|
+
readonly size: VectorType<IntegerType>;
|
|
266
|
+
}>>;
|
|
267
|
+
readonly verdict: VariantType<{
|
|
268
|
+
readonly causal: NullType;
|
|
269
|
+
readonly modest: NullType;
|
|
270
|
+
readonly adjustment_insufficient: NullType;
|
|
271
|
+
readonly non_identifiable_positivity: NullType;
|
|
272
|
+
readonly not_estimable: StringType;
|
|
273
|
+
}>;
|
|
274
|
+
}>;
|
|
275
|
+
/** Type alias for {@link ExperimentResultType}. */
|
|
276
|
+
export type ExperimentResultType = typeof ExperimentResultType;
|
|
277
|
+
/**
|
|
278
|
+
* Why the trial is sized the way it is — set from the verdict, so the tab's
|
|
279
|
+
* headline + visuals change with the result rather than reading the same twice.
|
|
280
|
+
*/
|
|
281
|
+
export declare const DesignBasisType: VariantType<{
|
|
282
|
+
/** Clear effect → power the trial to detect the *observed* effect. */
|
|
283
|
+
readonly detect_observed: NullType;
|
|
284
|
+
/** Fuzzy / maybe-nothing → power to the smallest effect worth acting on. */
|
|
285
|
+
readonly resolve_vs_null: NullType;
|
|
286
|
+
/** A trust check failed → randomise to remove the bias adjustment couldn't. */
|
|
287
|
+
readonly de_bias: NullType;
|
|
288
|
+
/** No overlap → randomise within the comparable range. */
|
|
289
|
+
readonly restrict_to_overlap: NullType;
|
|
290
|
+
/** No control group exists → hold back a random sample next time. */
|
|
291
|
+
readonly create_control: NullType;
|
|
292
|
+
}>;
|
|
293
|
+
/** Type alias for {@link DesignBasisType}. */
|
|
294
|
+
export type DesignBasisType = typeof DesignBasisType;
|
|
295
|
+
/** One sizing option — a split and the head-count it needs (even split first). */
|
|
296
|
+
export declare const TrialOptionType: StructType<{
|
|
297
|
+
/** Plain label, e.g. "Even split" / "Treat fewer". */
|
|
298
|
+
readonly label: StringType;
|
|
299
|
+
/** Fraction assigned to the treatment (0..1; 0.5 = even). */
|
|
300
|
+
readonly treated_share: FloatType;
|
|
301
|
+
readonly n_treated: IntegerType;
|
|
302
|
+
readonly n_control: IntegerType;
|
|
303
|
+
readonly n_total: IntegerType;
|
|
304
|
+
}>;
|
|
305
|
+
/** Type alias for {@link TrialOptionType}. */
|
|
306
|
+
export type TrialOptionType = typeof TrialOptionType;
|
|
307
|
+
/** The "chance of detecting it" curve — total head-count → power (0..1). */
|
|
308
|
+
export declare const PowerCurveType: StructType<{
|
|
309
|
+
readonly n: VectorType<IntegerType>;
|
|
310
|
+
readonly power: VectorType<FloatType>;
|
|
311
|
+
}>;
|
|
312
|
+
/** Type alias for {@link PowerCurveType}. */
|
|
313
|
+
export type PowerCurveType = typeof PowerCurveType;
|
|
314
|
+
/**
|
|
315
|
+
* The validation-trial recipe — a randomised controlled trial sized from the
|
|
316
|
+
* observed effect (or the materiality threshold) and the outcome spread, with
|
|
317
|
+
* the groups matched on the confounders that were most imbalanced. Everything
|
|
318
|
+
* the "Validate" tab paints is derived from these fields.
|
|
319
|
+
*/
|
|
320
|
+
export declare const ExperimentDesignType: StructType<{
|
|
321
|
+
/** The verdict that drove the recommendation (echoed for framing). */
|
|
322
|
+
readonly verdict: VariantType<{
|
|
323
|
+
readonly causal: NullType;
|
|
324
|
+
readonly modest: NullType;
|
|
325
|
+
readonly adjustment_insufficient: NullType;
|
|
326
|
+
readonly non_identifiable_positivity: NullType;
|
|
327
|
+
readonly not_estimable: StringType;
|
|
328
|
+
}>;
|
|
329
|
+
readonly basis: VariantType<{
|
|
330
|
+
/** Clear effect → power the trial to detect the *observed* effect. */
|
|
331
|
+
readonly detect_observed: NullType;
|
|
332
|
+
/** Fuzzy / maybe-nothing → power to the smallest effect worth acting on. */
|
|
333
|
+
readonly resolve_vs_null: NullType;
|
|
334
|
+
/** A trust check failed → randomise to remove the bias adjustment couldn't. */
|
|
335
|
+
readonly de_bias: NullType;
|
|
336
|
+
/** No overlap → randomise within the comparable range. */
|
|
337
|
+
readonly restrict_to_overlap: NullType;
|
|
338
|
+
/** No control group exists → hold back a random sample next time. */
|
|
339
|
+
readonly create_control: NullType;
|
|
340
|
+
}>;
|
|
341
|
+
/** The effect size the trial is powered to detect (observed, or materiality). */
|
|
342
|
+
readonly target_effect: FloatType;
|
|
343
|
+
/** Outcome spread (pooled SD) used to size it. */
|
|
344
|
+
readonly outcome_sd: FloatType;
|
|
345
|
+
readonly target_power: FloatType;
|
|
346
|
+
readonly alpha: FloatType;
|
|
347
|
+
/** Chance the CURRENT sample would already detect `target_effect` (the "you're here" marker); `none` when there's no comparison group. */
|
|
348
|
+
readonly current_power: OptionType<FloatType>;
|
|
349
|
+
/** Categories both groups must be matched on (the most-imbalanced confounders). */
|
|
350
|
+
readonly match_on: ArrayType<StringType>;
|
|
351
|
+
/** Ranked split options (even split first; cost-saving alternates). */
|
|
352
|
+
readonly options: ArrayType<StructType<{
|
|
353
|
+
/** Plain label, e.g. "Even split" / "Treat fewer". */
|
|
354
|
+
readonly label: StringType;
|
|
355
|
+
/** Fraction assigned to the treatment (0..1; 0.5 = even). */
|
|
356
|
+
readonly treated_share: FloatType;
|
|
357
|
+
readonly n_treated: IntegerType;
|
|
358
|
+
readonly n_control: IntegerType;
|
|
359
|
+
readonly n_total: IntegerType;
|
|
360
|
+
}>>;
|
|
361
|
+
/** The detect-chance curve for the chart. */
|
|
362
|
+
readonly power_curve: StructType<{
|
|
363
|
+
readonly n: VectorType<IntegerType>;
|
|
364
|
+
readonly power: VectorType<FloatType>;
|
|
365
|
+
}>;
|
|
366
|
+
/** One generated, plain-language sentence framing the recipe. */
|
|
367
|
+
readonly rationale: StringType;
|
|
368
|
+
}>;
|
|
369
|
+
/** Type alias for {@link ExperimentDesignType}. */
|
|
370
|
+
export type ExperimentDesignType = typeof ExperimentDesignType;
|
|
371
|
+
/** Optional knobs `Causal.designValidation` accepts (all developer-defaulted). */
|
|
372
|
+
export declare const DesignConfigType: StructType<{
|
|
373
|
+
/** Significance level (default 0.05). */
|
|
374
|
+
readonly alpha: OptionType<FloatType>;
|
|
375
|
+
/** Target chance of detecting the effect (default 0.8). */
|
|
376
|
+
readonly target_power: OptionType<FloatType>;
|
|
377
|
+
/** Smallest effect worth acting on — sizes the trial to this when set / when there's no trustworthy observed effect. */
|
|
378
|
+
readonly materiality: OptionType<FloatType>;
|
|
379
|
+
/** Treatment shares to offer as options (default [0.5]). */
|
|
380
|
+
readonly treated_shares: OptionType<ArrayType<FloatType>>;
|
|
381
|
+
}>;
|
|
382
|
+
/** Type alias for {@link DesignConfigType}. */
|
|
383
|
+
export type DesignConfigType = typeof DesignConfigType;
|
|
384
|
+
/**
|
|
385
|
+
* The UI-side population filter — a set of {@link Slice} predicates the Step-4
|
|
386
|
+
* rail edits. It narrows the rows **client-side, before** the `experiment` call,
|
|
387
|
+
* so it is deliberately **not** a field of {@link ExperimentConfigType} (the
|
|
388
|
+
* bound function never sees it; the config stays byte-identical to the causal
|
|
389
|
+
* library's contract). Bound as its own optional staged dataset so a surface can
|
|
390
|
+
* seed / persist / commit the framing filters.
|
|
391
|
+
*/
|
|
392
|
+
export declare const PopulationType: ArrayType<VariantType<{
|
|
393
|
+
readonly string: import("@elaraai/east").StructType<{
|
|
394
|
+
readonly fieldId: import("@elaraai/east").StringType;
|
|
395
|
+
readonly op: import("@elaraai/east").VariantType<{
|
|
396
|
+
readonly eq: import("@elaraai/east").StringType;
|
|
397
|
+
readonly neq: import("@elaraai/east").StringType;
|
|
398
|
+
readonly in: import("@elaraai/east").SetType<import("@elaraai/east").StringType>;
|
|
399
|
+
readonly notIn: import("@elaraai/east").SetType<import("@elaraai/east").StringType>;
|
|
400
|
+
readonly contains: import("@elaraai/east").StringType;
|
|
401
|
+
readonly matches: import("@elaraai/east").StringType;
|
|
402
|
+
}>;
|
|
403
|
+
}>;
|
|
404
|
+
readonly integer: import("@elaraai/east").StructType<{
|
|
405
|
+
readonly fieldId: import("@elaraai/east").StringType;
|
|
406
|
+
readonly op: import("@elaraai/east").VariantType<{
|
|
407
|
+
readonly eq: import("@elaraai/east").IntegerType;
|
|
408
|
+
readonly neq: import("@elaraai/east").IntegerType;
|
|
409
|
+
readonly lt: import("@elaraai/east").IntegerType;
|
|
410
|
+
readonly lte: import("@elaraai/east").IntegerType;
|
|
411
|
+
readonly gt: import("@elaraai/east").IntegerType;
|
|
412
|
+
readonly gte: import("@elaraai/east").IntegerType;
|
|
413
|
+
readonly in: import("@elaraai/east").SetType<import("@elaraai/east").IntegerType>;
|
|
414
|
+
}>;
|
|
415
|
+
}>;
|
|
416
|
+
readonly float: import("@elaraai/east").StructType<{
|
|
417
|
+
readonly fieldId: import("@elaraai/east").StringType;
|
|
418
|
+
readonly op: import("@elaraai/east").VariantType<{
|
|
419
|
+
readonly lt: import("@elaraai/east").FloatType;
|
|
420
|
+
readonly lte: import("@elaraai/east").FloatType;
|
|
421
|
+
readonly gt: import("@elaraai/east").FloatType;
|
|
422
|
+
readonly gte: import("@elaraai/east").FloatType;
|
|
423
|
+
}>;
|
|
424
|
+
}>;
|
|
425
|
+
readonly datetime: import("@elaraai/east").StructType<{
|
|
426
|
+
readonly fieldId: import("@elaraai/east").StringType;
|
|
427
|
+
readonly op: import("@elaraai/east").VariantType<{
|
|
428
|
+
readonly before: import("@elaraai/east").DateTimeType;
|
|
429
|
+
readonly after: import("@elaraai/east").DateTimeType;
|
|
430
|
+
readonly between: import("@elaraai/east").StructType<{
|
|
431
|
+
readonly from: import("@elaraai/east").DateTimeType;
|
|
432
|
+
readonly to: import("@elaraai/east").DateTimeType;
|
|
433
|
+
}>;
|
|
434
|
+
}>;
|
|
435
|
+
}>;
|
|
436
|
+
readonly boolean: import("@elaraai/east").StructType<{
|
|
437
|
+
readonly fieldId: import("@elaraai/east").StringType;
|
|
438
|
+
readonly op: import("@elaraai/east").VariantType<{
|
|
439
|
+
readonly is: import("@elaraai/east").BooleanType;
|
|
440
|
+
}>;
|
|
441
|
+
}>;
|
|
442
|
+
}>>;
|
|
443
|
+
/** Type alias for {@link PopulationType}. */
|
|
444
|
+
export type PopulationType = typeof PopulationType;
|
|
445
|
+
/**
|
|
446
|
+
* Optional per-column display metadata the developer supplies once. Keyed by
|
|
447
|
+
* column name. Lets the derived prose read "worse" instead of "lower" and show
|
|
448
|
+
* friendly labels / units.
|
|
449
|
+
*/
|
|
450
|
+
export declare const ColumnMetaType: DictType<StringType, StructType<{
|
|
451
|
+
readonly label: OptionType<StringType>;
|
|
452
|
+
readonly unit: OptionType<StringType>;
|
|
453
|
+
readonly higherIsBetter: OptionType<BooleanType>;
|
|
454
|
+
}>>;
|
|
455
|
+
/** Type alias for {@link ColumnMetaType}. */
|
|
456
|
+
export type ColumnMetaType = typeof ColumnMetaType;
|
|
457
|
+
/**
|
|
458
|
+
* A committed experiment in the journal — the framed config + the verdict +
|
|
459
|
+
* headline effect + who committed it when. The renderer derives the verdict
|
|
460
|
+
* words and colour from `verdict` / `adjusted`.
|
|
461
|
+
*/
|
|
462
|
+
export declare const JournalRowType: StructType<{
|
|
463
|
+
readonly config: StructType<{
|
|
464
|
+
readonly treatment: StringType;
|
|
465
|
+
readonly outcome: StringType;
|
|
466
|
+
readonly common_causes: ArrayType<StringType>;
|
|
467
|
+
readonly categorical: OptionType<ArrayType<StringType>>;
|
|
468
|
+
readonly method: OptionType<VariantType<{
|
|
469
|
+
readonly linear_regression: NullType;
|
|
470
|
+
readonly propensity_score_weighting: StructType<{
|
|
471
|
+
readonly weighting_scheme: OptionType<VariantType<{
|
|
472
|
+
readonly ips_weight: NullType;
|
|
473
|
+
readonly ips_stabilized_weight: NullType;
|
|
474
|
+
readonly ips_normalized_weight: NullType;
|
|
475
|
+
}>>;
|
|
476
|
+
}>;
|
|
477
|
+
}>>;
|
|
478
|
+
readonly estimand: OptionType<VariantType<{
|
|
479
|
+
readonly ate: NullType;
|
|
480
|
+
readonly att: NullType;
|
|
481
|
+
readonly atc: NullType;
|
|
482
|
+
}>>;
|
|
483
|
+
readonly refute: OptionType<StructType<{
|
|
484
|
+
/** Permuted-treatment negative control — a real effect should vanish. */
|
|
485
|
+
readonly placebo: BooleanType;
|
|
486
|
+
/** Inject an independent random common cause — the effect should hold. */
|
|
487
|
+
readonly random_common_cause: BooleanType;
|
|
488
|
+
/** Re-estimate on random subsamples — the effect should be stable. */
|
|
489
|
+
readonly data_subset: BooleanType;
|
|
490
|
+
/** Unobserved-confounder strengths to simulate → the sensitivity / tipping curve. */
|
|
491
|
+
readonly sensitivity: OptionType<ArrayType<FloatType>>;
|
|
492
|
+
}>>;
|
|
493
|
+
/** Continuous column for the ALE dose-response curve (the "How much?" view). */
|
|
494
|
+
readonly dose_feature: OptionType<StringType>;
|
|
495
|
+
readonly min_overlap: OptionType<FloatType>;
|
|
496
|
+
readonly min_treatment_variation: OptionType<FloatType>;
|
|
497
|
+
readonly bootstrap: OptionType<StructType<{
|
|
498
|
+
readonly reps: IntegerType;
|
|
499
|
+
readonly cluster_column: OptionType<StringType>;
|
|
500
|
+
readonly confidence_level: OptionType<FloatType>;
|
|
501
|
+
}>>;
|
|
502
|
+
readonly random_state: OptionType<IntegerType>;
|
|
503
|
+
}>;
|
|
504
|
+
readonly verdict: VariantType<{
|
|
505
|
+
readonly causal: NullType;
|
|
506
|
+
readonly modest: NullType;
|
|
507
|
+
readonly adjustment_insufficient: NullType;
|
|
508
|
+
readonly non_identifiable_positivity: NullType;
|
|
509
|
+
readonly not_estimable: StringType;
|
|
510
|
+
}>;
|
|
511
|
+
readonly naive: FloatType;
|
|
512
|
+
readonly adjusted: OptionType<FloatType>;
|
|
513
|
+
readonly committed_at: DateTimeType;
|
|
514
|
+
readonly committed_by: StringType;
|
|
515
|
+
}>;
|
|
516
|
+
/** Type alias for {@link JournalRowType}. */
|
|
517
|
+
export type JournalRowType = typeof JournalRowType;
|
|
518
|
+
/** The journal dataset — committed experiments, newest first. */
|
|
519
|
+
export declare const JournalType: ArrayType<StructType<{
|
|
520
|
+
readonly config: StructType<{
|
|
521
|
+
readonly treatment: StringType;
|
|
522
|
+
readonly outcome: StringType;
|
|
523
|
+
readonly common_causes: ArrayType<StringType>;
|
|
524
|
+
readonly categorical: OptionType<ArrayType<StringType>>;
|
|
525
|
+
readonly method: OptionType<VariantType<{
|
|
526
|
+
readonly linear_regression: NullType;
|
|
527
|
+
readonly propensity_score_weighting: StructType<{
|
|
528
|
+
readonly weighting_scheme: OptionType<VariantType<{
|
|
529
|
+
readonly ips_weight: NullType;
|
|
530
|
+
readonly ips_stabilized_weight: NullType;
|
|
531
|
+
readonly ips_normalized_weight: NullType;
|
|
532
|
+
}>>;
|
|
533
|
+
}>;
|
|
534
|
+
}>>;
|
|
535
|
+
readonly estimand: OptionType<VariantType<{
|
|
536
|
+
readonly ate: NullType;
|
|
537
|
+
readonly att: NullType;
|
|
538
|
+
readonly atc: NullType;
|
|
539
|
+
}>>;
|
|
540
|
+
readonly refute: OptionType<StructType<{
|
|
541
|
+
/** Permuted-treatment negative control — a real effect should vanish. */
|
|
542
|
+
readonly placebo: BooleanType;
|
|
543
|
+
/** Inject an independent random common cause — the effect should hold. */
|
|
544
|
+
readonly random_common_cause: BooleanType;
|
|
545
|
+
/** Re-estimate on random subsamples — the effect should be stable. */
|
|
546
|
+
readonly data_subset: BooleanType;
|
|
547
|
+
/** Unobserved-confounder strengths to simulate → the sensitivity / tipping curve. */
|
|
548
|
+
readonly sensitivity: OptionType<ArrayType<FloatType>>;
|
|
549
|
+
}>>;
|
|
550
|
+
/** Continuous column for the ALE dose-response curve (the "How much?" view). */
|
|
551
|
+
readonly dose_feature: OptionType<StringType>;
|
|
552
|
+
readonly min_overlap: OptionType<FloatType>;
|
|
553
|
+
readonly min_treatment_variation: OptionType<FloatType>;
|
|
554
|
+
readonly bootstrap: OptionType<StructType<{
|
|
555
|
+
readonly reps: IntegerType;
|
|
556
|
+
readonly cluster_column: OptionType<StringType>;
|
|
557
|
+
readonly confidence_level: OptionType<FloatType>;
|
|
558
|
+
}>>;
|
|
559
|
+
readonly random_state: OptionType<IntegerType>;
|
|
560
|
+
}>;
|
|
561
|
+
readonly verdict: VariantType<{
|
|
562
|
+
readonly causal: NullType;
|
|
563
|
+
readonly modest: NullType;
|
|
564
|
+
readonly adjustment_insufficient: NullType;
|
|
565
|
+
readonly non_identifiable_positivity: NullType;
|
|
566
|
+
readonly not_estimable: StringType;
|
|
567
|
+
}>;
|
|
568
|
+
readonly naive: FloatType;
|
|
569
|
+
readonly adjusted: OptionType<FloatType>;
|
|
570
|
+
readonly committed_at: DateTimeType;
|
|
571
|
+
readonly committed_by: StringType;
|
|
572
|
+
}>>;
|
|
573
|
+
/** Type alias for {@link JournalType}. */
|
|
574
|
+
export type JournalType = typeof JournalType;
|
|
575
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/experiment/types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EACH,UAAU,EACV,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,EACR,SAAS,EACT,WAAW,EACX,WAAW,EACX,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,UAAU,EACb,MAAM,eAAe,CAAC;AAOvB,6BAA6B;AAC7B,eAAO,MAAM,MAAM;;;EAAqD,CAAC;AACzE,qCAAqC;AACrC,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC;AAEnC,2CAA2C;AAC3C,eAAO,MAAM,mBAAmB;;;;EAI9B,CAAC;AACH,kDAAkD;AAClD,MAAM,MAAM,mBAAmB,GAAG,OAAO,mBAAmB,CAAC;AAE7D,0CAA0C;AAC1C,eAAO,MAAM,aAAa;;;;;;;;;EAKxB,CAAC;AACH,4CAA4C;AAC5C,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC;AAEjD,6CAA6C;AAC7C,eAAO,MAAM,eAAe;;;;EAI1B,CAAC;AACH,8CAA8C;AAC9C,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC;AAErD,mDAAmD;AACnD,eAAO,MAAM,mBAAmB;;;;EAI9B,CAAC;AACH,kDAAkD;AAClD,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