ThReshold selection for bi-modal data.

First lets load the package and get a data set.

require(threshold)
ds <- twoGaussians(seed=123)
hist(ds$x, breaks='Scott', freq=FALSE)

And see what the different threshold selection methods do.

rosin threshold:

th_rosin <- find_threshold(ds$x, method="rosin")
th_rosin
plot(th_rosin)

valleys threshold:

th_valleys <- find_threshold(ds$x, method="valleys")
th_valleys
plot(th_valleys)

nmm threshold:

th_nmm <- find_threshold(ds$x, method="nmm")
th_nmm
plot(th_nmm)

entropy threshold:

th_entropy <- find_threshold(ds$x, method="entropy")
th_entropy
plot(th_entropy)

ThReshold selection for tri-modal data.

First lets load the package and get a data set.

require(threshold)
ds <- threeGaussians(seed=123)
hist(ds$x, breaks='Scott', freq=FALSE)

And see what the different threshold selection methods do.

rosin threshold:

th_rosin <- find_threshold(ds$x, method="rosin")
th_rosin
plot(th_rosin)

valleys threshold:

th_valleys <- find_threshold(ds$x, method="valleys")
th_valleys
plot(th_valleys)

nmm threshold:

th_nmm.g2 <- find_threshold(ds$x, method="nmm", G=2)
th_nmm.g2

th_nmm.g9 <- find_threshold(ds$x, method="nmm", G=9)
th_nmm.g9

par(mfrow=c(1,2))
plot(th_nmm.g2)
plot(th_nmm.g9)

entropy threshold:

th_entropy <- find_threshold(ds$x, method="entropy")
th_entropy
plot(th_entropy)

ThReshold selection for uni-modal data.

First lets load the package and get a data set.

require(threshold)
ds <- twoGaussians(seed=123, m.pos=0)
hist(ds$x, breaks='Scott', freq=FALSE)

And see what the different threshold selection methods do.

rosin threshold:

th_rosin <- find_threshold(ds$x, method="rosin")
th_rosin
plot(th_rosin)

valleys threshold:

th_valleys <- find_threshold(ds$x, method="valleys")
th_valleys
plot(th_valleys)

nmm threshold:

th_nmm <- find_threshold(ds$x, method="nmm")
th_nmm
plot(th_nmm)

entropy threshold:

th_entropy <- find_threshold(ds$x, method="entropy")
th_entropy
plot(th_entropy)

ThReshold selection - run all at once.

ths <- find_threshold(ds$x, method=c("rosin", "entropy", "valleys", "nmm"))
ths
plot(ths)

# You might also want to compare it to another set of thresholds.
plot(ths, ths_add=list('my_th_1'=c(1),
                       'my_th_2'=c(2, 2.5)))


benmack/threshold documentation built on May 12, 2019, 12:58 p.m.