[R-sig-Geo] Kernel smoothing density function

Ferra Xu ferra.xu at yahoo.com
Thu Jul 24 22:06:54 CEST 2014


Dear Sarah
Thank you for your response. I have attached the data that I'm using. I noticed that no estimate and eval.points are generated...Would you please take a look at it? 
It creates a plot in R environment but the pdf file doesn't work.

Appreciate your help,


On Thursday, July 24, 2014 12:35 PM, Sarah Goslee <sarah.goslee at gmail.com> wrote:
 


Hi,


On Thu, Jul 24, 2014 at 1:22 PM, Ferra Xu <ferra.xu at yahoo.com> wrote:
> Hello all,
> In order to find the kernel smoothing density function of a 3 dimensional data-set, I wrote this code in R:
> library(ks)defect <-read.table(file.choose(),sep=",")hat <-kde(defect)pdf("SampleGraph.pdf")plot(hat,drawpoints=TRUE)dev.off()
> But I have problem in interpretation of the result..I don't see the estimated values for density function (I need to have the values of f to use it in another code). The other problem is that the pdf file is not created correctly..Although the plot is created in R window, when I want to open the pdf file, it says:There was an error opening this document. This file cannot be opened because it has no pages.
>         [[alternative HTML version deleted]]


See why you shouldn't post HTML to this list?

Trying to parse that, I see that I can't run your example because no
data are provided (dput() is a good function to know).

When I run the example code given in ?kde it works as expected. Does
your plot command create a plot on other devices, like the default for
your OS? Does the example code in ?kde work when you run it? Does it
create a plot?

As for the estimated values, did you carefully read the Value section
of the help file?

     A kernel density estimate is an object of class ‘kde’ which is a
     list with fields:

       x: data points - same as input

eval.points: points at which the estimate is evaluated

estimate: density estimate at ‘eval.points’

If this density estimate is not the estimate you are looking for,
you'll need to be more specific.

Sarah

-- 
Sarah Goslee
http://www.functionaldiversity.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20140724/08f1b145/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kernel1.csv
Type: application/vnd.ms-excel
Size: 9661 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-sig-geo/attachments/20140724/08f1b145/attachment.xlb>


More information about the R-sig-Geo mailing list