# Minimum and maximum for OnlineStats.OrderStats

**URL:** <https://discourse.julialang.org/t/minimum-and-maximum-for-onlinestats-orderstats/129989>\
**Category:** Statistics\
**Tags:** onlinestats, orderstats, extrema\
**Created:** [June 18, 2025, 1:32pm UTC](https://discourse.julialang.org/t/minimum-and-maximum-for-onlinestats-orderstats/129989 "2025-06-18T13:32:21Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [June 18, 2025, 1:32pm UTC](https://discourse.julialang.org/t/minimum-and-maximum-for-onlinestats-orderstats/129989/1 "2025-06-18T13:32:21Z")

</div>

Would these definitions make sense for `OnlineStats.OrderStats` from OnlineStats.jl?

```julia
Base.minimum(o::OrderStats) = minimum(o.ex)
Base.maximum(o::OrderStats) = maximum(o.ex)
Base.extrema(o::OrderStats) = extrema(o.ex)

```

---

<div class="post-metadata">

**Author:** ![abraemer](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/abraemer/32/51403_2.png) [@abraemer](https://discourse.julialang.org/u/abraemer)\
**Post date:** [June 19, 2025, 10:36am UTC](https://discourse.julialang.org/t/minimum-and-maximum-for-onlinestats-orderstats/129989/2 "2025-06-19T10:36:27Z")

</div>

Not meaning to be rude but the package’s GitHub is probably a better place to ask, isn’t it? You could simply open a PR and let the maintainers decide.

Or am I missing the point of your post?

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [June 19, 2025, 7:08pm UTC](https://discourse.julialang.org/t/minimum-and-maximum-for-onlinestats-orderstats/129989/3 "2025-06-19T19:08:23Z")

</div>

I think this may be a more general statistics question. Does the concept of extrema make sense in terms of order statistics or is that an implementation detail?

I’m not a statistician and this concept is relatively new to me.

I did submit a pull request to OnlineStats.jl:

> <https://github.com/joshday/OnlineStats.jl/pull/297>
>
> OrderStats is currently implemented using an internal \`Extrema\` statistic. Would… it make sense to expose that?
> 
> Specifically, we could implement:
> \* \`Base.minimum\`
> \* \`Base.maximum\`
> \* \`Base.extrema\`
> \* Conversion to \`Extrema\`, which creates a copy of the internal \`Extrema\`

---

<div class="post-metadata">

**Author:** ![joshday](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/joshday/32/368_2.png) [@joshday](https://discourse.julialang.org/u/joshday)\
**Post date:** [June 20, 2025, 6:16pm UTC](https://discourse.julialang.org/t/minimum-and-maximum-for-onlinestats-orderstats/129989/4 "2025-06-20T18:16:05Z")

</div>

> [@mkitti](#):
>
> I think this may be a more general statistics question. Does the concept of extrema make sense in terms of order statistics or is that an implementation detail?

Implementation detail (kinda). `OrderStats` is one of several types OnlineStats provides to help you understand what your data looks like. The 1st and n-th order statistics are _biased_ estimates of the min and max, respectively. I think I added the extrema in there because 1) plotting it will show the actual min/max, and 2) in real life you probably don’t care about these biased quantities, you want the actual min/max.

---

<div class="post-metadata">

**Author:** ![mkitti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkitti/32/12459_2.png) [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Post date:** [June 20, 2025, 11:00pm UTC](https://discourse.julialang.org/t/minimum-and-maximum-for-onlinestats-orderstats/129989/5 "2025-06-20T23:00:30Z")

</div>

Should we add a note about this to explain why these statements might be false?

```julia
maximum(os::OrderStats) == quantile(os::OrderStats, 1.0)
minimum(os::OrderStats) == quantile(os::OrderStats, 0.0)

```

Is it strictly true that the following will hold?

```julia
maximum(os::OrderStats) >= quantile(os::OrderStats, 1.0)
minimum(os::OrderStats) <= quantile(os::OrderStats, 0.0)

```
