alglib4 0.0.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.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +47 -0
  3. data/ext/alglib/alglib.cpp +537 -0
  4. data/ext/alglib/alglib_array_converters.cpp +86 -0
  5. data/ext/alglib/alglib_array_converters.h +15 -0
  6. data/ext/alglib/alglib_utils.cpp +10 -0
  7. data/ext/alglib/alglib_utils.h +6 -0
  8. data/ext/alglib/alglibinternal.cpp +21749 -0
  9. data/ext/alglib/alglibinternal.h +2168 -0
  10. data/ext/alglib/alglibmisc.cpp +9106 -0
  11. data/ext/alglib/alglibmisc.h +2114 -0
  12. data/ext/alglib/ap.cpp +20094 -0
  13. data/ext/alglib/ap.h +7244 -0
  14. data/ext/alglib/dataanalysis.cpp +52588 -0
  15. data/ext/alglib/dataanalysis.h +10601 -0
  16. data/ext/alglib/diffequations.cpp +1342 -0
  17. data/ext/alglib/diffequations.h +282 -0
  18. data/ext/alglib/extconf.rb +5 -0
  19. data/ext/alglib/fasttransforms.cpp +4696 -0
  20. data/ext/alglib/fasttransforms.h +1018 -0
  21. data/ext/alglib/integration.cpp +4249 -0
  22. data/ext/alglib/integration.h +869 -0
  23. data/ext/alglib/interpolation.cpp +74502 -0
  24. data/ext/alglib/interpolation.h +12264 -0
  25. data/ext/alglib/kernels_avx2.cpp +2171 -0
  26. data/ext/alglib/kernels_avx2.h +201 -0
  27. data/ext/alglib/kernels_fma.cpp +1065 -0
  28. data/ext/alglib/kernels_fma.h +137 -0
  29. data/ext/alglib/kernels_sse2.cpp +735 -0
  30. data/ext/alglib/kernels_sse2.h +100 -0
  31. data/ext/alglib/linalg.cpp +65182 -0
  32. data/ext/alglib/linalg.h +9927 -0
  33. data/ext/alglib/optimization.cpp +135331 -0
  34. data/ext/alglib/optimization.h +19235 -0
  35. data/ext/alglib/solvers.cpp +20488 -0
  36. data/ext/alglib/solvers.h +4781 -0
  37. data/ext/alglib/specialfunctions.cpp +10672 -0
  38. data/ext/alglib/specialfunctions.h +2305 -0
  39. data/ext/alglib/statistics.cpp +19791 -0
  40. data/ext/alglib/statistics.h +1359 -0
  41. data/ext/alglib/stdafx.h +2 -0
  42. data/gpl2.txt +339 -0
  43. data/gpl3.txt +674 -0
  44. data/lib/alglib/version.rb +3 -0
  45. data/lib/alglib.rb +4 -0
  46. metadata +101 -0
@@ -0,0 +1,1359 @@
1
+ /*************************************************************************
2
+ ALGLIB 4.04.0 (source code generated 2024-12-21)
3
+ Copyright (c) Sergey Bochkanov (ALGLIB project).
4
+
5
+ >>> SOURCE LICENSE >>>
6
+ This program is free software; you can redistribute it and/or modify
7
+ it under the terms of the GNU General Public License as published by
8
+ the Free Software Foundation (www.fsf.org); either version 2 of the
9
+ License, or (at your option) any later version.
10
+
11
+ This program is distributed in the hope that it will be useful,
12
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ GNU General Public License for more details.
15
+
16
+ A copy of the GNU General Public License is available at
17
+ http://www.fsf.org/licensing/licenses
18
+ >>> END OF LICENSE >>>
19
+ *************************************************************************/
20
+ #ifndef _statistics_pkg_h
21
+ #define _statistics_pkg_h
22
+ #include "ap.h"
23
+ #include "alglibinternal.h"
24
+ #include "linalg.h"
25
+ #include "specialfunctions.h"
26
+ #include "alglibmisc.h"
27
+
28
+ /////////////////////////////////////////////////////////////////////////
29
+ //
30
+ // THIS SECTION CONTAINS COMPUTATIONAL CORE DECLARATIONS (DATATYPES)
31
+ //
32
+ /////////////////////////////////////////////////////////////////////////
33
+ namespace alglib_impl
34
+ {
35
+ #if defined(AE_COMPILE_BASESTAT) || !defined(AE_PARTIAL_BUILD)
36
+ #endif
37
+ #if defined(AE_COMPILE_CORRELATIONTESTS) || !defined(AE_PARTIAL_BUILD)
38
+ #endif
39
+ #if defined(AE_COMPILE_JARQUEBERA) || !defined(AE_PARTIAL_BUILD)
40
+ #endif
41
+ #if defined(AE_COMPILE_VARIANCETESTS) || !defined(AE_PARTIAL_BUILD)
42
+ #endif
43
+ #if defined(AE_COMPILE_WSR) || !defined(AE_PARTIAL_BUILD)
44
+ #endif
45
+ #if defined(AE_COMPILE_MANNWHITNEYU) || !defined(AE_PARTIAL_BUILD)
46
+ #endif
47
+ #if defined(AE_COMPILE_STEST) || !defined(AE_PARTIAL_BUILD)
48
+ #endif
49
+ #if defined(AE_COMPILE_STUDENTTTESTS) || !defined(AE_PARTIAL_BUILD)
50
+ #endif
51
+
52
+ }
53
+
54
+ /////////////////////////////////////////////////////////////////////////
55
+ //
56
+ // THIS SECTION CONTAINS C++ INTERFACE
57
+ //
58
+ /////////////////////////////////////////////////////////////////////////
59
+ namespace alglib
60
+ {
61
+
62
+ #if defined(AE_COMPILE_BASESTAT) || !defined(AE_PARTIAL_BUILD)
63
+
64
+ #endif
65
+
66
+ #if defined(AE_COMPILE_CORRELATIONTESTS) || !defined(AE_PARTIAL_BUILD)
67
+
68
+ #endif
69
+
70
+ #if defined(AE_COMPILE_JARQUEBERA) || !defined(AE_PARTIAL_BUILD)
71
+
72
+ #endif
73
+
74
+ #if defined(AE_COMPILE_VARIANCETESTS) || !defined(AE_PARTIAL_BUILD)
75
+
76
+ #endif
77
+
78
+ #if defined(AE_COMPILE_WSR) || !defined(AE_PARTIAL_BUILD)
79
+
80
+ #endif
81
+
82
+ #if defined(AE_COMPILE_MANNWHITNEYU) || !defined(AE_PARTIAL_BUILD)
83
+
84
+ #endif
85
+
86
+ #if defined(AE_COMPILE_STEST) || !defined(AE_PARTIAL_BUILD)
87
+
88
+ #endif
89
+
90
+ #if defined(AE_COMPILE_STUDENTTTESTS) || !defined(AE_PARTIAL_BUILD)
91
+
92
+ #endif
93
+
94
+ #if defined(AE_COMPILE_BASESTAT) || !defined(AE_PARTIAL_BUILD)
95
+ /*************************************************************************
96
+ Calculation of the distribution moments: mean, variance, skewness, kurtosis.
97
+
98
+ INPUT PARAMETERS:
99
+ X - sample
100
+ N - N>=0, sample size:
101
+ * if given, only leading N elements of X are processed
102
+ * if not given, automatically determined from size of X
103
+
104
+ OUTPUT PARAMETERS
105
+ Mean - mean.
106
+ Variance- variance.
107
+ Skewness- skewness (if variance<>0; zero otherwise).
108
+ Kurtosis- kurtosis (if variance<>0; zero otherwise).
109
+
110
+ NOTE: variance is calculated by dividing sum of squares by N-1, not N.
111
+
112
+ -- ALGLIB --
113
+ Copyright 06.09.2006 by Bochkanov Sergey
114
+ *************************************************************************/
115
+ void samplemoments(const real_1d_array &x, const ae_int_t n, double &mean, double &variance, double &skewness, double &kurtosis, const xparams _xparams = alglib::xdefault);
116
+ void samplemoments(const real_1d_array &x, double &mean, double &variance, double &skewness, double &kurtosis, const xparams _xparams = alglib::xdefault);
117
+
118
+
119
+ /*************************************************************************
120
+ Calculation of the mean.
121
+
122
+ INPUT PARAMETERS:
123
+ X - sample
124
+ N - N>=0, sample size:
125
+ * if given, only leading N elements of X are processed
126
+ * if not given, automatically determined from size of X
127
+
128
+ NOTE:
129
+
130
+ This function return result which calculated by 'SampleMoments' function
131
+ and stored at 'Mean' variable.
132
+
133
+
134
+ -- ALGLIB --
135
+ Copyright 06.09.2006 by Bochkanov Sergey
136
+ *************************************************************************/
137
+ double samplemean(const real_1d_array &x, const ae_int_t n, const xparams _xparams = alglib::xdefault);
138
+ double samplemean(const real_1d_array &x, const xparams _xparams = alglib::xdefault);
139
+
140
+
141
+ /*************************************************************************
142
+ Calculation of the variance.
143
+
144
+ INPUT PARAMETERS:
145
+ X - sample
146
+ N - N>=0, sample size:
147
+ * if given, only leading N elements of X are processed
148
+ * if not given, automatically determined from size of X
149
+
150
+ NOTE:
151
+
152
+ This function return result which calculated by 'SampleMoments' function
153
+ and stored at 'Variance' variable.
154
+
155
+
156
+ -- ALGLIB --
157
+ Copyright 06.09.2006 by Bochkanov Sergey
158
+ *************************************************************************/
159
+ double samplevariance(const real_1d_array &x, const ae_int_t n, const xparams _xparams = alglib::xdefault);
160
+ double samplevariance(const real_1d_array &x, const xparams _xparams = alglib::xdefault);
161
+
162
+
163
+ /*************************************************************************
164
+ Calculation of the skewness.
165
+
166
+ INPUT PARAMETERS:
167
+ X - sample
168
+ N - N>=0, sample size:
169
+ * if given, only leading N elements of X are processed
170
+ * if not given, automatically determined from size of X
171
+
172
+ NOTE:
173
+
174
+ This function return result which calculated by 'SampleMoments' function
175
+ and stored at 'Skewness' variable.
176
+
177
+
178
+ -- ALGLIB --
179
+ Copyright 06.09.2006 by Bochkanov Sergey
180
+ *************************************************************************/
181
+ double sampleskewness(const real_1d_array &x, const ae_int_t n, const xparams _xparams = alglib::xdefault);
182
+ double sampleskewness(const real_1d_array &x, const xparams _xparams = alglib::xdefault);
183
+
184
+
185
+ /*************************************************************************
186
+ Calculation of the kurtosis.
187
+
188
+ INPUT PARAMETERS:
189
+ X - sample
190
+ N - N>=0, sample size:
191
+ * if given, only leading N elements of X are processed
192
+ * if not given, automatically determined from size of X
193
+
194
+ NOTE:
195
+
196
+ This function return result which calculated by 'SampleMoments' function
197
+ and stored at 'Kurtosis' variable.
198
+
199
+
200
+ -- ALGLIB --
201
+ Copyright 06.09.2006 by Bochkanov Sergey
202
+ *************************************************************************/
203
+ double samplekurtosis(const real_1d_array &x, const ae_int_t n, const xparams _xparams = alglib::xdefault);
204
+ double samplekurtosis(const real_1d_array &x, const xparams _xparams = alglib::xdefault);
205
+
206
+
207
+ /*************************************************************************
208
+ ADev
209
+
210
+ Input parameters:
211
+ X - sample
212
+ N - N>=0, sample size:
213
+ * if given, only leading N elements of X are processed
214
+ * if not given, automatically determined from size of X
215
+
216
+ Output parameters:
217
+ ADev- ADev
218
+
219
+ -- ALGLIB --
220
+ Copyright 06.09.2006 by Bochkanov Sergey
221
+ *************************************************************************/
222
+ void sampleadev(const real_1d_array &x, const ae_int_t n, double &adev, const xparams _xparams = alglib::xdefault);
223
+ void sampleadev(const real_1d_array &x, double &adev, const xparams _xparams = alglib::xdefault);
224
+
225
+
226
+ /*************************************************************************
227
+ Median calculation.
228
+
229
+ Input parameters:
230
+ X - sample (array indexes: [0..N-1])
231
+ N - N>=0, sample size:
232
+ * if given, only leading N elements of X are processed
233
+ * if not given, automatically determined from size of X
234
+
235
+ Output parameters:
236
+ Median
237
+
238
+ -- ALGLIB --
239
+ Copyright 06.09.2006 by Bochkanov Sergey
240
+ *************************************************************************/
241
+ void samplemedian(const real_1d_array &x, const ae_int_t n, double &median, const xparams _xparams = alglib::xdefault);
242
+ void samplemedian(const real_1d_array &x, double &median, const xparams _xparams = alglib::xdefault);
243
+
244
+
245
+ /*************************************************************************
246
+ Percentile calculation.
247
+
248
+ Input parameters:
249
+ X - sample (array indexes: [0..N-1])
250
+ N - N>=0, sample size:
251
+ * if given, only leading N elements of X are processed
252
+ * if not given, automatically determined from size of X
253
+ P - percentile (0<=P<=1)
254
+
255
+ Output parameters:
256
+ V - percentile
257
+
258
+ -- ALGLIB --
259
+ Copyright 01.03.2008 by Bochkanov Sergey
260
+ *************************************************************************/
261
+ void samplepercentile(const real_1d_array &x, const ae_int_t n, const double p, double &v, const xparams _xparams = alglib::xdefault);
262
+ void samplepercentile(const real_1d_array &x, const double p, double &v, const xparams _xparams = alglib::xdefault);
263
+
264
+
265
+ /*************************************************************************
266
+ 2-sample covariance
267
+
268
+ Input parameters:
269
+ X - sample 1 (array indexes: [0..N-1])
270
+ Y - sample 2 (array indexes: [0..N-1])
271
+ N - N>=0, sample size:
272
+ * if given, only N leading elements of X/Y are processed
273
+ * if not given, automatically determined from input sizes
274
+
275
+ Result:
276
+ covariance (zero for N=0 or N=1)
277
+
278
+ -- ALGLIB --
279
+ Copyright 28.10.2010 by Bochkanov Sergey
280
+ *************************************************************************/
281
+ double cov2(const real_1d_array &x, const real_1d_array &y, const ae_int_t n, const xparams _xparams = alglib::xdefault);
282
+ double cov2(const real_1d_array &x, const real_1d_array &y, const xparams _xparams = alglib::xdefault);
283
+
284
+
285
+ /*************************************************************************
286
+ Pearson product-moment correlation coefficient
287
+
288
+ Input parameters:
289
+ X - sample 1 (array indexes: [0..N-1])
290
+ Y - sample 2 (array indexes: [0..N-1])
291
+ N - N>=0, sample size:
292
+ * if given, only N leading elements of X/Y are processed
293
+ * if not given, automatically determined from input sizes
294
+
295
+ Result:
296
+ Pearson product-moment correlation coefficient
297
+ (zero for N=0 or N=1)
298
+
299
+ -- ALGLIB --
300
+ Copyright 28.10.2010 by Bochkanov Sergey
301
+ *************************************************************************/
302
+ double pearsoncorr2(const real_1d_array &x, const real_1d_array &y, const ae_int_t n, const xparams _xparams = alglib::xdefault);
303
+ double pearsoncorr2(const real_1d_array &x, const real_1d_array &y, const xparams _xparams = alglib::xdefault);
304
+
305
+
306
+ /*************************************************************************
307
+ Spearman's rank correlation coefficient
308
+
309
+ Input parameters:
310
+ X - sample 1 (array indexes: [0..N-1])
311
+ Y - sample 2 (array indexes: [0..N-1])
312
+ N - N>=0, sample size:
313
+ * if given, only N leading elements of X/Y are processed
314
+ * if not given, automatically determined from input sizes
315
+
316
+ Result:
317
+ Spearman's rank correlation coefficient
318
+ (zero for N=0 or N=1)
319
+
320
+ -- ALGLIB --
321
+ Copyright 09.04.2007 by Bochkanov Sergey
322
+ *************************************************************************/
323
+ double spearmancorr2(const real_1d_array &x, const real_1d_array &y, const ae_int_t n, const xparams _xparams = alglib::xdefault);
324
+ double spearmancorr2(const real_1d_array &x, const real_1d_array &y, const xparams _xparams = alglib::xdefault);
325
+
326
+
327
+ /*************************************************************************
328
+ Covariance matrix
329
+
330
+ ! COMMERCIAL EDITION OF ALGLIB:
331
+ !
332
+ ! Commercial Edition of ALGLIB includes following important improvements
333
+ ! of this function:
334
+ ! * high-performance native backend with same C# interface (C# version)
335
+ ! * multithreading support (C++ and C# versions)
336
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
337
+ ! (C++ and C# versions, x86/x64 platform)
338
+ !
339
+ ! We recommend you to read 'Working with commercial version' section of
340
+ ! ALGLIB Reference Manual in order to find out how to use performance-
341
+ ! related features provided by commercial edition of ALGLIB.
342
+
343
+ INPUT PARAMETERS:
344
+ X - array[N,M], sample matrix:
345
+ * J-th column corresponds to J-th variable
346
+ * I-th row corresponds to I-th observation
347
+ N - N>=0, number of observations:
348
+ * if given, only leading N rows of X are used
349
+ * if not given, automatically determined from input size
350
+ M - M>0, number of variables:
351
+ * if given, only leading M columns of X are used
352
+ * if not given, automatically determined from input size
353
+
354
+ OUTPUT PARAMETERS:
355
+ C - array[M,M], covariance matrix (zero if N=0 or N=1)
356
+
357
+ -- ALGLIB --
358
+ Copyright 28.10.2010 by Bochkanov Sergey
359
+ *************************************************************************/
360
+ void covm(const real_2d_array &x, const ae_int_t n, const ae_int_t m, real_2d_array &c, const xparams _xparams = alglib::xdefault);
361
+ void covm(const real_2d_array &x, real_2d_array &c, const xparams _xparams = alglib::xdefault);
362
+
363
+
364
+ /*************************************************************************
365
+ Pearson product-moment correlation matrix
366
+
367
+ ! COMMERCIAL EDITION OF ALGLIB:
368
+ !
369
+ ! Commercial Edition of ALGLIB includes following important improvements
370
+ ! of this function:
371
+ ! * high-performance native backend with same C# interface (C# version)
372
+ ! * multithreading support (C++ and C# versions)
373
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
374
+ ! (C++ and C# versions, x86/x64 platform)
375
+ !
376
+ ! We recommend you to read 'Working with commercial version' section of
377
+ ! ALGLIB Reference Manual in order to find out how to use performance-
378
+ ! related features provided by commercial edition of ALGLIB.
379
+
380
+ INPUT PARAMETERS:
381
+ X - array[N,M], sample matrix:
382
+ * J-th column corresponds to J-th variable
383
+ * I-th row corresponds to I-th observation
384
+ N - N>=0, number of observations:
385
+ * if given, only leading N rows of X are used
386
+ * if not given, automatically determined from input size
387
+ M - M>0, number of variables:
388
+ * if given, only leading M columns of X are used
389
+ * if not given, automatically determined from input size
390
+
391
+ OUTPUT PARAMETERS:
392
+ C - array[M,M], correlation matrix (zero if N=0 or N=1)
393
+
394
+ -- ALGLIB --
395
+ Copyright 28.10.2010 by Bochkanov Sergey
396
+ *************************************************************************/
397
+ void pearsoncorrm(const real_2d_array &x, const ae_int_t n, const ae_int_t m, real_2d_array &c, const xparams _xparams = alglib::xdefault);
398
+ void pearsoncorrm(const real_2d_array &x, real_2d_array &c, const xparams _xparams = alglib::xdefault);
399
+
400
+
401
+ /*************************************************************************
402
+ Spearman's rank correlation matrix
403
+
404
+ ! COMMERCIAL EDITION OF ALGLIB:
405
+ !
406
+ ! Commercial Edition of ALGLIB includes following important improvements
407
+ ! of this function:
408
+ ! * high-performance native backend with same C# interface (C# version)
409
+ ! * multithreading support (C++ and C# versions)
410
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
411
+ ! (C++ and C# versions, x86/x64 platform)
412
+ !
413
+ ! We recommend you to read 'Working with commercial version' section of
414
+ ! ALGLIB Reference Manual in order to find out how to use performance-
415
+ ! related features provided by commercial edition of ALGLIB.
416
+
417
+ INPUT PARAMETERS:
418
+ X - array[N,M], sample matrix:
419
+ * J-th column corresponds to J-th variable
420
+ * I-th row corresponds to I-th observation
421
+ N - N>=0, number of observations:
422
+ * if given, only leading N rows of X are used
423
+ * if not given, automatically determined from input size
424
+ M - M>0, number of variables:
425
+ * if given, only leading M columns of X are used
426
+ * if not given, automatically determined from input size
427
+
428
+ OUTPUT PARAMETERS:
429
+ C - array[M,M], correlation matrix (zero if N=0 or N=1)
430
+
431
+ -- ALGLIB --
432
+ Copyright 28.10.2010 by Bochkanov Sergey
433
+ *************************************************************************/
434
+ void spearmancorrm(const real_2d_array &x, const ae_int_t n, const ae_int_t m, real_2d_array &c, const xparams _xparams = alglib::xdefault);
435
+ void spearmancorrm(const real_2d_array &x, real_2d_array &c, const xparams _xparams = alglib::xdefault);
436
+
437
+
438
+ /*************************************************************************
439
+ Cross-covariance matrix
440
+
441
+ ! COMMERCIAL EDITION OF ALGLIB:
442
+ !
443
+ ! Commercial Edition of ALGLIB includes following important improvements
444
+ ! of this function:
445
+ ! * high-performance native backend with same C# interface (C# version)
446
+ ! * multithreading support (C++ and C# versions)
447
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
448
+ ! (C++ and C# versions, x86/x64 platform)
449
+ !
450
+ ! We recommend you to read 'Working with commercial version' section of
451
+ ! ALGLIB Reference Manual in order to find out how to use performance-
452
+ ! related features provided by commercial edition of ALGLIB.
453
+
454
+ INPUT PARAMETERS:
455
+ X - array[N,M1], sample matrix:
456
+ * J-th column corresponds to J-th variable
457
+ * I-th row corresponds to I-th observation
458
+ Y - array[N,M2], sample matrix:
459
+ * J-th column corresponds to J-th variable
460
+ * I-th row corresponds to I-th observation
461
+ N - N>=0, number of observations:
462
+ * if given, only leading N rows of X/Y are used
463
+ * if not given, automatically determined from input sizes
464
+ M1 - M1>0, number of variables in X:
465
+ * if given, only leading M1 columns of X are used
466
+ * if not given, automatically determined from input size
467
+ M2 - M2>0, number of variables in Y:
468
+ * if given, only leading M1 columns of X are used
469
+ * if not given, automatically determined from input size
470
+
471
+ OUTPUT PARAMETERS:
472
+ C - array[M1,M2], cross-covariance matrix (zero if N=0 or N=1)
473
+
474
+ -- ALGLIB --
475
+ Copyright 28.10.2010 by Bochkanov Sergey
476
+ *************************************************************************/
477
+ void covm2(const real_2d_array &x, const real_2d_array &y, const ae_int_t n, const ae_int_t m1, const ae_int_t m2, real_2d_array &c, const xparams _xparams = alglib::xdefault);
478
+ void covm2(const real_2d_array &x, const real_2d_array &y, real_2d_array &c, const xparams _xparams = alglib::xdefault);
479
+
480
+
481
+ /*************************************************************************
482
+ Pearson product-moment cross-correlation matrix
483
+
484
+ ! COMMERCIAL EDITION OF ALGLIB:
485
+ !
486
+ ! Commercial Edition of ALGLIB includes following important improvements
487
+ ! of this function:
488
+ ! * high-performance native backend with same C# interface (C# version)
489
+ ! * multithreading support (C++ and C# versions)
490
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
491
+ ! (C++ and C# versions, x86/x64 platform)
492
+ !
493
+ ! We recommend you to read 'Working with commercial version' section of
494
+ ! ALGLIB Reference Manual in order to find out how to use performance-
495
+ ! related features provided by commercial edition of ALGLIB.
496
+
497
+ INPUT PARAMETERS:
498
+ X - array[N,M1], sample matrix:
499
+ * J-th column corresponds to J-th variable
500
+ * I-th row corresponds to I-th observation
501
+ Y - array[N,M2], sample matrix:
502
+ * J-th column corresponds to J-th variable
503
+ * I-th row corresponds to I-th observation
504
+ N - N>=0, number of observations:
505
+ * if given, only leading N rows of X/Y are used
506
+ * if not given, automatically determined from input sizes
507
+ M1 - M1>0, number of variables in X:
508
+ * if given, only leading M1 columns of X are used
509
+ * if not given, automatically determined from input size
510
+ M2 - M2>0, number of variables in Y:
511
+ * if given, only leading M1 columns of X are used
512
+ * if not given, automatically determined from input size
513
+
514
+ OUTPUT PARAMETERS:
515
+ C - array[M1,M2], cross-correlation matrix (zero if N=0 or N=1)
516
+
517
+ -- ALGLIB --
518
+ Copyright 28.10.2010 by Bochkanov Sergey
519
+ *************************************************************************/
520
+ void pearsoncorrm2(const real_2d_array &x, const real_2d_array &y, const ae_int_t n, const ae_int_t m1, const ae_int_t m2, real_2d_array &c, const xparams _xparams = alglib::xdefault);
521
+ void pearsoncorrm2(const real_2d_array &x, const real_2d_array &y, real_2d_array &c, const xparams _xparams = alglib::xdefault);
522
+
523
+
524
+ /*************************************************************************
525
+ Spearman's rank cross-correlation matrix
526
+
527
+ ! COMMERCIAL EDITION OF ALGLIB:
528
+ !
529
+ ! Commercial Edition of ALGLIB includes following important improvements
530
+ ! of this function:
531
+ ! * high-performance native backend with same C# interface (C# version)
532
+ ! * multithreading support (C++ and C# versions)
533
+ ! * hardware vendor (Intel) implementations of linear algebra primitives
534
+ ! (C++ and C# versions, x86/x64 platform)
535
+ !
536
+ ! We recommend you to read 'Working with commercial version' section of
537
+ ! ALGLIB Reference Manual in order to find out how to use performance-
538
+ ! related features provided by commercial edition of ALGLIB.
539
+
540
+ INPUT PARAMETERS:
541
+ X - array[N,M1], sample matrix:
542
+ * J-th column corresponds to J-th variable
543
+ * I-th row corresponds to I-th observation
544
+ Y - array[N,M2], sample matrix:
545
+ * J-th column corresponds to J-th variable
546
+ * I-th row corresponds to I-th observation
547
+ N - N>=0, number of observations:
548
+ * if given, only leading N rows of X/Y are used
549
+ * if not given, automatically determined from input sizes
550
+ M1 - M1>0, number of variables in X:
551
+ * if given, only leading M1 columns of X are used
552
+ * if not given, automatically determined from input size
553
+ M2 - M2>0, number of variables in Y:
554
+ * if given, only leading M1 columns of X are used
555
+ * if not given, automatically determined from input size
556
+
557
+ OUTPUT PARAMETERS:
558
+ C - array[M1,M2], cross-correlation matrix (zero if N=0 or N=1)
559
+
560
+ -- ALGLIB --
561
+ Copyright 28.10.2010 by Bochkanov Sergey
562
+ *************************************************************************/
563
+ void spearmancorrm2(const real_2d_array &x, const real_2d_array &y, const ae_int_t n, const ae_int_t m1, const ae_int_t m2, real_2d_array &c, const xparams _xparams = alglib::xdefault);
564
+ void spearmancorrm2(const real_2d_array &x, const real_2d_array &y, real_2d_array &c, const xparams _xparams = alglib::xdefault);
565
+
566
+
567
+ /*************************************************************************
568
+ This function replaces data in XY by their ranks:
569
+ * XY is processed row-by-row
570
+ * rows are processed separately
571
+ * tied data are correctly handled (tied ranks are calculated)
572
+ * ranking starts from 0, ends at NFeatures-1
573
+ * sum of within-row values is equal to (NFeatures-1)*NFeatures/2
574
+
575
+ ! COMMERCIAL EDITION OF ALGLIB:
576
+ !
577
+ ! Commercial Edition of ALGLIB includes following important improvements
578
+ ! of this function:
579
+ ! * high-performance native backend with same C# interface (C# version)
580
+ ! * multithreading support (C++ and C# versions)
581
+ !
582
+ ! We recommend you to read 'Working with commercial version' section of
583
+ ! ALGLIB Reference Manual in order to find out how to use performance-
584
+ ! related features provided by commercial edition of ALGLIB.
585
+
586
+ INPUT PARAMETERS:
587
+ XY - array[NPoints,NFeatures], dataset
588
+ NPoints - number of points
589
+ NFeatures- number of features
590
+
591
+ OUTPUT PARAMETERS:
592
+ XY - data are replaced by their within-row ranks;
593
+ ranking starts from 0, ends at NFeatures-1
594
+
595
+ -- ALGLIB --
596
+ Copyright 18.04.2013 by Bochkanov Sergey
597
+ *************************************************************************/
598
+ void rankdata(real_2d_array &xy, const ae_int_t npoints, const ae_int_t nfeatures, const xparams _xparams = alglib::xdefault);
599
+ void rankdata(real_2d_array &xy, const xparams _xparams = alglib::xdefault);
600
+
601
+
602
+ /*************************************************************************
603
+ This function replaces data in XY by their CENTERED ranks:
604
+ * XY is processed row-by-row
605
+ * rows are processed separately
606
+ * tied data are correctly handled (tied ranks are calculated)
607
+ * centered ranks are just usual ranks, but centered in such way that sum
608
+ of within-row values is equal to 0.0.
609
+ * centering is performed by subtracting mean from each row, i.e it changes
610
+ mean value, but does NOT change higher moments
611
+
612
+ ! COMMERCIAL EDITION OF ALGLIB:
613
+ !
614
+ ! Commercial Edition of ALGLIB includes following important improvements
615
+ ! of this function:
616
+ ! * high-performance native backend with same C# interface (C# version)
617
+ ! * multithreading support (C++ and C# versions)
618
+ !
619
+ ! We recommend you to read 'Working with commercial version' section of
620
+ ! ALGLIB Reference Manual in order to find out how to use performance-
621
+ ! related features provided by commercial edition of ALGLIB.
622
+
623
+ INPUT PARAMETERS:
624
+ XY - array[NPoints,NFeatures], dataset
625
+ NPoints - number of points
626
+ NFeatures- number of features
627
+
628
+ OUTPUT PARAMETERS:
629
+ XY - data are replaced by their within-row ranks;
630
+ ranking starts from 0, ends at NFeatures-1
631
+
632
+ -- ALGLIB --
633
+ Copyright 18.04.2013 by Bochkanov Sergey
634
+ *************************************************************************/
635
+ void rankdatacentered(real_2d_array &xy, const ae_int_t npoints, const ae_int_t nfeatures, const xparams _xparams = alglib::xdefault);
636
+ void rankdatacentered(real_2d_array &xy, const xparams _xparams = alglib::xdefault);
637
+
638
+
639
+ /*************************************************************************
640
+ Obsolete function, we recommend to use PearsonCorr2().
641
+
642
+ -- ALGLIB --
643
+ Copyright 09.04.2007 by Bochkanov Sergey
644
+ *************************************************************************/
645
+ double pearsoncorrelation(const real_1d_array &x, const real_1d_array &y, const ae_int_t n, const xparams _xparams = alglib::xdefault);
646
+
647
+
648
+ /*************************************************************************
649
+ Obsolete function, we recommend to use SpearmanCorr2().
650
+
651
+ -- ALGLIB --
652
+ Copyright 09.04.2007 by Bochkanov Sergey
653
+ *************************************************************************/
654
+ double spearmanrankcorrelation(const real_1d_array &x, const real_1d_array &y, const ae_int_t n, const xparams _xparams = alglib::xdefault);
655
+ #endif
656
+
657
+ #if defined(AE_COMPILE_CORRELATIONTESTS) || !defined(AE_PARTIAL_BUILD)
658
+ /*************************************************************************
659
+ Pearson's correlation coefficient significance test
660
+
661
+ This test checks hypotheses about whether X and Y are samples of two
662
+ continuous distributions having zero correlation or whether their
663
+ correlation is non-zero.
664
+
665
+ The following tests are performed:
666
+ * two-tailed test (null hypothesis - X and Y have zero correlation)
667
+ * left-tailed test (null hypothesis - the correlation coefficient is
668
+ greater than or equal to 0)
669
+ * right-tailed test (null hypothesis - the correlation coefficient is
670
+ less than or equal to 0).
671
+
672
+ Requirements:
673
+ * the number of elements in each sample is not less than 5
674
+ * normality of distributions of X and Y.
675
+
676
+ Input parameters:
677
+ R - Pearson's correlation coefficient for X and Y
678
+ N - number of elements in samples, N>=5.
679
+
680
+ Output parameters:
681
+ BothTails - p-value for two-tailed test.
682
+ If BothTails is less than the given significance level
683
+ the null hypothesis is rejected.
684
+ LeftTail - p-value for left-tailed test.
685
+ If LeftTail is less than the given significance level,
686
+ the null hypothesis is rejected.
687
+ RightTail - p-value for right-tailed test.
688
+ If RightTail is less than the given significance level
689
+ the null hypothesis is rejected.
690
+
691
+ -- ALGLIB --
692
+ Copyright 09.04.2007 by Bochkanov Sergey
693
+ *************************************************************************/
694
+ void pearsoncorrelationsignificance(const double r, const ae_int_t n, double &bothtails, double &lefttail, double &righttail, const xparams _xparams = alglib::xdefault);
695
+
696
+
697
+ /*************************************************************************
698
+ Spearman's rank correlation coefficient significance test
699
+
700
+ This test checks hypotheses about whether X and Y are samples of two
701
+ continuous distributions having zero correlation or whether their
702
+ correlation is non-zero.
703
+
704
+ The following tests are performed:
705
+ * two-tailed test (null hypothesis - X and Y have zero correlation)
706
+ * left-tailed test (null hypothesis - the correlation coefficient is
707
+ greater than or equal to 0)
708
+ * right-tailed test (null hypothesis - the correlation coefficient is
709
+ less than or equal to 0).
710
+
711
+ Requirements:
712
+ * the number of elements in each sample is not less than 5.
713
+
714
+ The test is non-parametric and doesn't require distributions X and Y to be
715
+ normal.
716
+
717
+ Input parameters:
718
+ R - Spearman's rank correlation coefficient for X and Y
719
+ N - number of elements in samples, N>=5.
720
+
721
+ Output parameters:
722
+ BothTails - p-value for two-tailed test.
723
+ If BothTails is less than the given significance level
724
+ the null hypothesis is rejected.
725
+ LeftTail - p-value for left-tailed test.
726
+ If LeftTail is less than the given significance level,
727
+ the null hypothesis is rejected.
728
+ RightTail - p-value for right-tailed test.
729
+ If RightTail is less than the given significance level
730
+ the null hypothesis is rejected.
731
+
732
+ -- ALGLIB --
733
+ Copyright 09.04.2007 by Bochkanov Sergey
734
+ *************************************************************************/
735
+ void spearmanrankcorrelationsignificance(const double r, const ae_int_t n, double &bothtails, double &lefttail, double &righttail, const xparams _xparams = alglib::xdefault);
736
+ #endif
737
+
738
+ #if defined(AE_COMPILE_JARQUEBERA) || !defined(AE_PARTIAL_BUILD)
739
+ /*************************************************************************
740
+ Jarque-Bera test
741
+
742
+ This test checks hypotheses about the fact that a given sample X is a
743
+ sample of normal random variable.
744
+
745
+ Requirements:
746
+ * the number of elements in the sample is not less than 5.
747
+
748
+ Input parameters:
749
+ X - sample. Array whose index goes from 0 to N-1.
750
+ N - size of the sample. N>=5
751
+
752
+ Output parameters:
753
+ P - p-value for the test
754
+
755
+ Accuracy of the approximation used (5<=N<=1951):
756
+
757
+ p-value relative error (5<=N<=1951)
758
+ [1, 0.1] < 1%
759
+ [0.1, 0.01] < 2%
760
+ [0.01, 0.001] < 6%
761
+ [0.001, 0] wasn't measured
762
+
763
+ For N>1951 accuracy wasn't measured but it shouldn't be sharply different
764
+ from table values.
765
+
766
+ -- ALGLIB --
767
+ Copyright 09.04.2007 by Bochkanov Sergey
768
+ *************************************************************************/
769
+ void jarqueberatest(const real_1d_array &x, const ae_int_t n, double &p, const xparams _xparams = alglib::xdefault);
770
+ #endif
771
+
772
+ #if defined(AE_COMPILE_VARIANCETESTS) || !defined(AE_PARTIAL_BUILD)
773
+ /*************************************************************************
774
+ Two-sample F-test
775
+
776
+ This test checks three hypotheses about dispersions of the given samples.
777
+ The following tests are performed:
778
+ * two-tailed test (null hypothesis - the dispersions are equal)
779
+ * left-tailed test (null hypothesis - the dispersion of the first
780
+ sample is greater than or equal to the dispersion of the second
781
+ sample).
782
+ * right-tailed test (null hypothesis - the dispersion of the first
783
+ sample is less than or equal to the dispersion of the second sample)
784
+
785
+ The test is based on the following assumptions:
786
+ * the given samples have normal distributions
787
+ * the samples are independent.
788
+
789
+ Input parameters:
790
+ X - sample 1. Array whose index goes from 0 to N-1.
791
+ N - sample size.
792
+ Y - sample 2. Array whose index goes from 0 to M-1.
793
+ M - sample size.
794
+
795
+ Output parameters:
796
+ BothTails - p-value for two-tailed test.
797
+ If BothTails is less than the given significance level
798
+ the null hypothesis is rejected.
799
+ LeftTail - p-value for left-tailed test.
800
+ If LeftTail is less than the given significance level,
801
+ the null hypothesis is rejected.
802
+ RightTail - p-value for right-tailed test.
803
+ If RightTail is less than the given significance level
804
+ the null hypothesis is rejected.
805
+
806
+ -- ALGLIB --
807
+ Copyright 19.09.2006 by Bochkanov Sergey
808
+ *************************************************************************/
809
+ void ftest(const real_1d_array &x, const ae_int_t n, const real_1d_array &y, const ae_int_t m, double &bothtails, double &lefttail, double &righttail, const xparams _xparams = alglib::xdefault);
810
+
811
+
812
+ /*************************************************************************
813
+ One-sample chi-square test
814
+
815
+ This test checks three hypotheses about the dispersion of the given sample
816
+ The following tests are performed:
817
+ * two-tailed test (null hypothesis - the dispersion equals the given
818
+ number)
819
+ * left-tailed test (null hypothesis - the dispersion is greater than
820
+ or equal to the given number)
821
+ * right-tailed test (null hypothesis - dispersion is less than or
822
+ equal to the given number).
823
+
824
+ Test is based on the following assumptions:
825
+ * the given sample has a normal distribution.
826
+
827
+ Input parameters:
828
+ X - sample 1. Array whose index goes from 0 to N-1.
829
+ N - size of the sample.
830
+ Variance - dispersion value to compare with.
831
+
832
+ Output parameters:
833
+ BothTails - p-value for two-tailed test.
834
+ If BothTails is less than the given significance level
835
+ the null hypothesis is rejected.
836
+ LeftTail - p-value for left-tailed test.
837
+ If LeftTail is less than the given significance level,
838
+ the null hypothesis is rejected.
839
+ RightTail - p-value for right-tailed test.
840
+ If RightTail is less than the given significance level
841
+ the null hypothesis is rejected.
842
+
843
+ -- ALGLIB --
844
+ Copyright 19.09.2006 by Bochkanov Sergey
845
+ *************************************************************************/
846
+ void onesamplevariancetest(const real_1d_array &x, const ae_int_t n, const double variance, double &bothtails, double &lefttail, double &righttail, const xparams _xparams = alglib::xdefault);
847
+ #endif
848
+
849
+ #if defined(AE_COMPILE_WSR) || !defined(AE_PARTIAL_BUILD)
850
+ /*************************************************************************
851
+ Wilcoxon signed-rank test
852
+
853
+ This test checks three hypotheses about the median of the given sample.
854
+ The following tests are performed:
855
+ * two-tailed test (null hypothesis - the median is equal to the given
856
+ value)
857
+ * left-tailed test (null hypothesis - the median is greater than or
858
+ equal to the given value)
859
+ * right-tailed test (null hypothesis - the median is less than or
860
+ equal to the given value)
861
+
862
+ Requirements:
863
+ * the scale of measurement should be ordinal, interval or ratio (i.e.
864
+ the test could not be applied to nominal variables).
865
+ * the distribution should be continuous and symmetric relative to its
866
+ median.
867
+ * number of distinct values in the X array should be greater than 4
868
+
869
+ The test is non-parametric and doesn't require distribution X to be normal
870
+
871
+ Input parameters:
872
+ X - sample. Array whose index goes from 0 to N-1.
873
+ N - size of the sample.
874
+ Median - assumed median value.
875
+
876
+ Output parameters:
877
+ BothTails - p-value for two-tailed test.
878
+ If BothTails is less than the given significance level
879
+ the null hypothesis is rejected.
880
+ LeftTail - p-value for left-tailed test.
881
+ If LeftTail is less than the given significance level,
882
+ the null hypothesis is rejected.
883
+ RightTail - p-value for right-tailed test.
884
+ If RightTail is less than the given significance level
885
+ the null hypothesis is rejected.
886
+
887
+ To calculate p-values, special approximation is used. This method lets us
888
+ calculate p-values with two decimal places in interval [0.0001, 1].
889
+
890
+ "Two decimal places" does not sound very impressive, but in practice the
891
+ relative error of less than 1% is enough to make a decision.
892
+
893
+ There is no approximation outside the [0.0001, 1] interval. Therefore, if
894
+ the significance level outlies this interval, the test returns 0.0001.
895
+
896
+ -- ALGLIB --
897
+ Copyright 08.09.2006 by Bochkanov Sergey
898
+ *************************************************************************/
899
+ void wilcoxonsignedranktest(const real_1d_array &x, const ae_int_t n, const double e, double &bothtails, double &lefttail, double &righttail, const xparams _xparams = alglib::xdefault);
900
+ #endif
901
+
902
+ #if defined(AE_COMPILE_MANNWHITNEYU) || !defined(AE_PARTIAL_BUILD)
903
+ /*************************************************************************
904
+ Mann-Whitney U-test
905
+
906
+ This test checks hypotheses about whether X and Y are samples of two
907
+ continuous distributions of the same shape and same median or whether
908
+ their medians are different.
909
+
910
+ The following tests are performed:
911
+ * two-tailed test (null hypothesis - the medians are equal)
912
+ * left-tailed test (null hypothesis - the median of the first sample
913
+ is greater than or equal to the median of the second sample)
914
+ * right-tailed test (null hypothesis - the median of the first sample
915
+ is less than or equal to the median of the second sample).
916
+
917
+ Requirements:
918
+ * the samples are independent
919
+ * X and Y are continuous distributions (or discrete distributions well-
920
+ approximating continuous distributions)
921
+ * distributions of X and Y have the same shape. The only possible
922
+ difference is their position (i.e. the value of the median)
923
+ * the number of elements in each sample is not less than 5
924
+ * the scale of measurement should be ordinal, interval or ratio (i.e.
925
+ the test could not be applied to nominal variables).
926
+
927
+ The test is non-parametric and doesn't require distributions to be normal.
928
+
929
+ Input parameters:
930
+ X - sample 1. Array whose index goes from 0 to N-1.
931
+ N - size of the sample. N>=5
932
+ Y - sample 2. Array whose index goes from 0 to M-1.
933
+ M - size of the sample. M>=5
934
+
935
+ Output parameters:
936
+ BothTails - p-value for two-tailed test.
937
+ If BothTails is less than the given significance level
938
+ the null hypothesis is rejected.
939
+ LeftTail - p-value for left-tailed test.
940
+ If LeftTail is less than the given significance level,
941
+ the null hypothesis is rejected.
942
+ RightTail - p-value for right-tailed test.
943
+ If RightTail is less than the given significance level
944
+ the null hypothesis is rejected.
945
+
946
+ To calculate p-values, special approximation is used. This method lets us
947
+ calculate p-values with satisfactory accuracy in interval [0.0001, 1].
948
+ There is no approximation outside the [0.0001, 1] interval. Therefore, if
949
+ the significance level outlies this interval, the test returns 0.0001.
950
+
951
+ Relative precision of approximation of p-value:
952
+
953
+ N M Max.err. Rms.err.
954
+ 5..10 N..10 1.4e-02 6.0e-04
955
+ 5..10 N..100 2.2e-02 5.3e-06
956
+ 10..15 N..15 1.0e-02 3.2e-04
957
+ 10..15 N..100 1.0e-02 2.2e-05
958
+ 15..100 N..100 6.1e-03 2.7e-06
959
+
960
+ For N,M>100 accuracy checks weren't put into practice, but taking into
961
+ account characteristics of asymptotic approximation used, precision should
962
+ not be sharply different from the values for interval [5, 100].
963
+
964
+ NOTE: P-value approximation was optimized for 0.0001<=p<=0.2500. Thus,
965
+ P's outside of this interval are enforced to these bounds. Say, you
966
+ may quite often get P equal to exactly 0.25 or 0.0001.
967
+
968
+ -- ALGLIB --
969
+ Copyright 09.04.2007 by Bochkanov Sergey
970
+ *************************************************************************/
971
+ void mannwhitneyutest(const real_1d_array &x, const ae_int_t n, const real_1d_array &y, const ae_int_t m, double &bothtails, double &lefttail, double &righttail, const xparams _xparams = alglib::xdefault);
972
+ #endif
973
+
974
+ #if defined(AE_COMPILE_STEST) || !defined(AE_PARTIAL_BUILD)
975
+ /*************************************************************************
976
+ Sign test
977
+
978
+ This test checks three hypotheses about the median of the given sample.
979
+ The following tests are performed:
980
+ * two-tailed test (null hypothesis - the median is equal to the given
981
+ value)
982
+ * left-tailed test (null hypothesis - the median is greater than or
983
+ equal to the given value)
984
+ * right-tailed test (null hypothesis - the median is less than or
985
+ equal to the given value)
986
+
987
+ Requirements:
988
+ * the scale of measurement should be ordinal, interval or ratio (i.e.
989
+ the test could not be applied to nominal variables).
990
+
991
+ The test is non-parametric and doesn't require distribution X to be normal
992
+
993
+ Input parameters:
994
+ X - sample. Array whose index goes from 0 to N-1.
995
+ N - size of the sample.
996
+ Median - assumed median value.
997
+
998
+ Output parameters:
999
+ BothTails - p-value for two-tailed test.
1000
+ If BothTails is less than the given significance level
1001
+ the null hypothesis is rejected.
1002
+ LeftTail - p-value for left-tailed test.
1003
+ If LeftTail is less than the given significance level,
1004
+ the null hypothesis is rejected.
1005
+ RightTail - p-value for right-tailed test.
1006
+ If RightTail is less than the given significance level
1007
+ the null hypothesis is rejected.
1008
+
1009
+ While calculating p-values high-precision binomial distribution
1010
+ approximation is used, so significance levels have about 15 exact digits.
1011
+
1012
+ -- ALGLIB --
1013
+ Copyright 08.09.2006 by Bochkanov Sergey
1014
+ *************************************************************************/
1015
+ void onesamplesigntest(const real_1d_array &x, const ae_int_t n, const double median, double &bothtails, double &lefttail, double &righttail, const xparams _xparams = alglib::xdefault);
1016
+ #endif
1017
+
1018
+ #if defined(AE_COMPILE_STUDENTTTESTS) || !defined(AE_PARTIAL_BUILD)
1019
+ /*************************************************************************
1020
+ One-sample t-test
1021
+
1022
+ This test checks three hypotheses about the mean of the given sample. The
1023
+ following tests are performed:
1024
+ * two-tailed test (null hypothesis - the mean is equal to the given
1025
+ value)
1026
+ * left-tailed test (null hypothesis - the mean is greater than or
1027
+ equal to the given value)
1028
+ * right-tailed test (null hypothesis - the mean is less than or equal
1029
+ to the given value).
1030
+
1031
+ The test is based on the assumption that a given sample has a normal
1032
+ distribution and an unknown dispersion. If the distribution sharply
1033
+ differs from normal, the test will work incorrectly.
1034
+
1035
+ INPUT PARAMETERS:
1036
+ X - sample. Array whose index goes from 0 to N-1.
1037
+ N - size of sample, N>=0
1038
+ Mean - assumed value of the mean.
1039
+
1040
+ OUTPUT PARAMETERS:
1041
+ BothTails - p-value for two-tailed test.
1042
+ If BothTails is less than the given significance level
1043
+ the null hypothesis is rejected.
1044
+ LeftTail - p-value for left-tailed test.
1045
+ If LeftTail is less than the given significance level,
1046
+ the null hypothesis is rejected.
1047
+ RightTail - p-value for right-tailed test.
1048
+ If RightTail is less than the given significance level
1049
+ the null hypothesis is rejected.
1050
+
1051
+ NOTE: this function correctly handles degenerate cases:
1052
+ * when N=0, all p-values are set to 1.0
1053
+ * when variance of X[] is exactly zero, p-values are set
1054
+ to 1.0 or 0.0, depending on difference between sample mean and
1055
+ value of mean being tested.
1056
+
1057
+
1058
+ -- ALGLIB --
1059
+ Copyright 08.09.2006 by Bochkanov Sergey
1060
+ *************************************************************************/
1061
+ void studentttest1(const real_1d_array &x, const ae_int_t n, const double mean, double &bothtails, double &lefttail, double &righttail, const xparams _xparams = alglib::xdefault);
1062
+
1063
+
1064
+ /*************************************************************************
1065
+ Two-sample pooled test
1066
+
1067
+ This test checks three hypotheses about the mean of the given samples. The
1068
+ following tests are performed:
1069
+ * two-tailed test (null hypothesis - the means are equal)
1070
+ * left-tailed test (null hypothesis - the mean of the first sample is
1071
+ greater than or equal to the mean of the second sample)
1072
+ * right-tailed test (null hypothesis - the mean of the first sample is
1073
+ less than or equal to the mean of the second sample).
1074
+
1075
+ Test is based on the following assumptions:
1076
+ * given samples have normal distributions
1077
+ * dispersions are equal
1078
+ * samples are independent.
1079
+
1080
+ Input parameters:
1081
+ X - sample 1. Array whose index goes from 0 to N-1.
1082
+ N - size of sample.
1083
+ Y - sample 2. Array whose index goes from 0 to M-1.
1084
+ M - size of sample.
1085
+
1086
+ Output parameters:
1087
+ BothTails - p-value for two-tailed test.
1088
+ If BothTails is less than the given significance level
1089
+ the null hypothesis is rejected.
1090
+ LeftTail - p-value for left-tailed test.
1091
+ If LeftTail is less than the given significance level,
1092
+ the null hypothesis is rejected.
1093
+ RightTail - p-value for right-tailed test.
1094
+ If RightTail is less than the given significance level
1095
+ the null hypothesis is rejected.
1096
+
1097
+ NOTE: this function correctly handles degenerate cases:
1098
+ * when N=0 or M=0, all p-values are set to 1.0
1099
+ * when both samples has exactly zero variance, p-values are set
1100
+ to 1.0 or 0.0, depending on difference between means.
1101
+
1102
+ -- ALGLIB --
1103
+ Copyright 18.09.2006 by Bochkanov Sergey
1104
+ *************************************************************************/
1105
+ void studentttest2(const real_1d_array &x, const ae_int_t n, const real_1d_array &y, const ae_int_t m, double &bothtails, double &lefttail, double &righttail, const xparams _xparams = alglib::xdefault);
1106
+
1107
+
1108
+ /*************************************************************************
1109
+ Two-sample unpooled test
1110
+
1111
+ This test checks three hypotheses about the mean of the given samples. The
1112
+ following tests are performed:
1113
+ * two-tailed test (null hypothesis - the means are equal)
1114
+ * left-tailed test (null hypothesis - the mean of the first sample is
1115
+ greater than or equal to the mean of the second sample)
1116
+ * right-tailed test (null hypothesis - the mean of the first sample is
1117
+ less than or equal to the mean of the second sample).
1118
+
1119
+ Test is based on the following assumptions:
1120
+ * given samples have normal distributions
1121
+ * samples are independent.
1122
+ Equality of variances is NOT required.
1123
+
1124
+ Input parameters:
1125
+ X - sample 1. Array whose index goes from 0 to N-1.
1126
+ N - size of the sample.
1127
+ Y - sample 2. Array whose index goes from 0 to M-1.
1128
+ M - size of the sample.
1129
+
1130
+ Output parameters:
1131
+ BothTails - p-value for two-tailed test.
1132
+ If BothTails is less than the given significance level
1133
+ the null hypothesis is rejected.
1134
+ LeftTail - p-value for left-tailed test.
1135
+ If LeftTail is less than the given significance level,
1136
+ the null hypothesis is rejected.
1137
+ RightTail - p-value for right-tailed test.
1138
+ If RightTail is less than the given significance level
1139
+ the null hypothesis is rejected.
1140
+
1141
+ NOTE: this function correctly handles degenerate cases:
1142
+ * when N=0 or M=0, all p-values are set to 1.0
1143
+ * when both samples has zero variance, p-values are set
1144
+ to 1.0 or 0.0, depending on difference between means.
1145
+ * when only one sample has zero variance, test reduces to 1-sample
1146
+ version.
1147
+
1148
+ -- ALGLIB --
1149
+ Copyright 18.09.2006 by Bochkanov Sergey
1150
+ *************************************************************************/
1151
+ void unequalvariancettest(const real_1d_array &x, const ae_int_t n, const real_1d_array &y, const ae_int_t m, double &bothtails, double &lefttail, double &righttail, const xparams _xparams = alglib::xdefault);
1152
+ #endif
1153
+ }
1154
+
1155
+ /////////////////////////////////////////////////////////////////////////
1156
+ //
1157
+ // THIS SECTION CONTAINS COMPUTATIONAL CORE DECLARATIONS (FUNCTIONS)
1158
+ //
1159
+ /////////////////////////////////////////////////////////////////////////
1160
+ namespace alglib_impl
1161
+ {
1162
+ #if defined(AE_COMPILE_BASESTAT) || !defined(AE_PARTIAL_BUILD)
1163
+ void samplemoments(/* Real */ const ae_vector* x,
1164
+ ae_int_t n,
1165
+ double* mean,
1166
+ double* variance,
1167
+ double* skewness,
1168
+ double* kurtosis,
1169
+ ae_state *_state);
1170
+ double samplemean(/* Real */ const ae_vector* x,
1171
+ ae_int_t n,
1172
+ ae_state *_state);
1173
+ double samplevariance(/* Real */ const ae_vector* x,
1174
+ ae_int_t n,
1175
+ ae_state *_state);
1176
+ double sampleskewness(/* Real */ const ae_vector* x,
1177
+ ae_int_t n,
1178
+ ae_state *_state);
1179
+ double samplekurtosis(/* Real */ const ae_vector* x,
1180
+ ae_int_t n,
1181
+ ae_state *_state);
1182
+ void sampleadev(/* Real */ const ae_vector* x,
1183
+ ae_int_t n,
1184
+ double* adev,
1185
+ ae_state *_state);
1186
+ void samplemedian(/* Real */ const ae_vector* _x,
1187
+ ae_int_t n,
1188
+ double* median,
1189
+ ae_state *_state);
1190
+ void samplepercentile(/* Real */ const ae_vector* _x,
1191
+ ae_int_t n,
1192
+ double p,
1193
+ double* v,
1194
+ ae_state *_state);
1195
+ double cov2(/* Real */ const ae_vector* x,
1196
+ /* Real */ const ae_vector* y,
1197
+ ae_int_t n,
1198
+ ae_state *_state);
1199
+ double pearsoncorr2(/* Real */ const ae_vector* x,
1200
+ /* Real */ const ae_vector* y,
1201
+ ae_int_t n,
1202
+ ae_state *_state);
1203
+ double spearmancorr2(/* Real */ const ae_vector* _x,
1204
+ /* Real */ const ae_vector* _y,
1205
+ ae_int_t n,
1206
+ ae_state *_state);
1207
+ void covm(/* Real */ const ae_matrix* _x,
1208
+ ae_int_t n,
1209
+ ae_int_t m,
1210
+ /* Real */ ae_matrix* c,
1211
+ ae_state *_state);
1212
+ void pearsoncorrm(/* Real */ const ae_matrix* x,
1213
+ ae_int_t n,
1214
+ ae_int_t m,
1215
+ /* Real */ ae_matrix* c,
1216
+ ae_state *_state);
1217
+ void spearmancorrm(/* Real */ const ae_matrix* x,
1218
+ ae_int_t n,
1219
+ ae_int_t m,
1220
+ /* Real */ ae_matrix* c,
1221
+ ae_state *_state);
1222
+ void covm2(/* Real */ const ae_matrix* _x,
1223
+ /* Real */ const ae_matrix* _y,
1224
+ ae_int_t n,
1225
+ ae_int_t m1,
1226
+ ae_int_t m2,
1227
+ /* Real */ ae_matrix* c,
1228
+ ae_state *_state);
1229
+ void pearsoncorrm2(/* Real */ const ae_matrix* _x,
1230
+ /* Real */ const ae_matrix* _y,
1231
+ ae_int_t n,
1232
+ ae_int_t m1,
1233
+ ae_int_t m2,
1234
+ /* Real */ ae_matrix* c,
1235
+ ae_state *_state);
1236
+ void spearmancorrm2(/* Real */ const ae_matrix* x,
1237
+ /* Real */ const ae_matrix* y,
1238
+ ae_int_t n,
1239
+ ae_int_t m1,
1240
+ ae_int_t m2,
1241
+ /* Real */ ae_matrix* c,
1242
+ ae_state *_state);
1243
+ void rankdata(/* Real */ ae_matrix* xy,
1244
+ ae_int_t npoints,
1245
+ ae_int_t nfeatures,
1246
+ ae_state *_state);
1247
+ ae_bool _trypexec_rankdata(/* Real */ ae_matrix* xy,
1248
+ ae_int_t npoints,
1249
+ ae_int_t nfeatures, ae_state *_state);
1250
+ void rankdatacentered(/* Real */ ae_matrix* xy,
1251
+ ae_int_t npoints,
1252
+ ae_int_t nfeatures,
1253
+ ae_state *_state);
1254
+ ae_bool _trypexec_rankdatacentered(/* Real */ ae_matrix* xy,
1255
+ ae_int_t npoints,
1256
+ ae_int_t nfeatures, ae_state *_state);
1257
+ double pearsoncorrelation(/* Real */ const ae_vector* x,
1258
+ /* Real */ const ae_vector* y,
1259
+ ae_int_t n,
1260
+ ae_state *_state);
1261
+ double spearmanrankcorrelation(/* Real */ const ae_vector* x,
1262
+ /* Real */ const ae_vector* y,
1263
+ ae_int_t n,
1264
+ ae_state *_state);
1265
+ #endif
1266
+ #if defined(AE_COMPILE_CORRELATIONTESTS) || !defined(AE_PARTIAL_BUILD)
1267
+ void pearsoncorrelationsignificance(double r,
1268
+ ae_int_t n,
1269
+ double* bothtails,
1270
+ double* lefttail,
1271
+ double* righttail,
1272
+ ae_state *_state);
1273
+ void spearmanrankcorrelationsignificance(double r,
1274
+ ae_int_t n,
1275
+ double* bothtails,
1276
+ double* lefttail,
1277
+ double* righttail,
1278
+ ae_state *_state);
1279
+ #endif
1280
+ #if defined(AE_COMPILE_JARQUEBERA) || !defined(AE_PARTIAL_BUILD)
1281
+ void jarqueberatest(/* Real */ const ae_vector* x,
1282
+ ae_int_t n,
1283
+ double* p,
1284
+ ae_state *_state);
1285
+ #endif
1286
+ #if defined(AE_COMPILE_VARIANCETESTS) || !defined(AE_PARTIAL_BUILD)
1287
+ void ftest(/* Real */ const ae_vector* x,
1288
+ ae_int_t n,
1289
+ /* Real */ const ae_vector* y,
1290
+ ae_int_t m,
1291
+ double* bothtails,
1292
+ double* lefttail,
1293
+ double* righttail,
1294
+ ae_state *_state);
1295
+ void onesamplevariancetest(/* Real */ const ae_vector* x,
1296
+ ae_int_t n,
1297
+ double variance,
1298
+ double* bothtails,
1299
+ double* lefttail,
1300
+ double* righttail,
1301
+ ae_state *_state);
1302
+ #endif
1303
+ #if defined(AE_COMPILE_WSR) || !defined(AE_PARTIAL_BUILD)
1304
+ void wilcoxonsignedranktest(/* Real */ const ae_vector* _x,
1305
+ ae_int_t n,
1306
+ double e,
1307
+ double* bothtails,
1308
+ double* lefttail,
1309
+ double* righttail,
1310
+ ae_state *_state);
1311
+ #endif
1312
+ #if defined(AE_COMPILE_MANNWHITNEYU) || !defined(AE_PARTIAL_BUILD)
1313
+ void mannwhitneyutest(/* Real */ const ae_vector* x,
1314
+ ae_int_t n,
1315
+ /* Real */ const ae_vector* y,
1316
+ ae_int_t m,
1317
+ double* bothtails,
1318
+ double* lefttail,
1319
+ double* righttail,
1320
+ ae_state *_state);
1321
+ #endif
1322
+ #if defined(AE_COMPILE_STEST) || !defined(AE_PARTIAL_BUILD)
1323
+ void onesamplesigntest(/* Real */ const ae_vector* x,
1324
+ ae_int_t n,
1325
+ double median,
1326
+ double* bothtails,
1327
+ double* lefttail,
1328
+ double* righttail,
1329
+ ae_state *_state);
1330
+ #endif
1331
+ #if defined(AE_COMPILE_STUDENTTTESTS) || !defined(AE_PARTIAL_BUILD)
1332
+ void studentttest1(/* Real */ const ae_vector* x,
1333
+ ae_int_t n,
1334
+ double mean,
1335
+ double* bothtails,
1336
+ double* lefttail,
1337
+ double* righttail,
1338
+ ae_state *_state);
1339
+ void studentttest2(/* Real */ const ae_vector* x,
1340
+ ae_int_t n,
1341
+ /* Real */ const ae_vector* y,
1342
+ ae_int_t m,
1343
+ double* bothtails,
1344
+ double* lefttail,
1345
+ double* righttail,
1346
+ ae_state *_state);
1347
+ void unequalvariancettest(/* Real */ const ae_vector* x,
1348
+ ae_int_t n,
1349
+ /* Real */ const ae_vector* y,
1350
+ ae_int_t m,
1351
+ double* bothtails,
1352
+ double* lefttail,
1353
+ double* righttail,
1354
+ ae_state *_state);
1355
+ #endif
1356
+
1357
+ }
1358
+ #endif
1359
+