Skip to content

Kernel smoothing.

2 messages · Rolf Turner, Jason Turner

#
I wish to produce a weighted (Gaussian?) kernel density estimate, in
2 dimensions, where the weights are permitted to be ***negative***.
(I can ASSURE you that there are perfectly legitimate reasons why I
want to do this.  :-)) Clearly it is not really a density that I am
trying to estimate.

I had a go at using sm.density() from the sm package, but this
requires that the weights be positive.  Is there any software lurking
in the undergrowth that I could use for my purpose?  Or bits and
pieces that could give me a start on building the machine that I
need?

Ta.

			cheers,

				Rolf Turner
				rolf at math.unb.ca
#
On Wed, Dec 18, 2002 at 04:53:37PM -0400, Rolf Turner wrote:
hmm... "trust me, I know what I'm doing".  The very phrase that results
in many, many children being born each year....   ;)
possible quick workarounds...

1) remove entries that have negative weights before you calculate
the density?
2) re-scale your weights so they're all positive.  Depending on
the weighting (and exctly what you're doing), 

my.weights2 <- exp(my.weights) 

or

my.weights2 <- my.weights + min(my.weights)

Cheers

Jason