MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Weighted histogram

  • To: mathgroup at
  • Subject: [mg62287] Re: Weighted histogram
  • From: kalymereau at
  • Date: Sat, 19 Nov 2005 05:54:11 -0500 (EST)
  • References: <dliv00$g1b$><dlkcct$pr0$>
  • Sender: owner-wri-mathgroup at

Thank you for the answers but it seems that neither the solution of Bob
nor the one of Ray works.

I want that each value in a be weighted by both its occurrence in the
list a and by the corresponding weight in w. In other words, with
a={1,1,1,2,3,4} and w={1,1,1,1,2,1}
I want the histogram of b={1,1,1,2,3,3,4}

Obviously this is not what does Bob's proposal.

When w is a list of integers it is if course very easy to construct b
from a and w: just duplicates the elements of a according to their
weights in w.

When a is a list of integers then it seems that the solution of Ray
works (although I don't really understand it).

But when both a and w are lists of real numbers, then it doesn't work.

It is possible to construct a binning and then to fill each bin by the
corresponding values in a ponderated by the weights in w. But the tests
I made in this direction were very slow for large lists, and I would
like something more natural.

It seems to me to be a very basic problem of data analysis, any other
idea ?


  • Prev by Date: Re: Re: Types in Mathematica
  • Next by Date: Re: Export to PDF
  • Previous by thread: Re: Weighted histogram
  • Next by thread: Re: Re: Weighted histogram