StatsBase.jl
StatsBase.jl copied to clipboard
y errorbar for the Histogram
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?
I think there are two options:
- computing bin error at on the
fit(Histogram)
call, or - keeping an array of weights for every bin that errors can be computed later using any strategy preferred.
What do you think is more realistic to implement in
StatsBase
?
Should one create a separate type <: AbstractHistogram
or extend the existing one?
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.
that is what I codded at the end, but I would love to change and extend some existing, more mature package
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
.
@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 ;)