You can use 'rle' to find where the direction changes and use that to
determine the peaks:
> # create test data
> x <- seq(-2,7, length=2000)
> y <- dnorm(x) + dnorm(x,3)
> plot(y,type='l')
> # find where direction changes from plus to minus
> z <- rle(diff(y) > 0)# find where breaks are
> z
R
On 10/13/07, Rob Knell <[EMAIL PROTECTED]> wrote:
> I'm trying to do a simulation that involves identifying the minimum
> point between two peaks of a (usually) bimodal distribution. I can do
> this easily if there are only two peaks:
>
> CnBdens<-density(Ys/Xs) #probability density function for ra
Hello all
I'm trying to do a simulation that involves identifying the minimum
point between two peaks of a (usually) bimodal distribution. I can do
this easily if there are only two peaks:
CnBdens<-density(Ys/Xs) #probability density function for ratio of Ys
to Xs
for(p in
3 matches
Mail list logo