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.s...@imail.org 801.408.8111 > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of wangguojie2006 > Sent: Thursday, September 23, 2010 9:43 AM > To: r-help@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@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. ______________________________________________ R-help@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.