JuliaStats / StatsBase.jl

Basic statistics for Julia
Other
585 stars 191 forks source link

y errorbar for the Histogram #597

Open mmikhasenko opened 4 years ago

mmikhasenko commented 4 years ago

I would like to assign an errorbar to histogram weights (when plotting), Usually, Binomial or Poisson distribution is assumed for the number of entries, so the error reads sqrt(weight).

To calculate the error with weighted data, I need to access a sample of data weighs that enter a particular bin, not just Histogram.weights. Is there a way to do it?

mmikhasenko commented 3 years ago

I think there are two options:

mmikhasenko commented 3 years ago

Should one create a separate type <: AbstractHistogram or extend the existing one?

jstrube commented 3 years ago

I remember the AIDA project a while ago, which keeps around the bin entries, weights and weights^2. cc @joshday for how to deal with this in OnlineStats.

mmikhasenko commented 3 years ago

that is what I codded at the end, but I would love to change and extend some existing, more mature package

joshday commented 3 years ago

OnlineStats doesn't do StatsBase-like weighting, mainly because I haven't figured out the right interface for it. There is https://github.com/gdkrmr/WeightedOnlineStats.jl where you could use a per-bin WeightedVariance.

Moelf commented 3 years ago

@mmikhasenko currently making 1D and 2D histograms with errors (sqrt and pearson, so up and down are recorded separately), part of my Final project so something should come out before the year ends for sure ;)