[R] How to get the datapoints of an density estimationwithlocfit?

Ralf.Kloessinger@student.fh-nuernberg.de Ralf.Kloessinger at student.fh-nuernberg.de
Sun Mar 31 04:37:56 CEST 2002


Hello!!

At first thank you all for your suggestions and your help.

But I would like to get another group of datas from the density estimation. I don't know if these information are provided by locfit or I should use an other function like plot().
Description:
Each number between 1 and 100 (only integer) for example should have only one density value. But I also would like to have the density values of points, where I have no input datas. This is the information I would like to have. 
I tried it with fitted.values(), sink(), locfit()$x. 
I know this data must be there, because on the graph produced by plot() I can see the values. Or plot() calculates the points for the graph??

Nice to have:
Input data:   output data :          data range:
for locfit    density estimation     Result
1             0.01                   1
2             0.05                   2
              0.03                   3
              0.06                   4  
5             0.02                   5 
....

Thank you for your help and your time

Ralf  

> 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 ...
>> 
>> Thank you for your help and your time.
>> 
>> 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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list