using kernel density estimates to infer mode of distribution

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

using kernel density estimates to infer mode of distribution

Dan Rabosky

Hello...

Is it possible to use "density" or another kernel density estimator to
identify the mode of a distribution?  When I use 'density', the resulting
density plot of my data is much cleaner than the original noisy histogram,
and I can clearly see the signal that I am interested in.  E.g., suppose my
data is actually drawn from two or more normal (or other)
distributions.  Looking at the kernel density plots, it seems that the
estimator gives a good approximation of the modal values of each
distribution, but I can't figure out how to obtain these values short of
visually estimating the location of the mode using the plot(density).

Is there a relatively easy way to do this?

Thanks in advance for your help!
Dan Rabosky



Dan Rabosky
Department of Ecology and Evolutionary Biology
Cornell University
Ithaca, NY14853-2701 USA
web: http://www.birds.cornell.edu/evb/Graduates_Dan.htm

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: using kernel density estimates to infer mode of distribution

Adelchi Azzalini
On Wed, 15 Feb 2006 18:28:25 -0500, Dan Rabosky wrote:

DR>
DR>  Is it possible to use "density" or another kernel density
DR>  estimator to  identify the mode of a distribution?  When I use
DR>  'density', the resulting

a simple option is of the form
   fit$eval[fit$estimate==max(fit$estimate)]
assuming that fit$eval is the vector of evaluation points,
and fit$estimate the corrisponding density estimates (this is
the sort of output produced by sm.density)

Here I have assumed there is single mode and we are in the scalar
case, for simplicity. Some variant required in the more general case.


best regards,

Adelchi Azzalini
--
Adelchi Azzalini  <[hidden email]>
Dipart.Scienze Statistiche, Università di Padova, Italia
tel. +39 049 8274147,  http://azzalini.stat.unipd.it/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: using kernel density estimates to infer mode of distribution

Frank Samuelson
A  density() fit calls the eval x and estimate y:
fit<-density(data)
plot(fit$x,fit$y)


Adelchi Azzalini wrote:

> On Wed, 15 Feb 2006 18:28:25 -0500, Dan Rabosky wrote:
>
> DR>
> DR>  Is it possible to use "density" or another kernel density
> DR>  estimator to  identify the mode of a distribution?  When I use
> DR>  'density', the resulting
>
> a simple option is of the form
>    fit$eval[fit$estimate==max(fit$estimate)]
> assuming that fit$eval is the vector of evaluation points,
> and fit$estimate the corrisponding density estimates (this is
> the sort of output produced by sm.density)
>
> Here I have assumed there is single mode and we are in the scalar
> case, for simplicity. Some variant required in the more general case.
>
>
> best regards,
>
> Adelchi Azzalini

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: using kernel density estimates to infer mode of distribution

Adelchi Azzalini-2
On Fri, Feb 17, 2006 at 10:45:44AM -0500, Frank Samuelson wrote:
> A  density() fit calls the eval x and estimate y:
> fit<-density(data)
> plot(fit$x,fit$y)
>
>

in my earlier message, I explained that I was referring to the
ingredients names produced ny sm.density (of package sm);
in case some other function is used, eg density(), then
a little adjustment of names is required

AA

> Adelchi Azzalini wrote:
> > On Wed, 15 Feb 2006 18:28:25 -0500, Dan Rabosky wrote:
> >
> > DR>
> > DR>  Is it possible to use "density" or another kernel density
> > DR>  estimator to  identify the mode of a distribution?  When I use
> > DR>  'density', the resulting
> >
> > a simple option is of the form
> >    fit$eval[fit$estimate==max(fit$estimate)]
> > assuming that fit$eval is the vector of evaluation points,
> > and fit$estimate the corrisponding density estimates (this is
> > the sort of output produced by sm.density)
> >
> > Here I have assumed there is single mode and we are in the scalar
> > case, for simplicity. Some variant required in the more general case.
> >
> >
> > best regards,
> >
> > Adelchi Azzalini
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

--
Adelchi Azzalini  <[hidden email]>
Dipart.Scienze Statistiche, Università di Padova, Italia
tel. +39 049 8274147,  http://azzalini.stat.unipd.it/

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html