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 ratio of Ys > to Xs > > for(p in 1:512) ifelse(CnBdens$y[p]>CnBdens$y[p-1],peak1<-p,break) > #identifies first peak in probability distribution > > for(p in 1:512) ifelse(CnBdens$y[512-p]>CnBdens$y[512-p > +1],peak2<-512-p,break) #identifies second peak in probability > distribution > > but the simulation sometimes produces a small third peak at one end > of the distribution. Is there any simple way to identify the two > highest maxima in a trimodal distribution?
Is your distribution discrete or continuous? Paul ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.