-
Notifications
You must be signed in to change notification settings - Fork 17
/
quantiles.json
197 lines (197 loc) · 6.74 KB
/
quantiles.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
{
"id": "quantiles",
"summary": "Quantiles",
"description": "Calculates quantiles, which are cut points dividing the range of a sample distribution into either\n\n1. intervals corresponding to the given probabilities *or*\n2. equal-sized intervals (q-quantiles).\n\nEither the parameter `probabilities` or `q` must be specified, otherwise the `QuantilesParameterMissing` exception is thrown. If both parameters are set the `QuantilesParameterConflict` exception is thrown.\n\nSample quantiles can be computed with several different algorithms. Hyndman and Fan (1996) have concluded on nine different types, which are commonly implemented in statistical software packages. This process is implementing type 7, which is implemented widely and often also the default type (e.g. in Excel, Julia, Python, R and S).",
"categories": [
"math > statistics"
],
"parameters": [
{
"name": "data",
"description": "An array of numbers.",
"schema": {
"type": "array",
"items": {
"type": [
"number",
"null"
]
}
}
},
{
"name": "probabilities",
"description": "Quantiles to calculate. Either a list of probabilities or the number of intervals:\n\n* Provide an array with a sorted list of probabilities in ascending order to calculate quantiles for. The probabilities must be between 0 and 1 (inclusive). If not sorted in ascending order, an `AscendingProbabilitiesRequired` exception is thrown.\n* Provide an integer to specify the number of intervals to calculate quantiles for. Calculates q-quantiles with equal-sized intervals.",
"schema": [
{
"title": "List of probabilities",
"type": "array",
"uniqueItems": true,
"items": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
{
"title": "Number of intervals (q-quantiles)",
"type": "integer",
"minimum": 2
}
],
"optional": true
},
{
"name": "q",
"description": "Number of intervals to calculate quantiles for. Calculates q-quantiles with equal-sized intervals.\n\nThis parameter has been **deprecated**. Please use the parameter `probabilities` instead.",
"deprecated": true,
"schema": {
"type": "integer",
"minimum": 2
},
"optional": true
},
{
"name": "ignore_nodata",
"description": "Indicates whether no-data values are ignored or not. Ignores them by default. Setting this flag to `false` considers no-data values so that an array with `null` values is returned if any element is such a value.",
"schema": {
"type": "boolean"
},
"default": true,
"optional": true
}
],
"returns": {
"description": "An array with the computed quantiles. The list has either\n\n* as many elements as the given list of `probabilities` had or\n* *`q`-1* elements.\n\nIf the input array is empty the resulting array is filled with as many `null` values as required according to the list above. See the 'Empty array' example for an example.",
"schema": {
"type": "array",
"items": {
"type": [
"number",
"null"
]
}
}
},
"exceptions": {
"QuantilesParameterMissing": {
"message": "The process `quantiles` requires either the `probabilities` or `q` parameter to be set."
},
"QuantilesParameterConflict": {
"message": "The process `quantiles` only allows that either the `probabilities` or the `q` parameter is set."
},
"AscendingProbabilitiesRequired": {
"message": "The values passed for parameter `probabilities` must be sorted in ascending order."
}
},
"examples": [
{
"arguments": {
"data": [
2,
4,
4,
4,
5,
5,
7,
9
],
"probabilities": [
0.005,
0.01,
0.02,
0.05,
0.1,
0.5
]
},
"returns": [
2.07,
2.14,
2.28,
2.7,
3.4,
4.5
]
},
{
"arguments": {
"data": [
2,
4,
4,
4,
5,
5,
7,
9
],
"probabilities": 4
},
"returns": [
4,
4.5,
5.5
]
},
{
"arguments": {
"data": [
-1,
-0.5,
null,
1
],
"probabilities": 2
},
"returns": [
-0.5
]
},
{
"arguments": {
"data": [
-1,
-0.5,
null,
1
],
"probabilities": 4,
"ignore_nodata": false
},
"returns": [
null,
null,
null
]
},
{
"title": "Empty array",
"arguments": {
"data": [],
"probabilities": [
0.1,
0.5
]
},
"returns": [
null,
null
]
}
],
"links": [
{
"rel": "about",
"href": "https://en.wikipedia.org/wiki/Quantile",
"title": "Quantiles explained by Wikipedia"
},
{
"rel": "about",
"href": "https://www.amherst.edu/media/view/129116/original/Sample+Quantiles.pdf",
"type": "application/pdf",
"title": "Hyndman and Fan (1996): Sample Quantiles in Statistical Packages"
}
]
}