Re: Weighted histogram
- To: mathgroup at smc.vnet.net
- Subject: [mg62269] Re: Weighted histogram
- From: "Ray Koopman" <koopman at sfu.ca>
- Date: Fri, 18 Nov 2005 05:57:57 -0500 (EST)
- References: <dliv00$g1b$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
kalymereau at yahoo.fr wrote: > Hi MathGroup > > With Histogram[{a1,a2,...,an}] one can represent the histogram of > values in a list. I have a (classical) problem where each value ai has > to be weighted by some real positive value wi. What is the simplest way > to represent the histogram of values {a1,a2,...,an} ponderated by a > list {w1,w2,...,wn} ? > > Thanks > > Geronimo <<Graphics`Graphics`; a = Table[Random[Integer,{1,9}], {n = 100}]; w = Table[-Log[Random[]],{n}]; p = #/Tr@#&[ Tr@Pick[w,a,#]& /@ Range[Min@a,Max@a] ]; Histogram[p, FrequencyData->True]