[R-sig-Geo] Kernel smoothing density function
Sarah Goslee
sarah.goslee at gmail.com
Thu Jul 24 21:35:49 CEST 2014
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
More information about the R-sig-Geo
mailing list