[R] Density estimation with monotonic constaints

Spencer Graves spencer.graves at pdf.com
Sat Feb 4 05:31:25 CET 2006


	  There are multiple functions for density estimation in R, but I don't 
know of any for estimating a "monotonically decreasing density".  If you 
haven't already, I encourage you to use, e.g., the help.search and 
RSiteSearch functions to find and explore their capabililties.

	  Why do you ask?  Are you interested in analyzing particular data 
set(s) or are you doing research on density estimation?

	  If it were my problem, I might just try something like the function 
"density" and then evaluate the results to find out if it satisfied my 
constraints.  If it did and if I were only interested in that data set, 
I'd be done.  If not, I'd increase the smoothing until I got something 
that was monotonic.  If I wanted a more general method, I might wrap a 
call to a function like "density" inside another function, and 
automatically adjust the smoothing until it satisfied some optimality 
criterion I might devise.  If I didn't get what I wanted doing that, I 
might list, e.g., the "density" function and walk through it line by 
line until I figured out what I needed to change to get what I wanted. 
I just listed "density" and found that it consists solely of a call to 
"UseMethod".  To get beyond that, I tried 'methods("density"), which 
told me there was only one "method" called "density.default".  Then 
requesting "density.default" gave me the code for that.  Another tip:  I 
find "debug" extrememly helpeful for walking through code like this.

	  I suspect this will not solve your problem, but I hope at least it 
helps.  If you'd like further assistance from this listserve, please 
submit another post.  However, I encourage you first to PLEASE do read 
the posting guide! "www.R-project.org/posting-guide.html".  Doing so 
might increase your chances for getting useful information more quickly.

	  spencer graves

Debayan Datta wrote:
> Hi All,
>    I have a sample x={x1,x2,..,xn} fom a distribution with density f. I 
> wish to estimate the density. I know a priori that the density is 
> monotonically decreasing. Is there a way to do this in R?
> Thanks
> Debayan
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list