[R] density estimation with weighted sample
Prof Brian Ripley
ripley at stats.ox.ac.uk
Thu Apr 7 10:25:01 CEST 2005
On Thu, 7 Apr 2005, Tomassini, Lorenzo wrote:
> I would like to perform density estimation with a weighted sample
> (output of an Importance Sampling procedure) in R. Could anybody give me
> an advice on what function to use (in which package)?
This could mean
1) You have a sample with weights w, so `w=4' means `I have 4 of those'.
2) You have a sample from a density proportional to w(x)f(x) and want to
estimate f.
Your title suggests the first, your comment the second. If it is the
second, use any package (even density() in R) to estimate the density g of
the sampled distribution, for ghat/w and rescale to unit area. If you
know a lot about w (e.g. in stereology) there are specialized methods
which are better.
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
More information about the R-help
mailing list