[R] help in density estimation

Greg Snow Greg.Snow at imail.org
Thu Sep 23 20:02:31 CEST 2010


You could do:

b <- runif(10000, 0, 1)
tmp <- density(b, from=0.5, to=0.5, n=1)
tmp$y

As one direct approach.

You could also look at the logspline package for an alternative for density estimation that provides you with a density function (and also allows for finite  domains).

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of wangguojie2006
> Sent: Thursday, September 23, 2010 9:43 AM
> To: r-help at r-project.org
> Subject: [R] help in density estimation
> 
> 
> Hi, guys,
> 
> I'm using kernel "density" estimation. But how can I return to a
> density
> estimation for a fixed point?
> 
> For example,
> 
> b<-runif(1000,0,1)
> f<-density(b)
> 
> How can I get the value of density(b) at b=0.5?
> 
> Your help is extremely appreciated. Thanks.
> 
> Jay
> --
> View this message in context: http://r.789695.n4.nabble.com/help-in-
> density-estimation-tp2552264p2552264.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.



More information about the R-help mailing list