heap_detect: Detect the rounding grid as a group-matched atom in the...

View source: R/detector.R

heap_detectR Documentation

Detect the rounding grid as a group-matched atom in the spectral basis

Description

Higher-order comb detection: the symmetry defect of the shift-by-K quotient group on the covariance of the power spectrum (a fourth-order statistic) is minimized at the true replica period; the smallest period with low defect (the largest passing cyclic subgroup) is the detected grid.

Usage

heap_detect(y, span = NULL, Mgrid = 512, cand_K = c(8, 16, 24, 32, 48, 64, 96))

Arguments

y

heaped sample.

span

numeric length-2 range for the internal analysis grid (defaults from the data).

Mgrid

internal grid size (default 512).

cand_K

candidate replica periods in spectral bins.

Value

A list with D_hat (recovered grid, or NA), K_hat, detected (logical), and defects (symmetry defect per candidate period).

Examples

set.seed(1)
x <- ifelse(runif(4000) < 0.5, rnorm(4000, -1.2, 0.5), rnorm(4000, 1.2, 0.5))
heap_detect(0.8 * round(x / 0.8), span = c(-12.8, 12.8))$D_hat

adheaping documentation built on Sept. 18, 2026, 1:06 a.m.