@numero-uno-jpn/rstats 1.18.0 → 1.20.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 (139) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/README.ja.md +7 -7
  3. package/README.md +7 -7
  4. package/dist/causal.js +2 -2
  5. package/dist/chunks/chunk-33ODAPMR.js +2 -0
  6. package/dist/chunks/chunk-3ST6RZXG.js +2 -0
  7. package/dist/chunks/{chunk-JF4PXFJE.js → chunk-4EQN74JN.js} +2 -2
  8. package/dist/chunks/chunk-5RRFO4NU.js +2 -0
  9. package/dist/chunks/{chunk-3JFRDXN7.js → chunk-64DDDGJU.js} +2 -2
  10. package/dist/chunks/chunk-66TEOHPF.js +2 -0
  11. package/dist/chunks/chunk-6ISDROPG.js +2 -0
  12. package/dist/chunks/{chunk-EC77KAAM.js → chunk-6LAKI2QG.js} +2 -2
  13. package/dist/chunks/{chunk-5CTWYFMB.js → chunk-6QCH4LAL.js} +2 -2
  14. package/dist/chunks/{chunk-H6Z7JVSD.js → chunk-6RA73LXX.js} +2 -2
  15. package/dist/chunks/{chunk-KJMLQHCY.js → chunk-7C2ECGT6.js} +1 -1
  16. package/dist/chunks/{chunk-SCFFHEDZ.js → chunk-7KPFNJBE.js} +2 -2
  17. package/dist/chunks/chunk-ARPXG2PG.js +2 -0
  18. package/dist/chunks/chunk-AWXW4WSX.js +2 -0
  19. package/dist/chunks/{chunk-XQCHC3SH.js → chunk-B5GSH3AK.js} +1 -1
  20. package/dist/chunks/{chunk-2JB7F646.js → chunk-BLDLJHUG.js} +2 -2
  21. package/dist/chunks/{chunk-IKMW63BE.js → chunk-BU4I544S.js} +2 -2
  22. package/dist/chunks/{chunk-LCIX76FR.js → chunk-CAUNJ7S6.js} +2 -2
  23. package/dist/chunks/chunk-DFGW4QWU.js +2 -0
  24. package/dist/chunks/{chunk-WYVUCQO3.js → chunk-DPCCSFCG.js} +1 -1
  25. package/dist/chunks/chunk-EXS5QD7V.js +2 -0
  26. package/dist/chunks/chunk-FOCHNNP3.js +2 -0
  27. package/dist/chunks/{chunk-MXZ64QME.js → chunk-HEPGGURG.js} +2 -2
  28. package/dist/chunks/chunk-INNFAVT3.js +2 -0
  29. package/dist/chunks/chunk-JEELIABM.js +2 -0
  30. package/dist/chunks/chunk-KNF2GPJV.js +2 -0
  31. package/dist/chunks/chunk-L4ZS7MAX.js +2 -0
  32. package/dist/chunks/{chunk-RXYZQ3UX.js → chunk-LZAB4M7P.js} +2 -2
  33. package/dist/chunks/chunk-LZTDYQRS.js +3 -0
  34. package/dist/chunks/{chunk-N7BUE54L.js → chunk-MTSU2QHB.js} +2 -2
  35. package/dist/chunks/{chunk-GIK34P23.js → chunk-MXRN2G7O.js} +2 -2
  36. package/dist/chunks/chunk-OFDD4GTZ.js +2 -0
  37. package/dist/chunks/chunk-OOHFFLMY.js +2 -0
  38. package/dist/chunks/chunk-OOO5AAM7.js +2 -0
  39. package/dist/chunks/chunk-PJJJR3H6.js +2 -0
  40. package/dist/chunks/chunk-PVRNAOO7.js +2 -0
  41. package/dist/chunks/chunk-Q2JLU5YD.js +2 -0
  42. package/dist/chunks/{chunk-Z33Q545U.js → chunk-QCQBK5AC.js} +2 -2
  43. package/dist/chunks/chunk-RXK4KSKH.js +2 -0
  44. package/dist/chunks/chunk-UC3YYJHM.js +4 -0
  45. package/dist/chunks/chunk-UPACHZ4F.js +2 -0
  46. package/dist/chunks/{chunk-VATAUY7N.js → chunk-VCXPGCA4.js} +2 -2
  47. package/dist/chunks/chunk-VFL4GGYT.js +2 -0
  48. package/dist/chunks/chunk-VL72MQOQ.js +2 -0
  49. package/dist/chunks/chunk-VSV5QGXX.js +2 -0
  50. package/dist/chunks/{chunk-CTZUYKVL.js → chunk-WMEF5XWO.js} +2 -2
  51. package/dist/chunks/chunk-X6JS6ZZB.js +2 -0
  52. package/dist/chunks/chunk-YEDVOX5V.js +2 -0
  53. package/dist/chunks/chunk-ZCTB4N5J.js +3 -0
  54. package/dist/descriptive.js +2 -2
  55. package/dist/distributions/normal.d.ts +4 -0
  56. package/dist/distributions/normal.js +4 -2
  57. package/dist/distributions.js +2 -2
  58. package/dist/entries/tests.d.ts +6 -0
  59. package/dist/entries/tests.js +6 -0
  60. package/dist/entries/timeseries.d.ts +11 -0
  61. package/dist/entries/timeseries.js +11 -0
  62. package/dist/htest/timeROC.d.ts +564 -0
  63. package/dist/htest/timeROC.js +1106 -0
  64. package/dist/linalg.js +2 -2
  65. package/dist/meta/metabin.d.ts +32 -0
  66. package/dist/meta/metabin.js +137 -0
  67. package/dist/meta/metaextra.d.ts +153 -0
  68. package/dist/meta/metaextra.js +290 -0
  69. package/dist/meta/metagen.d.ts +124 -0
  70. package/dist/meta/metagen.js +263 -0
  71. package/dist/meta/metaother.d.ts +87 -0
  72. package/dist/meta/metaother.js +342 -0
  73. package/dist/meta/netmeta.d.ts +256 -0
  74. package/dist/meta/netmeta.js +547 -0
  75. package/dist/mixed.js +3 -4
  76. package/dist/models/glmFamily.js +4 -1
  77. package/dist/models/metaAnalysis.d.ts +4 -0
  78. package/dist/models/metaAnalysis.js +100 -18
  79. package/dist/multivariate.js +2 -2
  80. package/dist/numerics.js +2 -2
  81. package/dist/regression.js +2 -2
  82. package/dist/rstats.js +20 -18
  83. package/dist/special.js +2 -2
  84. package/dist/tests.js +15 -15
  85. package/dist/timeseries/acf.js +5 -2
  86. package/dist/timeseries/arima.d.ts +154 -0
  87. package/dist/timeseries/arima.js +1007 -0
  88. package/dist/timeseries/autoArima.d.ts +70 -0
  89. package/dist/timeseries/autoArima.js +191 -0
  90. package/dist/timeseries/ets.d.ts +158 -0
  91. package/dist/timeseries/ets.js +883 -0
  92. package/dist/timeseries/forecastArima.d.ts +136 -0
  93. package/dist/timeseries/forecastArima.js +432 -0
  94. package/dist/timeseries/forecastDispatch.d.ts +83 -0
  95. package/dist/timeseries/forecastDispatch.js +130 -0
  96. package/dist/timeseries/forecastSimple.d.ts +177 -0
  97. package/dist/timeseries/forecastSimple.js +371 -0
  98. package/dist/timeseries/forecastUtils.d.ts +260 -0
  99. package/dist/timeseries/forecastUtils.js +619 -0
  100. package/dist/timeseries/holtWinters.d.ts +65 -0
  101. package/dist/timeseries/holtWinters.js +193 -0
  102. package/dist/timeseries/input.d.ts +8 -0
  103. package/dist/timeseries/input.js +27 -0
  104. package/dist/timeseries/ocsbCritical.d.ts +2 -0
  105. package/dist/timeseries/ocsbCritical.js +6 -0
  106. package/dist/timeseries/scale.d.ts +16 -0
  107. package/dist/timeseries/scale.js +48 -0
  108. package/dist/timeseries/statsTs.d.ts +128 -0
  109. package/dist/timeseries/statsTs.js +456 -0
  110. package/dist/timeseries/stl.d.ts +131 -0
  111. package/dist/timeseries/stl.js +489 -0
  112. package/dist/timeseries/tseries.d.ts +110 -0
  113. package/dist/timeseries/tseries.js +369 -0
  114. package/dist/timeseries.js +2 -2
  115. package/package.json +1 -1
  116. package/dist/chunks/chunk-53WQDB3C.js +0 -2
  117. package/dist/chunks/chunk-6I23C2YJ.js +0 -2
  118. package/dist/chunks/chunk-FLFNMSHI.js +0 -3
  119. package/dist/chunks/chunk-GEHMND3C.js +0 -2
  120. package/dist/chunks/chunk-HG4LJBNV.js +0 -2
  121. package/dist/chunks/chunk-HGAEVPVS.js +0 -2
  122. package/dist/chunks/chunk-HMLYEFQN.js +0 -2
  123. package/dist/chunks/chunk-HRRCC2BD.js +0 -2
  124. package/dist/chunks/chunk-IBHMM2SL.js +0 -2
  125. package/dist/chunks/chunk-ICDW3I2F.js +0 -2
  126. package/dist/chunks/chunk-IOJVFYHW.js +0 -2
  127. package/dist/chunks/chunk-IW4S634O.js +0 -2
  128. package/dist/chunks/chunk-JPWYGTUN.js +0 -2
  129. package/dist/chunks/chunk-KVJBCT3D.js +0 -2
  130. package/dist/chunks/chunk-LY5XGFPU.js +0 -2
  131. package/dist/chunks/chunk-MKZH65DK.js +0 -2
  132. package/dist/chunks/chunk-MVPHISOV.js +0 -2
  133. package/dist/chunks/chunk-NDZVVNBB.js +0 -2
  134. package/dist/chunks/chunk-NOTJ45G3.js +0 -4
  135. package/dist/chunks/chunk-QUD3374N.js +0 -2
  136. package/dist/chunks/chunk-V6FMGGUV.js +0 -2
  137. package/dist/chunks/chunk-W5M3R4NH.js +0 -2
  138. package/dist/chunks/chunk-XUMVTGMM.js +0 -2
  139. package/dist/chunks/chunk-YXMHWS5R.js +0 -2
@@ -0,0 +1,260 @@
1
+ import { type MstlResult } from "./stl.js";
2
+ import type { ArimaResult } from "./arima.js";
3
+ /**
4
+ * One row of {@link accuracy}.
5
+ *
6
+ * @category Time series
7
+ */
8
+ export interface AccuracyRow {
9
+ ME: number;
10
+ RMSE: number;
11
+ MAE: number;
12
+ MPE: number;
13
+ MAPE: number;
14
+ MASE: number;
15
+ ACF1: number;
16
+ TheilU?: number;
17
+ }
18
+ /**
19
+ * Accuracy measures (forecast's `accuracy()`): ME, RMSE, MAE, MPE, MAPE, MASE (scaled by the training data's mean
20
+ * |y_t - y_{t-m}|), ACF1 of the errors; for a test set also Theil's U.
21
+ * Equivalent to `forecast::accuracy()` in R.
22
+ *
23
+ * @category Time series
24
+ */
25
+ export declare function accuracy(training: {
26
+ y: readonly number[];
27
+ fitted: readonly number[];
28
+ }, options?: {
29
+ frequency?: number;
30
+ test?: {
31
+ y: readonly number[];
32
+ forecast: readonly number[];
33
+ };
34
+ }): {
35
+ training: AccuracyRow;
36
+ test?: AccuracyRow;
37
+ };
38
+ /**
39
+ * Moving-average smoother (forecast's `ma()`): order k, centred (a 2 x k average) for even k when `centre`. Equivalent to `forecast::ma()` in R.
40
+ *
41
+ * @category Time series
42
+ */
43
+ export declare function ma(x: readonly number[], order: number, options?: {
44
+ centre?: boolean;
45
+ }): number[];
46
+ /**
47
+ * Fourier terms (forecast's `fourier()`): S_k = sin(2 pi k t / m), C_k = cos(2 pi k t / m) for k = 1..K, t = 1..n (or
48
+ * n + 1..n + h), the sine dropped at k = m / 2; columns named "S1-12", "C1-12", ...
49
+ * Equivalent to `forecast::fourier()` in R.
50
+ *
51
+ * @category Time series
52
+ */
53
+ export declare function fourier(options: {
54
+ frequency: number;
55
+ K: number;
56
+ n: number;
57
+ h?: number;
58
+ }): {
59
+ names: string[];
60
+ columns: number[][];
61
+ };
62
+ /**
63
+ * Seasonal dummies (forecast's `seasonaldummy()`): m - 1 columns, the last period omitted; `start` the cycle position (1-based) of the first row. Equivalent to `forecast::seasonaldummy()` in R.
64
+ *
65
+ * @category Time series
66
+ */
67
+ export declare function seasonaldummy(options: {
68
+ frequency: number;
69
+ n: number;
70
+ start?: number;
71
+ h?: number;
72
+ }): number[][];
73
+ /**
74
+ * Days in each month or quarter (forecast's `monthdays()`). Equivalent to `forecast::monthdays()` in R.
75
+ *
76
+ * @category Time series
77
+ */
78
+ export declare function monthdays(options: {
79
+ startYear: number;
80
+ startPeriod?: number;
81
+ n: number;
82
+ frequency?: 12 | 4;
83
+ }): number[];
84
+ /**
85
+ * Easter Sunday of year Y (anonymous Gregorian algorithm) as [month, day]. Not an R function.
86
+ *
87
+ * @category Time series
88
+ */
89
+ export declare function easterSunday(Y: number): [number, number];
90
+ /**
91
+ * The Easter holidays in each month or quarter (forecast's `easter()`): the share of Good Friday .. Easter Sunday (..
92
+ * Monday with `easterMon`) falling in the period, rounded to two decimals (as R). Departs from R for quarterly data
93
+ * with `easterMon` when the holidays span two quarters: R's shares are shifted there (it warns about a replacement
94
+ * length; log 91), rStats.js gives each quarter its share.
95
+ * Equivalent to `forecast::easter()` in R.
96
+ *
97
+ * @category Time series
98
+ */
99
+ export declare function easter(options: {
100
+ startYear: number;
101
+ startPeriod?: number;
102
+ n: number;
103
+ frequency?: 12 | 4;
104
+ easterMon?: boolean;
105
+ }): number[];
106
+ /**
107
+ * Trading days in each month or quarter (forecast's `bizdays()`): weekdays minus the holidays of the financial centre
108
+ * ("New York" (NYSE, default), "London", "NERC", "Toronto", "Zurich"; the rules of log 30-32).
109
+ * Equivalent to `forecast::bizdays()` in R.
110
+ *
111
+ * @category Time series
112
+ */
113
+ export declare function bizdays(options: {
114
+ startYear: number;
115
+ startPeriod?: number;
116
+ n: number;
117
+ frequency?: 12 | 4;
118
+ finCenter?: "New York" | "London" | "NERC" | "Toronto" | "Zurich";
119
+ }): number[];
120
+ /**
121
+ * The Diebold-Mariano test with the Harvey-Leybourne-Newbold correction (forecast's `dm.test()`): d = |e1|^power -
122
+ * |e2|^power, its variance from the autocovariances up to h - 1 (over n), t(n - 1).
123
+ * Equivalent to `forecast::dm.test()` in R.
124
+ *
125
+ * @category Time series
126
+ */
127
+ export declare function dmTest(e1: readonly number[], e2: readonly number[], options?: {
128
+ alternative?: "two.sided" | "less" | "greater";
129
+ h?: number;
130
+ power?: number;
131
+ }): {
132
+ statistic: number;
133
+ parameter: number;
134
+ pValue: number;
135
+ };
136
+ /**
137
+ * Cross-validation and information criteria of a linear model (forecast's `CV()`): CV = mean((e / (1 - h_ii))^2), AIC =
138
+ * n log(SSE/n) + 2(k + 2), AICc, BIC, adjusted R^2 (k = the number of predictors).
139
+ * Equivalent to `forecast::CV()` in R.
140
+ *
141
+ * @category Time series
142
+ */
143
+ export declare function cvLm(x: readonly (readonly number[])[], y0: readonly number[]): {
144
+ CV: number;
145
+ AIC: number;
146
+ AICc: number;
147
+ BIC: number;
148
+ AdjR2: number;
149
+ };
150
+ /**
151
+ * The Ljung-Box test of a model's residuals (forecast's `checkresiduals()`, without the plots): lag = min(2m, n/5) for
152
+ * seasonal data or min(10, n/5), at least df + 3, df = the number of ARMA coefficients (0 for plain residuals).
153
+ * Equivalent to `forecast::checkresiduals()` in R.
154
+ *
155
+ * @category Time series
156
+ */
157
+ export declare function checkresiduals(residuals: readonly number[], options?: {
158
+ frequency?: number;
159
+ df?: number;
160
+ }): {
161
+ statistic: number;
162
+ parameter: number;
163
+ pValue: number;
164
+ lag: number;
165
+ };
166
+ /** The number of ARMA coefficients of a fit (for checkresiduals' df). */
167
+ export declare function armaCoefficients(fit: ArimaResult): number;
168
+ /**
169
+ * Time series cross-validation (forecast's `tsCV()`): for each origin t the forecast errors of y_{t+1..t+h} from the fit
170
+ * to y_1..y_t, stored in row t (NaN where unavailable).
171
+ * Equivalent to `forecast::tsCV()` in R.
172
+ *
173
+ * @category Time series
174
+ */
175
+ export declare function tsCV(y: readonly number[], forecastFun: (y: number[], h: number) => readonly number[], options?: {
176
+ h?: number;
177
+ }): number[][];
178
+ /**
179
+ * The (p, d, q) or (p, d, q, P, D, Q, frequency) of an ARIMA fit (forecast's `arimaorder()`). Equivalent to `forecast::arimaorder()` in R.
180
+ *
181
+ * @category Time series
182
+ */
183
+ export declare function arimaorder(fit: ArimaResult): Record<string, number>;
184
+ /**
185
+ * The AR spectrum (stats' `spec.ar()` at n.freq frequencies 0..0.5) of x: var.pred / |1 - sum a_k e^{-2 pi i f k}|^2. Equivalent to R's `spec.ar()`.
186
+ *
187
+ * @category Time series
188
+ */
189
+ export declare function specAr(x: readonly number[], options?: {
190
+ nFreq?: number;
191
+ }): {
192
+ freq: number[];
193
+ spec: number[];
194
+ order: number;
195
+ };
196
+ /**
197
+ * The dominant period of a series (forecast's `findfrequency()`): 1 unless the maximum of the AR spectrum of the
198
+ * detrended series exceeds 10; then round(1 / f) at the maximum, or, when the maximum is at the lowest frequency, at
199
+ * the largest value after the spectrum first rises (1 if that is the last frequency).
200
+ * Equivalent to `forecast::findfrequency()` in R.
201
+ *
202
+ * @category Time series
203
+ */
204
+ export declare function findfrequency(x: readonly number[]): number;
205
+ /**
206
+ * Interpolation of missing values (forecast's `na.interp()`): linear for non-seasonal series (or at most two periods
207
+ * observed); for seasonal series the seasonal component of a robust mstl of a first filling (lm on Fourier terms K =
208
+ * min(5, floor(m/2)) and a polynomial of degree min(6, floor(n/10))), the seasonally adjusted series interpolated
209
+ * linearly.
210
+ * Equivalent to `forecast::na.interp()` in R.
211
+ *
212
+ * @category Time series
213
+ */
214
+ export declare function naInterp(x: readonly number[], options?: {
215
+ frequency?: number;
216
+ }): number[];
217
+ /**
218
+ * Outliers and their replacements (forecast's `tsoutliers()`): the remainder of seasadj(robust mstl) minus supsmu (or x
219
+ * minus supsmu), points outside [Q1 - 3 IQR, Q3 + 3 IQR], replaced by na.interp with them removed; `iterate` passes
220
+ * (default 2), the union of the flags.
221
+ * Equivalent to `forecast::tsoutliers()` in R.
222
+ *
223
+ * @category Time series
224
+ */
225
+ export declare function tsoutliers(x: readonly number[], options?: {
226
+ frequency?: number;
227
+ iterate?: number;
228
+ }): {
229
+ index: number[];
230
+ replacements: number[];
231
+ };
232
+ /**
233
+ * The series with missing values interpolated and outliers replaced (forecast's `tsclean()`).
234
+ * Equivalent to `forecast::tsclean()` in R.
235
+ *
236
+ * @category Time series
237
+ */
238
+ export declare function tsclean(x: readonly number[], options?: {
239
+ frequency?: number;
240
+ replaceMissing?: boolean;
241
+ iterate?: number;
242
+ }): number[];
243
+ /**
244
+ * The seasonal component of an {@link mstl} decomposition (forecast's `seasonal()`; zeros without one). Equivalent to `forecast::seasonal()` in R.
245
+ *
246
+ * @category Time series
247
+ */
248
+ export declare function seasonalComponent(dec: MstlResult): number[];
249
+ /**
250
+ * The trend-cycle component of an {@link mstl} decomposition (forecast's `trendcycle()`). Equivalent to `forecast::trendcycle()` in R.
251
+ *
252
+ * @category Time series
253
+ */
254
+ export declare function trendcycle(dec: MstlResult): number[];
255
+ /**
256
+ * The remainder component of an {@link mstl} decomposition (forecast's `remainder()`). Equivalent to `forecast::remainder()` in R.
257
+ *
258
+ * @category Time series
259
+ */
260
+ export declare function remainder(dec: MstlResult): number[];