[R] Kernel smoothing.

Jason Turner jasont at indigoindustrial.co.nz
Wed Dec 18 23:23:03 CET 2002


On Wed, Dec 18, 2002 at 04:53:37PM -0400, Rolf Turner wrote:
> 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.  :-)) 

hmm... "trust me, I know what I'm doing".  The very phrase that results
in many, many children being born each year....   ;)

> Clearly it is not really a density that I am
> trying to estimate.

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
-- 
Indigo Industrial Controls Ltd.
64-21-343-545
jasont at indigoindustrial.co.nz




More information about the R-help mailing list