[R] Implementing Silverman's Negative Reflection

David Winsemius dwinsemius at comcast.net
Fri Sep 30 16:00:43 CEST 2011


On Sep 30, 2011, at 4:50 AM, sreblam wrote:

> Hi!
> I'm trying to implement in R in an easy way the negative reflection  
> method
> described in Silverman (1986) on p.31, ie I have a non-negative  
> dataset and
> would like to estimate the density by applying a reflection method  
> where the
> reflected points have weight -1.
> I thought there should be a way to evaluate the wanted kernel at the
> required points, in other words to calculate formula (2.16):
> fhat(x) = 1/(nh) * sum_{i=1}^{n}{ K( (x-Xi) /h) - K( (x-Xi) /h) }
>
> Unfortunately, I am still not that good and skilled with R - does  
> anybody
> know how to do this- Or maybe a hint...?
> Thank you!!

Doing what I thought was the obvious search ( "negative reflection  
density" )  done at the obvious search site (the one to which  
RSiteSearch("negative reflection density") ) typed at the console  
would have taken you) and twiddling with the setting produces this  
perfect match as its second hit:

http://finzi.psych.upenn.edu/Rhelp10/2010-July/246526.html

Now it is true that you wouldn't have gotten that with the console  
entered string which is why I created a new function (and a new  
browser button that fiddles with the default setting for RSiteSearch:

rhelpSearch  <- function(string,
                   restrict = c("Rhelp10", "Rhelp08", "Rhelp02",  
"functions" ),
                   matchesPerPage = 100, ...)
          RSiteSearch(string=string,  restrict = restrict,   
matchesPerPage = matchesPerPage, ...)

R-search button mapped to:
http://search.r-project.org/cgi-bin/namazu.cgi?query=&max=100&result=normal&sort=score&idxname=Rhelp10&idxname=Rhelp08&idxname=Rhelp02&idxname=functions


>
> PS: you can also find the mentioned passage on p.21 of
> http://ned.ipac.caltech.edu/level5/March02/Silverman/paper.pdf
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Implementing-Silverman-s-Negative-Reflection-tp3859191p3859191.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius, MD
West Hartford, CT



More information about the R-help mailing list