[19170] in s-news-athena

home help back first fref pref prev next nref lref last post

Re: [S] weighted histogram

daemon@ATHENA.MIT.EDU (Frank E Harrell Jr)
Thu Sep 9 10:58:44 1999

Message-Id: <37D81CF8.D275493B@virginia.edu>
Date: Thu, 09 Sep 1999 16:47:53 -0400
From: Frank E Harrell Jr <fharrell@virginia.edu>
Mime-Version: 1.0
To: Christian Hoffmann <christian.hoffmann@lagonda.wsl.ch>
Cc: s-news@wubios.wustl.edu
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit


You might look at the wtd.stats in the Hmisc library.  I don't have a weighted
histogram
but there is a weighted empirical CDF and weighted table()-type function.
-Frank Harrell

Christian Hoffmann wrote:

> Hi there,
>
> For the evaluation of data of a stratified survey I would like to extend
> the function "histogram" so that its bars represent the weighted sum of
> occurrences of the data in the bins. This is because the probability for an
> individual to be represented in the survey is a different constant for each
> stratum. ( => "weights" <- 1/probability). If all "weights" == 1, then the
> resulting plot should reproduce the plot generated by the original version
> of "histogram".
>
> An analysis of the code of "histogram" shows that "tabulate" is used in the
> crucial step. Unfortunately this function is only given as
> ".C("tabulate",ans = integer(nbins),as.integer(bin) -
> as.integer(1),n)$ans". Instead of "tabulate" I need an analogous function
> summing for each bin the values of the "weights" which correspond to the x
> going into that respective bin.
>
> Does anyone have a hint?
>
> Thanks
>
> --Christian
> Christian W. Hoffmann
> Swiss Federal Institute for Forest, Snow and Landscape Research
> CH-8903 Birmensdorf, Switzerland
> phone: ++41-1-739 22 77    fax  : ++41-1-737 40 80   e-mail: Hoffmann@WSL.CH
> WWW: http://www.wsl.ch/land/dynamics/modeling/hoffmann.htm
> FTP:     ftp://ftp.wsl.ch/pub/hoffmann/
> I prefer WWW pages which can be viewed best with *any* browser, contain
> *no* cookies, *no* Java, *no* frames, and *no* required images !
>


-----------------------------------------------------------------------
This message was distributed by s-news@wubios.wustl.edu.  To unsubscribe
send e-mail to s-news-request@wubios.wustl.edu with the BODY of the
message:  unsubscribe s-news

home help back first fref pref prev next nref lref last post