best_tau: Find the best tau parameter for exponential smoothing...

View source: R/best_tau.R

best_tauR Documentation

Find the best tau parameter for exponential smoothing detrending.

Description

Use Nolan's algorithm to find the ideal tau parameter for exponential smoothing detrending.

Usage

best_tau(img, cutoff = 0.05, parallel = FALSE, purpose = c("FCS", "FFS"))

Arguments

img

A 4-dimensional array in the style of an ijtiff_img (indexed by img[y, x, channel, frame]) or a 3-dimensional array which is a single channel of an ijtiff_img (indexed by img[y, x, frame]).

cutoff

In exponential filtering detrending, for the weighted average, every point gets a weight. This can slow down the computation massively. However, many of the weights will be approximately zero. With cutoff, we say that any point with weight less than or equal to cutoff times the maximum weight may be ignored; so with cutoff = 0.05, any weight less than 5\ value of this parameter is sensible and its value should not be set to anything else without good reason.

parallel

Would you like to use multiple cores to speed up this function? If so, set the number of cores here, or to use all available cores, use parallel = TRUE.

purpose

What type of calculation do you intend to perform on the detrended image? If it is an FFS (fluorescence fluctuation spectroscopy) calculation (like number and brightness), choose 'FFS'. If it is an FCS (fluorescence correlation spectroscopy) calculation (like cross-correlated number and brightness or autocorrelation), choose 'FCS'. The difference is that if purpose is 'FFS', the time series is corrected for non-stationary mean and variance, whereas if purpose is 'FCS', the time series is corrected for non-stationary mean only. purpose is not required for Robin Hood detrending.

Value

If no detrend is necessary, this function returns NA. If a detrend is required, this function returns a natural number which is the ideal tau parameter for exponential smoothing detrending. If there are multiple channels, the function returns a vector, one tau parameter for each channel.

References

Rory Nolan, Luis A. J. Alvarez, Jonathan Elegheert, Maro Iliopoulou, G. Maria Jakobsdottir, Marina Rodriguez-Muñoz, A. Radu Aricescu, Sergi Padilla-Parra; nandb—number and brightness in R with a novel automatic detrending algorithm, Bioinformatics, https://doi.org/10.1093/bioinformatics/btx434.

Examples

## Not run: 
## These examples are not run on CRAN because they take too long.
## You can still try them for yourself.
img <- ijtiff::read_tif(system.file("extdata", "bleached.tif",
  package = "detrendr"
))[, , 1, ]
best_tau(img, parallel = 2)

## End(Not run)


detrendr documentation built on March 7, 2023, 7:52 p.m.