linreg-core 0.3.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.
@@ -0,0 +1,743 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * Performs the Anderson-Darling test for normality via WASM.
6
+ *
7
+ * The Anderson-Darling test checks whether the residuals are normally distributed
8
+ * by comparing the empirical distribution to the expected normal distribution.
9
+ * This test is particularly sensitive to deviations in the tails of the distribution.
10
+ * A significant p-value suggests that the residuals deviate from normality.
11
+ *
12
+ * # Arguments
13
+ *
14
+ * * `y_json` - JSON array of response variable values
15
+ * * `x_vars_json` - JSON array of predictor arrays
16
+ *
17
+ * # Returns
18
+ *
19
+ * JSON string containing the A² statistic, p-value, and interpretation.
20
+ *
21
+ * # Errors
22
+ *
23
+ * Returns a JSON error object if parsing fails or domain check fails.
24
+ */
25
+ export function anderson_darling_test(y_json: string, x_vars_json: string): string;
26
+
27
+ /**
28
+ * Performs the Breusch-Godfrey test for higher-order serial correlation via WASM.
29
+ *
30
+ * Unlike the Durbin-Watson test which only detects first-order autocorrelation,
31
+ * the Breusch-Godfrey test can detect serial correlation at any lag order.
32
+ *
33
+ * # Arguments
34
+ *
35
+ * * `y_json` - JSON array of response variable values
36
+ * * `x_vars_json` - JSON array of predictor arrays
37
+ * * `order` - Maximum order of serial correlation to test (default: 1)
38
+ * * `test_type` - Type of test statistic: "chisq" or "f" (default: "chisq")
39
+ *
40
+ * # Returns
41
+ *
42
+ * JSON string containing test statistic, p-value, degrees of freedom, and interpretation.
43
+ *
44
+ * # Errors
45
+ *
46
+ * Returns a JSON error object if parsing fails or domain check fails.
47
+ */
48
+ export function breusch_godfrey_test(y_json: string, x_vars_json: string, order: number, test_type: string): string;
49
+
50
+ /**
51
+ * Performs the Breusch-Pagan test for heteroscedasticity via WASM.
52
+ *
53
+ * The Breusch-Pagan test checks whether the variance of residuals is constant
54
+ * across the range of predicted values (homoscedasticity assumption).
55
+ * A significant p-value suggests heteroscedasticity.
56
+ *
57
+ * # Arguments
58
+ *
59
+ * * `y_json` - JSON array of response variable values
60
+ * * `x_vars_json` - JSON array of predictor arrays
61
+ *
62
+ * # Returns
63
+ *
64
+ * JSON string containing test statistic, p-value, and interpretation.
65
+ *
66
+ * # Errors
67
+ *
68
+ * Returns a JSON error object if parsing fails or domain check fails.
69
+ */
70
+ export function breusch_pagan_test(y_json: string, x_vars_json: string): string;
71
+
72
+ /**
73
+ * Computes Cook's distance for identifying influential observations via WASM.
74
+ *
75
+ * Cook's distance measures how much each observation influences the regression
76
+ * model by comparing coefficient estimates with and without that observation.
77
+ * Unlike hypothesis tests, this is an influence measure - not a test with p-values.
78
+ *
79
+ * # Arguments
80
+ *
81
+ * * `y_json` - JSON array of response variable values
82
+ * * `x_vars_json` - JSON array of predictor arrays
83
+ *
84
+ * # Returns
85
+ *
86
+ * JSON string containing:
87
+ * - Vector of Cook's distances (one per observation)
88
+ * - Thresholds for identifying influential observations
89
+ * - Indices of potentially influential observations
90
+ * - Interpretation and guidance
91
+ *
92
+ * # Errors
93
+ *
94
+ * Returns a JSON error object if parsing fails or domain check fails.
95
+ */
96
+ export function cooks_distance_test(y_json: string, x_vars_json: string): string;
97
+
98
+ /**
99
+ * Performs the Durbin-Watson test for autocorrelation via WASM.
100
+ *
101
+ * The Durbin-Watson test checks for autocorrelation in the residuals.
102
+ * Values near 2 indicate no autocorrelation, values near 0 suggest positive
103
+ * autocorrelation, and values near 4 suggest negative autocorrelation.
104
+ *
105
+ * # Arguments
106
+ *
107
+ * * `y_json` - JSON array of response variable values
108
+ * * `x_vars_json` - JSON array of predictor arrays
109
+ *
110
+ * # Returns
111
+ *
112
+ * JSON string containing the DW statistic and interpretation.
113
+ *
114
+ * # Errors
115
+ *
116
+ * Returns a JSON error object if parsing fails or domain check fails.
117
+ */
118
+ export function durbin_watson_test(y_json: string, x_vars_json: string): string;
119
+
120
+ /**
121
+ * Performs Elastic Net regression via WASM.
122
+ *
123
+ * Elastic Net combines L1 (Lasso) and L2 (Ridge) penalties.
124
+ *
125
+ * # Arguments
126
+ *
127
+ * * `y_json` - JSON array of response variable values
128
+ * * `x_vars_json` - JSON array of predictor arrays
129
+ * * `variable_names` - JSON array of variable names
130
+ * * `lambda` - Regularization strength (>= 0)
131
+ * * `alpha` - Elastic net mixing parameter (0 = Ridge, 1 = Lasso)
132
+ * * `standardize` - Whether to standardize predictors (recommended: true)
133
+ * * `max_iter` - Maximum coordinate descent iterations
134
+ * * `tol` - Convergence tolerance
135
+ *
136
+ * # Returns
137
+ *
138
+ * JSON string containing regression results (same fields as Lasso).
139
+ *
140
+ * # Errors
141
+ *
142
+ * Returns a JSON error object if parsing fails, parameters are invalid,
143
+ * or domain check fails.
144
+ */
145
+ export function elastic_net_regression(y_json: string, x_vars_json: string, _variable_names: string, lambda: number, alpha: number, standardize: boolean, max_iter: number, tol: number): string;
146
+
147
+ /**
148
+ * Computes the inverse of the standard normal CDF (probit function).
149
+ *
150
+ * Returns the z-score such that P(Z ≤ z) = p for a standard normal distribution.
151
+ *
152
+ * # Arguments
153
+ *
154
+ * * `p` - Probability (0 < p < 1)
155
+ *
156
+ * # Returns
157
+ *
158
+ * The z-score, or `NaN` if domain check fails.
159
+ */
160
+ export function get_normal_inverse(p: number): number;
161
+
162
+ /**
163
+ * Computes the Student's t-distribution cumulative distribution function.
164
+ *
165
+ * Returns P(T ≤ t) for a t-distribution with the given degrees of freedom.
166
+ *
167
+ * # Arguments
168
+ *
169
+ * * `t` - t-statistic value
170
+ * * `df` - Degrees of freedom
171
+ *
172
+ * # Returns
173
+ *
174
+ * The CDF value, or `NaN` if domain check fails.
175
+ */
176
+ export function get_t_cdf(t: number, df: number): number;
177
+
178
+ /**
179
+ * Computes the critical t-value for a given significance level.
180
+ *
181
+ * Returns the t-value such that the area under the t-distribution curve
182
+ * to the right equals alpha/2 (two-tailed test).
183
+ *
184
+ * # Arguments
185
+ *
186
+ * * `alpha` - Significance level (typically 0.05 for 95% confidence)
187
+ * * `df` - Degrees of freedom
188
+ *
189
+ * # Returns
190
+ *
191
+ * The critical t-value, or `NaN` if domain check fails.
192
+ */
193
+ export function get_t_critical(alpha: number, df: number): number;
194
+
195
+ /**
196
+ * Returns the current version of the library.
197
+ *
198
+ * Returns the Cargo package version as a string (e.g., "0.1.0").
199
+ *
200
+ * # Errors
201
+ *
202
+ * Returns a JSON error object if domain check fails.
203
+ */
204
+ export function get_version(): string;
205
+
206
+ /**
207
+ * Performs the Harvey-Collier test for linearity via WASM.
208
+ *
209
+ * The Harvey-Collier test checks whether the residuals exhibit a linear trend,
210
+ * which would indicate that the model's functional form is misspecified.
211
+ * A significant p-value suggests non-linearity.
212
+ *
213
+ * # Arguments
214
+ *
215
+ * * `y_json` - JSON array of response variable values
216
+ * * `x_vars_json` - JSON array of predictor arrays
217
+ *
218
+ * # Returns
219
+ *
220
+ * JSON string containing test statistic, p-value, and interpretation.
221
+ *
222
+ * # Errors
223
+ *
224
+ * Returns a JSON error object if parsing fails or domain check fails.
225
+ */
226
+ export function harvey_collier_test(y_json: string, x_vars_json: string): string;
227
+
228
+ /**
229
+ * Performs the Jarque-Bera test for normality via WASM.
230
+ *
231
+ * The Jarque-Bera test checks whether the residuals are normally distributed
232
+ * by examining skewness and kurtosis. A significant p-value suggests that
233
+ * the residuals deviate from normality.
234
+ *
235
+ * # Arguments
236
+ *
237
+ * * `y_json` - JSON array of response variable values
238
+ * * `x_vars_json` - JSON array of predictor arrays
239
+ *
240
+ * # Returns
241
+ *
242
+ * JSON string containing test statistic, p-value, and interpretation.
243
+ *
244
+ * # Errors
245
+ *
246
+ * Returns a JSON error object if parsing fails or domain check fails.
247
+ */
248
+ export function jarque_bera_test(y_json: string, x_vars_json: string): string;
249
+
250
+ /**
251
+ * Performs Lasso regression via WASM.
252
+ *
253
+ * Lasso regression adds an L1 penalty to the coefficients, which performs
254
+ * automatic variable selection by shrinking some coefficients to exactly zero.
255
+ * The intercept is never penalized.
256
+ *
257
+ * # Arguments
258
+ *
259
+ * * `y_json` - JSON array of response variable values
260
+ * * `x_vars_json` - JSON array of predictor arrays
261
+ * * `variable_names` - JSON array of variable names
262
+ * * `lambda` - Regularization strength (>= 0, typical range 0.01 to 10)
263
+ * * `standardize` - Whether to standardize predictors (recommended: true)
264
+ * * `max_iter` - Maximum coordinate descent iterations (default: 100000)
265
+ * * `tol` - Convergence tolerance (default: 1e-7)
266
+ *
267
+ * # Returns
268
+ *
269
+ * JSON string containing:
270
+ * - `lambda` - Lambda value used
271
+ * - `intercept` - Intercept coefficient
272
+ * - `coefficients` - Slope coefficients (some may be exactly zero)
273
+ * - `fitted_values` - Predictions on training data
274
+ * - `residuals` - Residuals (y - fitted_values)
275
+ * - `n_nonzero` - Number of non-zero coefficients (excluding intercept)
276
+ * - `iterations` - Number of coordinate descent iterations
277
+ * - `converged` - Whether the algorithm converged
278
+ *
279
+ * # Errors
280
+ *
281
+ * Returns a JSON error object if parsing fails, lambda is negative,
282
+ * or domain check fails.
283
+ */
284
+ export function lasso_regression(y_json: string, x_vars_json: string, _variable_names: string, lambda: number, standardize: boolean, max_iter: number, tol: number): string;
285
+
286
+ /**
287
+ * Generates a lambda path for regularized regression via WASM.
288
+ *
289
+ * Creates a logarithmically-spaced sequence of lambda values from lambda_max
290
+ * (where all penalized coefficients are zero) down to lambda_min. This is
291
+ * useful for fitting regularization paths and selecting optimal lambda via
292
+ * cross-validation.
293
+ *
294
+ * # Arguments
295
+ *
296
+ * * `y_json` - JSON array of response variable values
297
+ * * `x_vars_json` - JSON array of predictor arrays
298
+ * * `n_lambda` - Number of lambda values to generate (default: 100)
299
+ * * `lambda_min_ratio` - Ratio for smallest lambda (default: 0.0001 if n >= p, else 0.01)
300
+ *
301
+ * # Returns
302
+ *
303
+ * JSON string containing:
304
+ * - `lambda_path` - Array of lambda values in decreasing order
305
+ * - `lambda_max` - Maximum lambda value
306
+ * - `lambda_min` - Minimum lambda value
307
+ * - `n_lambda` - Number of lambda values
308
+ *
309
+ * # Errors
310
+ *
311
+ * Returns a JSON error object if parsing fails or domain check fails.
312
+ */
313
+ export function make_lambda_path(y_json: string, x_vars_json: string, n_lambda: number, lambda_min_ratio: number): string;
314
+
315
+ /**
316
+ * Performs OLS regression via WASM.
317
+ *
318
+ * All parameters and return values are JSON-encoded strings for JavaScript
319
+ * interoperability. Returns regression output including coefficients,
320
+ * standard errors, diagnostic statistics, and VIF analysis.
321
+ *
322
+ * # Arguments
323
+ *
324
+ * * `y_json` - JSON array of response variable values: `[1.0, 2.0, 3.0]`
325
+ * * `x_vars_json` - JSON array of predictor arrays: `[[1.0, 2.0], [0.5, 1.0]]`
326
+ * * `variable_names` - JSON array of variable names: `["Intercept", "X1", "X2"]`
327
+ *
328
+ * # Returns
329
+ *
330
+ * JSON string containing the complete regression output with coefficients,
331
+ * standard errors, t-statistics, p-values, R², F-statistic, residuals, leverage, VIF, etc.
332
+ *
333
+ * # Errors
334
+ *
335
+ * Returns a JSON error object if:
336
+ * - JSON parsing fails
337
+ * - Insufficient data (n ≤ k + 1)
338
+ * - Matrix is singular
339
+ * - Domain check fails
340
+ */
341
+ export function ols_regression(y_json: string, x_vars_json: string, variable_names: string): string;
342
+
343
+ /**
344
+ * Parses CSV data and returns it as a JSON string.
345
+ *
346
+ * Parses the CSV content and identifies numeric columns. Returns a JSON object
347
+ * with headers, data rows, and a list of numeric column names.
348
+ *
349
+ * # Arguments
350
+ *
351
+ * * `content` - CSV content as a string
352
+ *
353
+ * # Returns
354
+ *
355
+ * JSON string with structure:
356
+ * ```json
357
+ * {
358
+ * "headers": ["col1", "col2", ...],
359
+ * "data": [{"col1": 1.0, "col2": "text"}, ...],
360
+ * "numeric_columns": ["col1", ...]
361
+ * }
362
+ * ```
363
+ *
364
+ * # Errors
365
+ *
366
+ * Returns a JSON error object if parsing fails or domain check fails.
367
+ */
368
+ export function parse_csv(content: string): string;
369
+
370
+ /**
371
+ * Performs the Python method White test for heteroscedasticity via WASM.
372
+ *
373
+ * This implementation matches Python's `statsmodels.stats.diagnostic.het_white()` function.
374
+ * Uses the LINPACK QR decomposition with column pivoting and the Python-specific
375
+ * auxiliary matrix structure (intercept, X, X², and cross-products).
376
+ *
377
+ * # Arguments
378
+ *
379
+ * * `y_json` - JSON array of response variable values
380
+ * * `x_vars_json` - JSON array of predictor arrays (each array is a column)
381
+ *
382
+ * # Returns
383
+ *
384
+ * JSON string containing test statistic, p-value, and interpretation.
385
+ *
386
+ * # Errors
387
+ *
388
+ * Returns a JSON error object if parsing fails or domain check fails.
389
+ */
390
+ export function python_white_test(y_json: string, x_vars_json: string): string;
391
+
392
+ /**
393
+ * Performs the R method White test for heteroscedasticity via WASM.
394
+ *
395
+ * This implementation matches R's `skedastic::white()` function behavior.
396
+ * Uses the standard QR decomposition and the R-specific auxiliary matrix
397
+ * structure (intercept, X, X² only - no cross-products).
398
+ *
399
+ * # Arguments
400
+ *
401
+ * * `y_json` - JSON array of response variable values
402
+ * * `x_vars_json` - JSON array of predictor arrays (each array is a column)
403
+ *
404
+ * # Returns
405
+ *
406
+ * JSON string containing test statistic, p-value, and interpretation.
407
+ *
408
+ * # Errors
409
+ *
410
+ * Returns a JSON error object if parsing fails or domain check fails.
411
+ */
412
+ export function r_white_test(y_json: string, x_vars_json: string): string;
413
+
414
+ /**
415
+ * Performs the Rainbow test for linearity via WASM.
416
+ *
417
+ * The Rainbow test checks whether the relationship between predictors and response
418
+ * is linear. A significant p-value suggests non-linearity.
419
+ *
420
+ * # Arguments
421
+ *
422
+ * * `y_json` - JSON array of response variable values
423
+ * * `x_vars_json` - JSON array of predictor arrays
424
+ * * `fraction` - Fraction of data to use in the central subset (0.0 to 1.0, typically 0.5)
425
+ * * `method` - Method to use: "r", "python", or "both" (case-insensitive, defaults to "r")
426
+ *
427
+ * # Returns
428
+ *
429
+ * JSON string containing test statistic, p-value, and interpretation.
430
+ *
431
+ * # Errors
432
+ *
433
+ * Returns a JSON error object if parsing fails or domain check fails.
434
+ */
435
+ export function rainbow_test(y_json: string, x_vars_json: string, fraction: number, method: string): string;
436
+
437
+ /**
438
+ * Performs the RESET test for model specification error via WASM.
439
+ *
440
+ * The RESET (Regression Specification Error Test) test checks whether the model
441
+ * is correctly specified by testing if additional terms (powers of fitted values,
442
+ * regressors, or first principal component) significantly improve the model fit.
443
+ *
444
+ * # Arguments
445
+ *
446
+ * * `y_json` - JSON array of response variable values
447
+ * * `x_vars_json` - JSON array of predictor arrays
448
+ * * `powers_json` - JSON array of powers to use (e.g., [2, 3] for ŷ², ŷ³)
449
+ * * `type_` - Type of terms to add: "fitted", "regressor", or "princomp"
450
+ *
451
+ * # Returns
452
+ *
453
+ * JSON string containing the F-statistic, p-value, and interpretation.
454
+ *
455
+ * # Errors
456
+ *
457
+ * Returns a JSON error object if parsing fails or domain check fails.
458
+ */
459
+ export function reset_test(y_json: string, x_vars_json: string, powers_json: string, type_: string): string;
460
+
461
+ /**
462
+ * Performs Ridge regression via WASM.
463
+ *
464
+ * Ridge regression adds an L2 penalty to the coefficients, which helps with
465
+ * multicollinearity and overfitting. The intercept is never penalized.
466
+ *
467
+ * # Arguments
468
+ *
469
+ * * `y_json` - JSON array of response variable values
470
+ * * `x_vars_json` - JSON array of predictor arrays
471
+ * * `variable_names` - JSON array of variable names
472
+ * * `lambda` - Regularization strength (>= 0, typical range 0.01 to 100)
473
+ * * `standardize` - Whether to standardize predictors (recommended: true)
474
+ *
475
+ * # Returns
476
+ *
477
+ * JSON string containing:
478
+ * - `lambda` - Lambda value used
479
+ * - `intercept` - Intercept coefficient
480
+ * - `coefficients` - Slope coefficients
481
+ * - `fitted_values` - Predictions on training data
482
+ * - `residuals` - Residuals (y - fitted_values)
483
+ * - `df` - Effective degrees of freedom
484
+ *
485
+ * # Errors
486
+ *
487
+ * Returns a JSON error object if parsing fails, lambda is negative,
488
+ * or domain check fails.
489
+ */
490
+ export function ridge_regression(y_json: string, x_vars_json: string, _variable_names: string, lambda: number, standardize: boolean): string;
491
+
492
+ /**
493
+ * Performs the Shapiro-Wilk test for normality via WASM.
494
+ *
495
+ * The Shapiro-Wilk test is a powerful test for normality,
496
+ * especially for small to moderate sample sizes (3 ≤ n ≤ 5000). It tests
497
+ * the null hypothesis that the residuals are normally distributed.
498
+ *
499
+ * # Arguments
500
+ *
501
+ * * `y_json` - JSON array of response variable values
502
+ * * `x_vars_json` - JSON array of predictor arrays
503
+ *
504
+ * # Returns
505
+ *
506
+ * JSON string containing the W statistic (ranges from 0 to 1), p-value,
507
+ * and interpretation.
508
+ *
509
+ * # Errors
510
+ *
511
+ * Returns a JSON error object if parsing fails or domain check fails.
512
+ */
513
+ export function shapiro_wilk_test(y_json: string, x_vars_json: string): string;
514
+
515
+ /**
516
+ * Computes the correlation coefficient between two JSON arrays of f64 values.
517
+ *
518
+ * # Arguments
519
+ *
520
+ * * `x_json` - JSON string representing the first array of f64 values
521
+ * * `y_json` - JSON string representing the second array of f64 values
522
+ *
523
+ * # Returns
524
+ *
525
+ * JSON string with the correlation coefficient, or "null" if input is invalid
526
+ */
527
+ export function stats_correlation(x_json: string, y_json: string): string;
528
+
529
+ /**
530
+ * Computes the arithmetic mean of a JSON array of f64 values.
531
+ *
532
+ * # Arguments
533
+ *
534
+ * * `data_json` - JSON string representing an array of f64 values
535
+ *
536
+ * # Returns
537
+ *
538
+ * JSON string with the mean, or "null" if input is invalid/empty
539
+ */
540
+ export function stats_mean(data_json: string): string;
541
+
542
+ /**
543
+ * Computes the median of a JSON array of f64 values.
544
+ *
545
+ * # Arguments
546
+ *
547
+ * * `data_json` - JSON string representing an array of f64 values
548
+ *
549
+ * # Returns
550
+ *
551
+ * JSON string with the median, or "null" if input is invalid/empty
552
+ */
553
+ export function stats_median(data_json: string): string;
554
+
555
+ /**
556
+ * Computes a quantile of a JSON array of f64 values.
557
+ *
558
+ * # Arguments
559
+ *
560
+ * * `data_json` - JSON string representing an array of f64 values
561
+ * * `q` - Quantile to calculate (0.0 to 1.0)
562
+ *
563
+ * # Returns
564
+ *
565
+ * JSON string with the quantile value, or "null" if input is invalid
566
+ */
567
+ export function stats_quantile(data_json: string, q: number): string;
568
+
569
+ /**
570
+ * Computes the sample standard deviation of a JSON array of f64 values.
571
+ *
572
+ * Uses the (n-1) denominator for unbiased estimation.
573
+ *
574
+ * # Arguments
575
+ *
576
+ * * `data_json` - JSON string representing an array of f64 values
577
+ *
578
+ * # Returns
579
+ *
580
+ * JSON string with the standard deviation, or "null" if input is invalid
581
+ */
582
+ export function stats_stddev(data_json: string): string;
583
+
584
+ /**
585
+ * Computes the sample variance of a JSON array of f64 values.
586
+ *
587
+ * Uses the (n-1) denominator for unbiased estimation.
588
+ *
589
+ * # Arguments
590
+ *
591
+ * * `data_json` - JSON string representing an array of f64 values
592
+ *
593
+ * # Returns
594
+ *
595
+ * JSON string with the variance, or "null" if input is invalid
596
+ */
597
+ export function stats_variance(data_json: string): string;
598
+
599
+ /**
600
+ * Simple test function to verify WASM is working.
601
+ *
602
+ * Returns a success message confirming the WASM module loaded correctly.
603
+ *
604
+ * # Errors
605
+ *
606
+ * Returns a JSON error object if domain check fails.
607
+ */
608
+ export function test(): string;
609
+
610
+ /**
611
+ * Test function for confidence interval computation.
612
+ *
613
+ * Returns JSON with the computed confidence interval for a coefficient.
614
+ *
615
+ * # Errors
616
+ *
617
+ * Returns a JSON error object if domain check fails.
618
+ */
619
+ export function test_ci(coef: number, se: number, df: number, alpha: number): string;
620
+
621
+ /**
622
+ * Test function for regression validation against R reference values.
623
+ *
624
+ * Runs a regression on a housing dataset and compares results against R's lm() output.
625
+ * Returns JSON with status "PASS" or "FAIL" with details.
626
+ *
627
+ * # Errors
628
+ *
629
+ * Returns a JSON error object if domain check fails.
630
+ */
631
+ export function test_housing_regression(): string;
632
+
633
+ /**
634
+ * Test function for R accuracy validation.
635
+ *
636
+ * Returns JSON comparing our statistical functions against R reference values.
637
+ *
638
+ * # Errors
639
+ *
640
+ * Returns a JSON error object if domain check fails.
641
+ */
642
+ export function test_r_accuracy(): string;
643
+
644
+ /**
645
+ * Test function for t-critical value computation.
646
+ *
647
+ * Returns JSON with the computed t-critical value for the given parameters.
648
+ *
649
+ * # Errors
650
+ *
651
+ * Returns a JSON error object if domain check fails.
652
+ */
653
+ export function test_t_critical(df: number, alpha: number): string;
654
+
655
+ /**
656
+ * Performs the White test for heteroscedasticity via WASM.
657
+ *
658
+ * The White test is a more general test for heteroscedasticity that does not
659
+ * assume a specific form of heteroscedasticity. A significant p-value suggests
660
+ * that the error variance is not constant.
661
+ *
662
+ * # Arguments
663
+ *
664
+ * * `y_json` - JSON array of response variable values
665
+ * * `x_vars_json` - JSON array of predictor arrays
666
+ * * `method` - Method to use: "r", "python", or "both" (case-insensitive, defaults to "r")
667
+ *
668
+ * # Returns
669
+ *
670
+ * JSON string containing test statistic, p-value, and interpretation.
671
+ *
672
+ * # Errors
673
+ *
674
+ * Returns a JSON error object if parsing fails or domain check fails.
675
+ */
676
+ export function white_test(y_json: string, x_vars_json: string, method: string): string;
677
+
678
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
679
+
680
+ export interface InitOutput {
681
+ readonly memory: WebAssembly.Memory;
682
+ readonly anderson_darling_test: (a: number, b: number, c: number, d: number) => [number, number];
683
+ readonly breusch_godfrey_test: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
684
+ readonly breusch_pagan_test: (a: number, b: number, c: number, d: number) => [number, number];
685
+ readonly cooks_distance_test: (a: number, b: number, c: number, d: number) => [number, number];
686
+ readonly durbin_watson_test: (a: number, b: number, c: number, d: number) => [number, number];
687
+ readonly elastic_net_regression: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => [number, number];
688
+ readonly get_version: () => [number, number];
689
+ readonly harvey_collier_test: (a: number, b: number, c: number, d: number) => [number, number];
690
+ readonly jarque_bera_test: (a: number, b: number, c: number, d: number) => [number, number];
691
+ readonly lasso_regression: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
692
+ readonly make_lambda_path: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
693
+ readonly ols_regression: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
694
+ readonly parse_csv: (a: number, b: number) => [number, number];
695
+ readonly python_white_test: (a: number, b: number, c: number, d: number) => [number, number];
696
+ readonly r_white_test: (a: number, b: number, c: number, d: number) => [number, number];
697
+ readonly rainbow_test: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
698
+ readonly reset_test: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
699
+ readonly ridge_regression: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number];
700
+ readonly shapiro_wilk_test: (a: number, b: number, c: number, d: number) => [number, number];
701
+ readonly stats_correlation: (a: number, b: number, c: number, d: number) => [number, number];
702
+ readonly stats_mean: (a: number, b: number) => [number, number];
703
+ readonly stats_median: (a: number, b: number) => [number, number];
704
+ readonly stats_quantile: (a: number, b: number, c: number) => [number, number];
705
+ readonly stats_stddev: (a: number, b: number) => [number, number];
706
+ readonly stats_variance: (a: number, b: number) => [number, number];
707
+ readonly test: () => [number, number];
708
+ readonly test_ci: (a: number, b: number, c: number, d: number) => [number, number];
709
+ readonly test_housing_regression: () => [number, number];
710
+ readonly test_r_accuracy: () => [number, number];
711
+ readonly test_t_critical: (a: number, b: number) => [number, number];
712
+ readonly white_test: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number];
713
+ readonly get_t_cdf: (a: number, b: number) => number;
714
+ readonly get_t_critical: (a: number, b: number) => number;
715
+ readonly get_normal_inverse: (a: number) => number;
716
+ readonly __wbindgen_externrefs: WebAssembly.Table;
717
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
718
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
719
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
720
+ readonly __wbindgen_start: () => void;
721
+ }
722
+
723
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
724
+
725
+ /**
726
+ * Instantiates the given `module`, which can either be bytes or
727
+ * a precompiled `WebAssembly.Module`.
728
+ *
729
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
730
+ *
731
+ * @returns {InitOutput}
732
+ */
733
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
734
+
735
+ /**
736
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
737
+ * for everything else, calls `WebAssembly.instantiate` directly.
738
+ *
739
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
740
+ *
741
+ * @returns {Promise<InitOutput>}
742
+ */
743
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;