| ras_box_stat | R Documentation |
Computes the box-scan score T(i, w) of every window of every width
in widths along a RAS scan profile. This is the building block of
ras_box_detect; most users will call that function instead.
ras_box_stat(
y,
widths = .ras_box_default_widths(),
level0 = NA_real_,
gamma = 0.5,
edge = c("open", "strict")
)
y |
Numeric vector. The scan profile ( |
widths |
Integer vector. Window widths in grid points. Default
|
level0 |
Numeric. Typical median of a null profile (element
|
gamma |
Numeric. Exponent of the level factor. Default |
edge |
|
For a window of w grid points starting at i, with flanks of
f = \max(5, w/2) points on each side,
contrast = mean(window) - max(mean(left flank), mean(right flank))
height = mean(window) - median(y)
T = min(contrast, height) / max(1, median(y)/level0)^{gamma}.
All quantities are in the raw units of the profile; no noise scale is estimated. A window inside a plateau, on the shoulder of a peak, or spanning a cluster of neighbouring peaks scores about 0 because at least one flank is as high as the window.
A data frame with one row per (start, width) pair and columns
i (window start, grid index), w (width), contrast,
height and T.
ras_box_detect, ras_box_calibrate.
y <- rep(1, 400); y[201:230] <- 8
S <- ras_box_stat(y)
S[which.max(S$T), ] # the 30-point window starting at 201
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.