findRobustPeaks: Find well-separated peaks

Description Usage Arguments Details Value Author(s) Examples

View source: R/findRobustPeaks.R

Description

This function is a follow-up of getPeaks() by merging closely located ambiguous peaks together.

Usage

1
findRobustPeaks(fit, thr = 1.5)

Arguments

fit

a density fit returned by density()

thr

threshold to separate adjacent peaks. See details.

Details

If two peaks are closely located, one way to tell if they are actually one peak or otherwise is by comparing the peak height with peak width. By assuming both peaks are normally distributed, this is equivalent to compare the peak height with the height of the local minima (h) between them. thr is the minimum ratio of the lower peak height over h. If this ratio is larger than thr, the two peaks are considered separated.

Value

a numeric matrix in the same format as returned by getPeaks()

Author(s)

Bo Li

Examples

1
2
3
4
5
6
7
data(mcmc)
data(prior)
library(DPpackage)
Y=c(rnorm(40,0.4,0.05),rnorm(40,0.8,0.05))
vv=which(Y>0.05&Y<1)
fit=DPdensity(Y,status=TRUE,mcmc=mcmc,prior=prior)
findRobustPeaks(fit)

CHAT documentation built on May 29, 2017, 10:32 p.m.