Commit e0fe39c
committed
Choose different quantile cutpoints in
`Statistics.quantile` returns values which are not the most appropriate
to generate labels. It is more intuitive to choose values from the actual data,
which are likely to have fewer decimals and make more sense for users.
Unfortunately, since we use intervals closed on the left, we cannot use
any of the seven standard definitions of quantiles. Type 1 is the closest,
but we have to take the value next to it as a cutpoint to prevent it from
being included into the next quantile group. This gives essentially consistent
group attributions to R's `Hmisc::cut2` or
`cut(x, quantile(x, (0:n)/n, type=1), include.lowest=T))`,
though with different cutpoints in labels.cut(x, n)
1 parent 3e0d056 commit e0fe39c
2 files changed
+34
-20
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
| 45 | + | |
| 46 | + | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
236 | 248 | | |
237 | 249 | | |
238 | 250 | | |
239 | 251 | | |
240 | 252 | | |
241 | | - | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
242 | 257 | | |
243 | 258 | | |
244 | 259 | | |
| |||
265 | 280 | | |
266 | 281 | | |
267 | 282 | | |
268 | | - | |
269 | | - | |
| 283 | + | |
270 | 284 | | |
271 | 285 | | |
272 | 286 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
130 | | - | |
| 130 | + | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
| 133 | + | |
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | | - | |
| 141 | + | |
142 | 142 | | |
143 | 143 | | |
144 | 144 | | |
| |||
257 | 257 | | |
258 | 258 | | |
259 | 259 | | |
260 | | - | |
| 260 | + | |
261 | 261 | | |
262 | | - | |
263 | | - | |
| 262 | + | |
| 263 | + | |
264 | 264 | | |
265 | 265 | | |
266 | | - | |
267 | | - | |
| 266 | + | |
| 267 | + | |
268 | 268 | | |
269 | 269 | | |
270 | | - | |
271 | | - | |
| 270 | + | |
| 271 | + | |
272 | 272 | | |
273 | 273 | | |
274 | 274 | | |
| |||
353 | 353 | | |
354 | 354 | | |
355 | 355 | | |
356 | | - | |
357 | | - | |
| 356 | + | |
| 357 | + | |
358 | 358 | | |
359 | 359 | | |
360 | | - | |
361 | | - | |
| 360 | + | |
| 361 | + | |
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
0 commit comments