gseg2_graph: Changed-Interval Scan with a Supplied Similarity Graph

View source: R/canonical-interface.R

gseg2_graphR Documentation

Changed-Interval Scan with a Supplied Similarity Graph

Description

Applies the changed-interval graph scan to a supplied edge matrix.

Usage

gseg2_graph(n, E, statistics = "m", l0 = 0.05 * n,
  l1 = 0.95 * n, pval.appr = TRUE, skew.corr = TRUE,
  pval.perm = FALSE, B = 100)

Arguments

n

Number of observations in the sequence.

E

Two-column edge matrix for the similarity graph.

statistics

Scan statistic or statistics; see gseg2.

l0

Minimum candidate interval length.

l1

Maximum candidate interval length.

pval.appr

Whether to calculate the analytic p-value approximation.

skew.corr

Whether to include its skewness correction.

pval.perm

Whether to calculate a permutation p-value.

B

Number of permutations.

Details

An interval with boundaries (i, j) contains observations i + 1, ..., j. When there are r tied maximizing intervals, tauhat (or tauhat_a/tauhat_u) retains the earlier layout: its first r entries are the left boundaries and its last r entries are the corresponding right boundaries. All returned intervals satisfy the requested length range after the documented endpoint adjustments. The analytic approximation requires a nonzero length range; use permutation calibration for a single permitted interval length.

Value

A list containing scan statistics and requested p-values.

Note

Analytic integrations are checked for convergence and finite probability outputs in [0,1]. An unavailable approximation raises an error rather than returning an invalid probability. Setting pval.appr = FALSE allows justified permutation calibration to be used instead. Scan components must be well-defined on the requested domain; undefined components are not replaced by zero.

See Also

gseg2, gseg_kmst

Examples

set.seed(1)
x <- matrix(rnorm(80), nrow = 20)
E <- gseg_kmst(x)
ans <- gseg2_graph(nrow(x), E, pval.appr = FALSE)

gSeg documentation built on Nov. 14, 2026, 9:08 a.m.