ziko 1.4.0 → 1.5.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,123 @@
1
+ /**
2
+ * Calculates the arithmetic mean of values.
3
+ *
4
+ * @example
5
+ * mean(1, 2, 3) // 2
6
+ */
7
+ export declare function mean(...x: number[]): number;
8
+
9
+ /**
10
+ * Calculates the geometric mean of values.
11
+ *
12
+ * @example
13
+ * geo_mean(1, 4, 16) // 4
14
+ */
15
+ export declare function geo_mean(...x: number[]): number;
16
+
17
+ /**
18
+ * Calculates the root mean square (quadratic mean).
19
+ *
20
+ * @example
21
+ * rms(3, 4) // 2.5
22
+ */
23
+ export declare function rms(...x: number[]): number;
24
+
25
+ /**
26
+ * Calculates the weighted arithmetic mean.
27
+ *
28
+ * @param values Values to average.
29
+ * @param weights Weight associated with each value.
30
+ *
31
+ * @example
32
+ * weighted_mean([10, 20], [1, 3]) // 17.5
33
+ */
34
+ export declare function weighted_mean(
35
+ values: number[],
36
+ weights: number[]
37
+ ): number;
38
+
39
+ /**
40
+ * Calculates the harmonic mean of values.
41
+ *
42
+ * @example
43
+ * harmonic_mean(1, 2, 4) // 1.714...
44
+ */
45
+ export declare function harmonic_mean(...x: number[]): number;
46
+
47
+ /**
48
+ * Calculates the generalized power mean.
49
+ *
50
+ * @param X Input values.
51
+ * @param p Power parameter.
52
+ *
53
+ * @example
54
+ * power_mean([1, 2, 3], 2) // 2.16...
55
+ */
56
+ export declare function power_mean(
57
+ X: number[],
58
+ p: number
59
+ ): number;
60
+
61
+ /**
62
+ * Calculates the trimmed mean by removing k lowest and highest values.
63
+ *
64
+ * @param X Input values.
65
+ * @param k Number of values removed from each side.
66
+ */
67
+ export declare function trimmed_mean(
68
+ X: number[],
69
+ k: number
70
+ ): number;
71
+
72
+ /**
73
+ * Calculates the winsorized mean.
74
+ *
75
+ * Extreme values are replaced by the nearest remaining boundary values.
76
+ *
77
+ * @param X Input values.
78
+ * @param k Number of values affected on each side.
79
+ */
80
+ export declare function winsorized_mean(
81
+ X: number[],
82
+ k: number
83
+ ): number;
84
+
85
+ /**
86
+ * Calculates the midrange.
87
+ *
88
+ * The average of the minimum and maximum values.
89
+ *
90
+ * @example
91
+ * midrange([1, 5, 10]) // 5.5
92
+ */
93
+ export declare function midrange(
94
+ x: number[]
95
+ ): number;
96
+
97
+ /**
98
+ * Calculates the midhinge.
99
+ *
100
+ * The average of the first and third quartiles.
101
+ */
102
+ export declare function midhinge(
103
+ ...x: number[]
104
+ ): number;
105
+
106
+ /**
107
+ * Calculates the interquartile mean.
108
+ *
109
+ * Computes the mean of values between the first and third quartiles.
110
+ */
111
+ export declare function interquartile_mean(
112
+ ...x: number[]
113
+ ): number;
114
+
115
+ /**
116
+ * Calculates the contraharmonic mean.
117
+ *
118
+ * @example
119
+ * contraharmonic_mean(1, 2, 3) // 2.33...
120
+ */
121
+ export declare function contraharmonic_mean(
122
+ ...x: number[]
123
+ ): number;
@@ -0,0 +1,5 @@
1
+ export type * from './accum/index.d.ts';
2
+ export type * from './average/index.d.ts';
3
+ export type * from './percentile/index.d.ts';
4
+ export type * from './rolling/index.d.ts';
5
+ export type * from './variability/index.d.ts';
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Calculates a percentile of a dataset.
3
+ *
4
+ * The percentile value represents the point below which a given
5
+ * percentage of observations fall.
6
+ *
7
+ * @param X Input dataset.
8
+ * @param p Percentile value between 0 and 100.
9
+ *
10
+ * @example
11
+ * percentile([1, 2, 3, 4], 50) // 2.5
12
+ */
13
+ export declare function percentile(
14
+ X: number[],
15
+ p: number
16
+ ): number;
17
+
18
+ /**
19
+ * Calculates the first quartile (25th percentile).
20
+ *
21
+ * @param X Input dataset.
22
+ *
23
+ * @example
24
+ * q1([1, 2, 3, 4]) // 1.75
25
+ */
26
+ export declare function q1(
27
+ X: number[]
28
+ ): number;
29
+
30
+ /**
31
+ * Calculates the median (50th percentile).
32
+ *
33
+ * @param X Input dataset.
34
+ *
35
+ * @example
36
+ * median([1, 2, 3, 4]) // 2.5
37
+ */
38
+ export declare function median(
39
+ X: number[]
40
+ ): number;
41
+
42
+ /**
43
+ * Calculates the third quartile (75th percentile).
44
+ *
45
+ * @param X Input dataset.
46
+ *
47
+ * @example
48
+ * q3([1, 2, 3, 4]) // 3.25
49
+ */
50
+ export declare function q3(
51
+ X: number[]
52
+ ): number;
53
+
54
+ /**
55
+ * Calculates the interquartile range (IQR).
56
+ *
57
+ * The IQR is the difference between the third quartile and first quartile.
58
+ *
59
+ * Formula:
60
+ * IQR = Q3 - Q1
61
+ *
62
+ * @param X Input dataset.
63
+ */
64
+ export declare function iqr(
65
+ X: number[]
66
+ ): number;
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Calculates the Simple Moving Average (SMA).
3
+ *
4
+ * SMA computes the average value over a fixed-size sliding window.
5
+ *
6
+ * @param X Input dataset.
7
+ * @param w Window size.
8
+ *
9
+ * @example
10
+ * sma([1, 2, 3, 4, 5], 3) // [2, 3, 4]
11
+ */
12
+ export declare function sma(
13
+ X: number[],
14
+ w: number
15
+ ): number[];
16
+
17
+ /**
18
+ * Calculates the Exponential Moving Average (EMA).
19
+ *
20
+ * EMA gives more weight to recent observations using a smoothing factor.
21
+ *
22
+ * @param X Input dataset.
23
+ * @param alpha Smoothing factor between 0 and 1.
24
+ *
25
+ * @example
26
+ * ema([1, 2, 3, 4], 0.5) // [1, 1.5, 2.25, 3.125]
27
+ */
28
+ export declare function ema(
29
+ X: number[],
30
+ alpha: number
31
+ ): number[];
32
+
33
+ /**
34
+ * Calculates the Weighted Moving Average (WMA).
35
+ *
36
+ * Each value in the moving window is multiplied by its corresponding weight.
37
+ *
38
+ * @param X Input dataset.
39
+ * @param weights Weights applied to each value in the window.
40
+ *
41
+ * @example
42
+ * wma([1, 2, 3, 4], [1, 2]) // [1.66..., 2.66..., 3.66...]
43
+ */
44
+ export declare function wma(
45
+ X: number[],
46
+ weights: number[]
47
+ ): number[];
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Calculates the population variance.
3
+ *
4
+ * Variance measures how far values are spread from their mean.
5
+ *
6
+ * @example
7
+ * variance(1, 2, 3) // 0.666...
8
+ */
9
+ export declare function variance(
10
+ ...x: number[]
11
+ ): number;
12
+
13
+ /**
14
+ * Calculates the population standard deviation.
15
+ *
16
+ * @example
17
+ * std(1, 2, 3) // 0.816...
18
+ */
19
+ export declare function std(
20
+ ...x: number[]
21
+ ): number;
22
+
23
+ /**
24
+ * Calculates the sample variance.
25
+ *
26
+ * Uses Bessel's correction (n - 1) for an unbiased estimator.
27
+ *
28
+ * @example
29
+ * sample_variance(1, 2, 3) // 1
30
+ */
31
+ export declare function sample_variance(
32
+ ...x: number[]
33
+ ): number;
34
+
35
+ /**
36
+ * Calculates the sample standard deviation.
37
+ *
38
+ * @example
39
+ * sample_std(1, 2, 3) // 1
40
+ */
41
+ export declare function sample_std(
42
+ ...x: number[]
43
+ ): number;
44
+
45
+ /**
46
+ * Calculates the weighted variance.
47
+ *
48
+ * @param X Input dataset.
49
+ * @param weights Weight associated with each value.
50
+ *
51
+ * @example
52
+ * weighted_variance([1, 2, 3], [1, 2, 1]) // 0.5
53
+ */
54
+ export declare function weighted_variance(
55
+ X: number[],
56
+ weights: number[]
57
+ ): number;
58
+
59
+ /**
60
+ * Calculates the weighted standard deviation.
61
+ *
62
+ * @param X Input dataset.
63
+ * @param weights Weight associated with each value.
64
+ */
65
+ export declare function weighted_std(
66
+ X: number[],
67
+ weights: number[]
68
+ ): number;
69
+
70
+ /**
71
+ * Calculates rolling sample variance over a sliding window.
72
+ *
73
+ * @param X Input dataset.
74
+ * @param windowSize Number of elements in each window.
75
+ *
76
+ * @example
77
+ * rolling_variance([1, 2, 3, 4], 3) // [1, 1, 1]
78
+ */
79
+ export declare function rolling_variance(
80
+ X: number[],
81
+ windowSize: number
82
+ ): number[];
83
+
84
+ /**
85
+ * Calculates rolling standard deviation over a sliding window.
86
+ *
87
+ * @param X Input dataset.
88
+ * @param windowSize Number of elements in each window.
89
+ */
90
+ export declare function rolling_std(
91
+ X: number[],
92
+ windowSize: number
93
+ ): number[];
@@ -1,5 +0,0 @@
1
- export type * from './complex/index.d.ts'
2
- // export type * from './time'
3
- // export type * from './router'
4
- // export type * from './hooks'
5
- // export type * from './data'