fix: return the value as all three quartiles for single-element input
Quartile called Median on empty half-slices when the input held one value
and discarded both errors, so it returned {NaN, v, NaN} with a nil error.
The NaN spread silently through InterQuartileRange, Midhinge and Trimean.
A single observation is its own lower hinge, median and upper hinge, which
is what Percentile already returns for the same data. Return that instead,
and note why the remaining discarded Median errors cannot fire.
This commit is contained in:
1 parent
05657cd5a8
commit
62beb61195
3 files changed
+57
-1
No files matched your search
@@ -2183,6 +2183,9 @@ func Quartile(input Float64Data) (Quartiles, error)
|
||||
```
|
||||
Quartile returns the three quartile points from a slice of data
|
||||
|
||||
A single value is its own lower hinge, median and upper hinge, so all
|
||||
three quartiles are that value.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user