findBgnd | R Documentation |
Calculate a value between background and foreground pixels using an approximation of Otsu's method for a bimodal mixture of values or a unimodal normal distribution. This function assumes that the background value will lie to the right of the left-most population.
findBgnd(x, mult = 2.5, log = TRUE)
x |
Fluorescent values to evaluate. |
mult |
Numeric multiplier applied to the standard deviation, with default value of 2.5. |
log |
A |
Data are assumed to be drawn from two unimodal, continuous
distributions where the background population follows a normal distribution.
The maximum of this population is determined from a kernel density estimate
and the left half of the distribution is fit to a Gaussian
distribution with the fitdistr
function. The value
returned is the position of the peak + mult
times the estimated
standard deviation of the distribution.
Because fluorescent values are typically log-transformed before analysis,
the values are log-transformed by default before analysis. This can be turned
off with the log
parameter. Typically, the parameter mult
must be empirically determined. Note that with mult = 0
, the mean
value of the background intensity will be returned.
If the distribution is heavily skewed to the left (mostly dark values), the standard deviation of the distribution will be estimated as 1.35x the interquartile range.
The value estimated as position of the background peak + mult * standard deviation of the normal population.
getZero
getBgnd
x <- c(rlnorm(200), rlnorm(120, 4))
plot(density(log(x)))
bg <- sapply(0:4, function(m) findBgnd(x, mult = m))
abline(v = log(bg), col = 1:5) # background limit
legend("topleft", legend = 0:4, title = "mult", lty = 1, col = 1:5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.