[R] bandwidth estimation using bw.SJ

D.Pleydell dpleydel at univ-fcomte.fr
Thu Apr 3 21:46:38 CEST 2008



Majnu John wrote:
> 
>     When I use bw.SJ (based on Sheather & Jones, 1991) in R to estimate
> the bandwidth for a highly skewed data, I get the following message:
> "sample is too sparse to find TD". I played around with the parameters
> such as no. of bins (nb), lower, upper (range over which to minimize) to
> no avail. My sample size is 50,000.
> 
>     Can anyone tell me what this means and of some way to get around
> this. Any help is very much appreciated.
> 

I also get the same error message. It seems to be a function of sample size.
The following example runs fine with fewer random numbers.

rdat <- rnorm(111111)
hist(rdat,breaks=100)
rdpi <-  density(rdat, width="SJ-dpi", n=ceiling(diff(range(rdat))*100))
Erreur dans bw.SJ(x, method = "dpi") : sample is too sparse to find TD

Clearly density() doesn't like being turned up to 11. 
I didn't find a solution in R, but the follow package for python seems to
handle sample sizes at least two orders of magnitude greater than density()
in  R :-p
http://bonsai.ims.u-tokyo.ac.jp/~mdehoon/software/python/Statistics/manual/index.xhtml

Good luck
Dave



-- 
View this message in context: http://www.nabble.com/bandwidth-estimation-using-bw.SJ-tp16284293p16470097.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list