Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compute statistics along dimensions #77

Closed
8 tasks
lindahua opened this issue Jun 23, 2014 · 9 comments
Closed
8 tasks

Compute statistics along dimensions #77

lindahua opened this issue Jun 23, 2014 · 9 comments

Comments

@lindahua
Copy link
Contributor

It is useful to compute certain statistics along specific dimensions. I open this thread to derive the development along this line.

  • skewness
  • kurtosis
  • moment
  • entropy
  • geomean
  • harmmean
  • variation
  • sem

Some other functions like mode and quantile require more sophisticated data structure to compute, and thus not included in this list. We may look at those in future.

@bjarthur
Copy link
Contributor

+1 if you mean something like this:

StatsBase.trimmean{T}(v::AbstractArray{T}, p, region) = mapslices(x->trimmean(x,p), v, region)

@jamblejoe
Copy link

Any progress on this?

@nalimilan
Copy link
Member

Now that Julia provides these, it is probably be better to use e.g. skewness.(eachrow(x)) and skewness.(eachcol(x)). The dims=1/dims=2 approach requires adjusting lots of methods and is less explicit.

@cossio
Copy link

cossio commented Jun 27, 2020

It would be nice to have functions like skewness(A; dims) taking a dims keyword to reduce over, where A can be a general N-dimensional Array. Any plans to implement this?

@kleinschmidt
Copy link
Member

@cossio There's a PR to add a generic eachslice iterator to Base: JuliaLang/julia#32310; it's been under review for a while but there's recent activity...

@nilshg
Copy link

nilshg commented Mar 28, 2023

This is now merged, time to close this issue?

@jamblejoe
Copy link

skewness(rand(10,10), dims=1) doesn't work on 1.9rc1 and latest StatsBase

@bjarthur
Copy link
Contributor

@jamblejoe but you can use eachslice on julia 1.8 to achieve the same:

julia> skewness.(eachslice(rand(10,10), dims=1))
10-element Vector{Float64}:
 -0.357654736525527
 -0.06636393783605732
 -0.20782459433865907
  1.25151036890323
  0.13408296667729347
 -0.4302398373636257
 -0.14363707095203634
 -0.00889806440269636
 -0.6370034546305223
  0.5832296811450159

@jamblejoe
Copy link

@bjarthur works thanks! Can be closed from my side

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants