# [R] How to get the datapoints of an density estimation with locfit?

Roger Peng rpeng at stat.ucla.edu
Sat Mar 30 19:43:00 CET 2002

```As far as I know, locfit does not store its estimates.  You have to use
the fitted.values() function.  So, something like:

library(locfit)
x <- rnorm(200)
f <- locfit( ~ x)
fhat <- fitted.values(f)
cbind(x, fhat)

I think that will give you what you want.

-roger
_______________________________
UCLA Department of Statistics
rpeng at stat.ucla.edu
http://www.stat.ucla.edu/~rpeng

On Fri, 29 Mar 2002, Ralf.Kloessinger at student.fh-nuernberg.de wrote:

> Hello!!!
>
> I'm just a beginner of R.  I work with locfit to get the density from
> an numeric vector. It looks good when I plot the graph, but I need the
> output data of locfit. For example I need somthing like that (only
> integer values for the input): numeric vector (input of locfit)
> density (output of locfit)  1 0.05.... 2 0.04.. 3 0.01 ...
>
>
> Ralf Kloessinger
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
> Send "info", "help", or "[un]subscribe"
> (in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```