| ras_box_detect | R Documentation |
The box-scan region detector, the alternative to the changepoint detector
(ras_detect + ras_validate) selected with
detector = "box" in ras.
It reports intervals [\tau_L, \tau_R] of the scan profile whose
mean stands above both adjacent flanks and above the profile background,
which lets it delimit broad plateau-shaped association regions as well as
sharp peaks.
ras_box_detect(
x,
y,
threshold = NULL,
calibration = NULL,
scaled = FALSE,
level0 = NULL,
widths = NULL,
gamma = NULL,
edge = NULL,
floor = 0.2,
max_regions = Inf,
keep_stat = FALSE
)
x |
Numeric vector. Grid positions of the profile ( |
y |
Numeric vector. The scan profile ( |
threshold |
Numeric. Keep regions with |
calibration |
A |
scaled |
Logical. With a |
level0, widths, gamma, edge |
As in |
floor |
Numeric. Windows with |
max_regions |
Integer. Stop after this many regions. Default
|
keep_stat |
Logical. Also return the full |
Windows are scored with ras_box_stat and taken greedily by
score; a window is dropped when it touches an already accepted one
expanded by 10 + max(5, width/2) grid points, which removes side
lobes. Each accepted window becomes one region; its anchor is the highest
point of the profile inside it.
The threshold is a property of the null distribution of the maximum
score along a profile and therefore depends on the profile's length and on
the scan settings. Obtain it with ras_box_calibrate from null
profiles produced by the same scan on permuted phenotypes; the order
statistic it returns controls the family-wise error rate at the requested
level without any distributional assumption.
A list that plot.ras and print.ras
accept as a detection element:
detector"box".
regionsData frame with one row per region, ordered by
decreasing score: tau_L, tau_R (grid indices),
pos_L, pos_R (the same boundaries in x units),
width, T_box, contrast, height,
anchor_idx, anchor_pos, anchor_y. NULL
when nothing reaches the threshold.
tau_hatsNumeric vector. Anchor positions in x
units (the same role as in ras_validate's result).
all.changepoints, all.p.valuesAnchor positions and
their T_box scores, so that the candidate overlay of
plot.ras works.
left.slopes, right.slopesNULL; the box scan
estimates no slopes.
threshold, level0, level,
level_factorThe threshold used, the null level, the median of
y and the resulting level factor.
statThe ras_box_stat table when
keep_stat = TRUE, otherwise NULL.
ras_box_calibrate for the threshold,
ras_box_stat for the statistic, ras_detect
for the changepoint detector, ras which calls this
function when detector = "box".
set.seed(1)
x <- seq(1, 6000, by = 10) # 600 grid points
y <- 0.7 + abs(rnorm(600, sd = 0.3)) # null-like background
y[301:342] <- y[301:342] + 8 # a 42-point plateau
det <- ras_box_detect(x, y, threshold = 2)
det$regions[, c("tau_L", "tau_R", "pos_L", "pos_R", "T_box")]
## a window inside the plateau scores about 0: only its edges are reported
S <- ras_box_stat(y)
max(S$T[S$w == 20 & S$i >= 305 & S$i + 19 <= 338])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.