noiseFloor | R Documentation |
Apply noise floor and ceiling to numeric vector
noiseFloor(
x,
minimum = 0,
newValue = minimum,
adjustNA = FALSE,
ceiling = NULL,
newCeiling = ceiling,
...
)
x |
|
minimum |
|
newValue |
|
adjustNA |
|
ceiling |
|
newCeiling |
|
... |
additional parameters are ignored. |
A noise floor is useful when detected numeric values are sometimes below a clear noise threshold, and where some downstream ratio may be calculated using these values. Applying a noise floor ensures the ratios and not artificially higher, especially in cases where the values involved are least reliable. This procedure is expected to produce more conservative and appropriate ratios in that scenario.
A ceiling is similar, values above the ceiling are set to the ceiling,
which is practical when values above a certain threshold are conceptually
similar to those at the threshold. One clear example is plotting
-log10(Pvalue)
when the range of P-values might approach 1e-1000.
In this case, setting a ceiling of 50 conceptually equates P-values
below 1e-50, while also restricting the axis range of a plot.
The ability to set values at the floor to a different value, using
newValue
different from minimum
, is intended to allow separation
of numeric values from the floor for illustrative purposes.
A numeric
vector or matrix
, matching the input type x
where numeric
values are fixed to the minimum
and ceiling
values as defined
by newValue
and newCeiling
, respectively.
Other jam numeric functions:
deg2rad()
,
fix_matrix_ratio()
,
normScale()
,
rad2deg()
,
rowGroupMeans()
,
rowRmMadOutliers()
,
warpAroundZero()
# start with some random data
n <- 2000;
x1 <- rnorm(n);
y1 <- rnorm(n);
# apply noise floor and ceiling
x2 <- noiseFloor(x1, minimum=-2, ceiling=2);
y2 <- noiseFloor(y1, minimum=-2, ceiling=2);
# apply noise floor and ceiling with custom replacement values
xm <- cbind(x=x1, y=y1);
xm3 <- noiseFloor(xm,
minimum=-2, newValue=-3,
ceiling=2, newCeiling=3);
parMfrow <- par("mfrow");
par("mfrow"=c(2,2));
plotSmoothScatter(x1, y1);
plotSmoothScatter(x2, y2);
plotSmoothScatter(xm3);
par("mfrow"=parMfrow);
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.