gseg1_graph: Single-Change Scan with a Supplied Similarity Graph

View source: R/canonical-interface.R

gseg1_graphR Documentation

Single-Change Scan with a Supplied Similarity Graph

Description

Applies the single-change graph scan to a supplied edge matrix.

Usage

gseg1_graph(n, E, statistics = "m", n0 = 0.05 * n,
  n1 = 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 gseg1.

n0

First candidate change-point location.

n1

Last candidate change-point location.

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

The requested statistic must have positive permutation variance at each candidate location. Graphs for which a candidate score is undefined are rejected rather than silently omitted. For a single candidate location, set pval.appr = FALSE and use permutation calibration instead of the continuous-range analytic scan approximation.

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

gseg1, gseg_kmst

Examples

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

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