# StatsBase vs Statistics

**URL:** <https://discourse.julialang.org/t/statsbase-vs-statistics/15326>\
**Category:** Statistics\
**Tags:** package\
**Created:** [September 22, 2018, 4:04am UTC](https://discourse.julialang.org/t/statsbase-vs-statistics/15326 "2018-09-22T04:04:11Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![iwelch](https://avatars.discourse-cdn.com/v4/letter/i/8c91f0/32.png) [@iwelch](https://discourse.julialang.org/u/iwelch)\
**Post date:** [September 22, 2018, 4:04am UTC](https://discourse.julialang.org/t/statsbase-vs-statistics/15326/1 "2018-09-22T04:04:11Z")

</div>

I am wondering whether the naming of StatsBase and Statistics is entirely logical. StatsBase, despite its name, is the “more optional” package. Statistics is included in the base. StatsBase needs to be Pkg.added. maybe they are misnamed?!

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [September 22, 2018, 5:34am UTC](https://discourse.julialang.org/t/statsbase-vs-statistics/15326/2 "2018-09-22T05:34:23Z")

</div>

`StatsBase` precedes the reorganization of `Base` code to `Statistics`. It is still the basic statistics package for things that go beyond the standard library.

---

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [September 22, 2018, 10:58am UTC](https://discourse.julialang.org/t/statsbase-vs-statistics/15326/3 "2018-09-22T10:58:53Z")

</div>

StatsBase is most likely going to be moved in part to Statistics, and in part to other packages (like StatsModels). See e.g. [move statistics out of Base by fredrikekre · Pull Request #27152 · JuliaLang/julia · GitHub](https://github.com/JuliaLang/julia/pull/27152).

---

<div class="post-metadata">

**Author:** ![iwelch](https://avatars.discourse-cdn.com/v4/letter/i/8c91f0/32.png) [@iwelch](https://discourse.julialang.org/u/iwelch)\
**Post date:** [September 22, 2018, 4:00pm UTC](https://discourse.julialang.org/t/statsbase-vs-statistics/15326/4 "2018-09-22T16:00:54Z")

</div>

if I understand correctly, julia will be evaporating StatsBase, so its misleading name will disappear. this is a good choice IMHO.

---

<div class="post-metadata">

**Author:** ![Wei\_Yang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wei_yang/32/23951_2.png) [@Wei\_Yang](https://discourse.julialang.org/u/Wei_Yang)\
**Post date:** [May 21, 2021, 7:06pm UTC](https://discourse.julialang.org/t/statsbase-vs-statistics/15326/5 "2021-05-21T19:06:46Z")

</div>

Almost 3 years later, I wonder if there is any updates on the future of `StatsBase` and `Statistics`. It was very confusing to me when I first started using Julia last year: for example, if I only imported `StatsBase`, I need to do `StatsBase.std([1,2,3])` to find the standard deviation, and the reason is of course to avoid conflict with `Statistics`. I imagine it will also be a point of confusion for many other newcomers.

---

<div class="post-metadata">

**Author:** ![ptoche](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ptoche/32/23554_2.png) [@ptoche](https://discourse.julialang.org/u/ptoche)\
**Post date:** [May 22, 2021, 4:43am UTC](https://discourse.julialang.org/t/statsbase-vs-statistics/15326/6 "2021-05-22T04:43:56Z")

</div>

> [@Wei\_Yang](#):
>
> I imagine it will also be a point of confusion for many other newcomers.

Not if they come from Python 🤣

---

<div class="post-metadata">

**Author:** ![Wei\_Yang](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wei_yang/32/23951_2.png) [@Wei\_Yang](https://discourse.julialang.org/u/Wei_Yang)\
**Post date:** [May 22, 2021, 4:54am UTC](https://discourse.julialang.org/t/statsbase-vs-statistics/15326/7 "2021-05-22T04:54:59Z")

</div>

For people from python probably there is not even a need to ever load ‘Statistics’ as it appears that all the functionalities in ‘Statistics’ can be found in ‘StatsBase’ or ‘Distributions’.

‘Statistics’ is too small for their taste.🤣

---

<div class="post-metadata">

**Author:** ![pdeffebach](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pdeffebach/32/10320_2.png) [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Post date:** [May 22, 2021, 4:22pm UTC](https://discourse.julialang.org/t/statsbase-vs-statistics/15326/8 "2021-05-22T16:22:19Z")

</div>

This is not strictly correct. `StatsBase.std` _is_ `Statistics.std`. The reason is that StatsBase imports Statistics (but does not re-export it), so `std` is in the namespace of StatsBase .

```julia
julia> using StatsBase

julia> @which StatsBase.std
Statistics

```

So there is no need to distinguish between `StatsBase.std` and `Statistics.std`. They are the same function.

There is no deep reason why StatsBase still exists in it’s current form and we haven’t put more things into Statistics. It’s simply a very tedious process that requires a lot of time and effort.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [May 24, 2021, 12:31pm UTC](https://discourse.julialang.org/t/statsbase-vs-statistics/15326/9 "2021-05-24T12:31:10Z")

</div>

> [@pdeffebach](#):
>
> There is no deep reason why StatsBase still exists in it’s current form and we haven’t put more things into Statistics.

I think one of the reasons is the implicit cost of a commitment to maintenance and a specific API that comes with standard library version being tied to Julia. See [this summary here](https://discourse.julialang.org/t/julia-standard-library-for-interval-type/60936/7).

While arguably _some_ functionality could be moved from StatsBase to Statistics, it is unlikely that the API for the whole package is that finalized and/or belongs in a standard library. OTOH, there is no pressing need to move anything, after all there is a package and people can just use it.

---

<div class="post-metadata">

**Author:** ![chiraganand](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chiraganand/32/32787_2.png) [@chiraganand](https://discourse.julialang.org/u/chiraganand)\
**Post date:** [February 25, 2022, 2:17pm UTC](https://discourse.julialang.org/t/statsbase-vs-statistics/15326/10 "2022-02-25T14:17:16Z")

</div>

> So there is no need to distinguish between StatsBase.std and Statistics.std. They are the same function.
> 
> There is no deep reason why StatsBase still exists in it’s current form and we haven’t put more things into Statistics. It’s simply a very tedious process that requires a lot of time and effort.

Looks like this isn’t the case with Julia v1.5.3 (see the output). I am new to Julia and got stuck here wondering why `median` isn’t there in StatsBase.

```julia
julia> using StatsBase

julia> mean
mean (generic function with 8 methods)

julia> median
ERROR: UndefVarError: median not defined

julia> using Statistics

julia> median
median (generic function with 4 methods)

```

---

<div class="post-metadata">

**Author:** ![nalimilan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nalimilan/32/147_2.png) [@nalimilan](https://discourse.julialang.org/u/nalimilan)\
**Post date:** [February 25, 2022, 2:57pm UTC](https://discourse.julialang.org/t/statsbase-vs-statistics/15326/11 "2022-02-25T14:57:52Z")

</div>

You’re probably using an old version of StatsBase. Use `]st StatsBase` to check that you are using 0.33.16.

---

<div class="post-metadata">

**Author:** ![chiraganand](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chiraganand/32/32787_2.png) [@chiraganand](https://discourse.julialang.org/u/chiraganand)\
**Post date:** [February 25, 2022, 3:16pm UTC](https://discourse.julialang.org/t/statsbase-vs-statistics/15326/12 "2022-02-25T15:16:52Z")

</div>

Yes! I am running v0.32.2.
