Rex Carazo-Zapetis
2008-Jan-03 03:03 UTC
[R] KernSmooth: bkde and dpik bandwidth questions
Hi, I have two separate questions relating to the KernSmooth package. I am using the dpik function from the KernSmooth package and receive the error Warning message: In kappam * Gcounts : longer object length is not a multiple of shorter object length I saw an earlier post , but the issue was using the bkde fxn and the person appeared to be using too small of a bandwidth. However, dpik returns a bandwidth and therefore I am not sure why I am getting this error. If I use dpik and specify scalest to be "stdev" then the fxn works. Secondly, I am using the bkde function and when I put in a vector of data the function computes some bandwidth to use as it then proceeds to return x and y vectors. I do not see in the documentation the process by which this bandwidth is computed. It does not appear to match the bandwidth (or even be remotely close, it is an order of magnitude different) when using the dpik function (with scalest = "stdev"). If someone could tell me how it calculates the bandwidth which the function uses I would appreciate it. Thank you in advance. [[alternative HTML version deleted]]
On Wed, 2 Jan 2008, Rex Carazo-Zapetis wrote:> Hi, > > I have two separate questions relating to the KernSmooth package. I am > using the dpik function from the KernSmooth package and receive the error > > Warning message: > In kappam * Gcounts : > longer object length is not a multiple of shorter object length>From the footer of every R-help message:> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.We have no idea how to reproduce this.> > I saw an earlier post , but the issue was using the bkde fxn and the > person appeared to be using too small of a bandwidth. However, > dpik returns a bandwidth and therefore I am not sure why I am getting this > error. If I use dpik and specify scalest to be "stdev" then the fxn works. > > > Secondly, I am using the bkde function and when I put in a vector of data > the function computes some bandwidth to use as it then proceeds to return x > and y vectors. I do not see in the documentation the process by which this > bandwidth is computed. It does not appear to match the bandwidth (or even > be remotely close, it is an order of magnitude different) when using the > dpik function (with scalest = "stdev"). If someone could tell me how it > calculates the bandwidth which the function uses I would appreciate it.This is support software for a book, referenced on the help page. Have you consulted it? A quick read of the code of bkde will show you which of the methods it is.> Thank you in advance. > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. >-- 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