The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

Package {npwbs}


Type: Package
Title: Nonparametric Multiple Change Point Detection Using Wild Binary Segmentation
Version: 1.0
Author: Gordon J. Ross [aut, cre]
Maintainer: Gordon J. Ross <gordon.ross@ed.ac.uk>
Description: Implements nonparametric multiple change-point detection for univariate sequences using Wild Binary Segmentation, as described in Ross (2026) "Nonparametric Detection of Multiple Location-Scale Change Points via Wild Binary Segmentation" <doi:10.48550/arXiv.2107.01742>. The package provides Mann–Whitney, Mood, Lepage, Cramér–von Mises, modified Baumgartner, standardised Zhang Z_C, and standardised Anderson–Darling rank-based statistics, together with method-specific thresholds for controlling the probability of incorrectly detecting a change point in a homogeneous sequence.
Depends: R (≥ 4.0.0)
Imports: digest, Rcpp
LinkingTo: Rcpp
License: GPL-3
Encoding: UTF-8
NeedsCompilation: yes
Config/npwbs/Development-Status: M=1000 calibrations imported
Packaged: 2026-10-06 04:01:50 UTC; rosss
Repository: CRAN
Date/Publication: 2026-10-06 04:20:02 UTC

Nonparametric detection of multiple change points using Wild Binary Segmentation

Description

Returns the estimated number and locations of the change points in a sequence of univariate observations. For full details of how this procedure works, please see G. J. Ross (2026) - "Nonparametric Detection of Multiple Location-Scale Change Points via Wild Binary Segmentation" at https://arxiv.org/abs/2107.01742

Usage

     detectChanges(y, alpha=0.05, prune=TRUE, M=1000, d=2,
                   displayOutput=FALSE, method="lepage", breakTies=TRUE,
                   combination="sum")
     

Arguments

y

A non-empty finite numeric vector to test for change points. Matrices and other dimensioned inputs are rejected.

alpha

Required Type I error rate. Lepage with combination = "sum" supports 0.05 and 0.01; Lepage with combination = "max" and all other methods support 0.05 only.

prune

Whether to prune potential excess change points via post-processing. Most likely should be left as TRUE.

M

Number of subsequences to sample during WBS and pruning. The default is M = 1000. Only exact tuples represented in the private calibration registry are accepted.

d

Endpoint trimming within each sampled interval. The existing methods, including Anderson–Darling, use d = 2; method = "zhang" uses d = 4 automatically and accepts only an explicit value of 4.

displayOutput

A single non-missing logical. If TRUE, prints information throughout the recursive search for change points.

method

Rank statistic: exactly one of "lepage", "mw", "mood", "cvm", "baumgartner", "zhang", or "anderson_darling".

breakTies

If TRUE, tied inputs receive one random strict ordering before detection; if FALSE, ties are an error.

combination

For method = "lepage", exactly "sum" (the default, Z_{MW}^2 + Z_{Mood}^2) or "max" (\max(Z_{MW}^2,Z_{Mood}^2)). Other methods reject "max".

Details

Verified M = 1000 tables are used by default. Exact frozen M = 10000 tables remain available for all original methods. Unsupported method/combination/M/alpha/d tuples fail rather than reuse a mismatched table. The sampled interval minimum length is fixed at 10. Thresholds for Lepage, Mann–Whitney, Mood, Cramér–von Mises, and modified Baumgartner are provided through segment length n = 10000; longer inputs retain the package's existing behaviour of reusing the n = 10000 threshold with one warning. Zhang and Anderson–Darling support lengths only through n = 3000.

The "zhang" method is the exact mean/standard-deviation-standardised Zhang Z_C detector used in the paper. It retains d = 4, alpha = 0.05, strict threshold exceedance, and registered length-specific thresholds for M = 1000 and M = 10000. Exact moments through n = 1000 are bundled. Sequence lengths n = 1001 through 3000 require one prior call to download_zhang_moments; an invalid installed artifact can be replaced with download_zhang_moments(overwrite = TRUE). Lengths above 3000 are unsupported. Anderson–Darling supports only M = 1000, alpha = 0.05, d = 2, and lengths through 3000.

If prune = TRUE, a post-processing pruning step retests merged neighbouring segments and removes changepoints that are no longer supported.

Value

A vector containing the detected changepoint locations. A returned value k denotes a split between observations k and k + 1, i.e. the change occurs after observation k.

Author(s)

Gordon J. Ross gordon.ross@ed.ac.uk

Examples

     
set.seed(100)
y <- c(rnorm(30,0,1),rnorm(30,3,1), rnorm(30,0,1),rnorm(30,0,3))
detectChanges(y)


Install the extended exact Zhang moment table

Description

Downloads and verifies the fixed exact-moment artifact required by the standardised Zhang detector for sequence lengths above 1000.

Usage

download_zhang_moments(overwrite = FALSE)

Arguments

overwrite

If TRUE, replace an existing installed artifact.

Details

Exact moments through sequence length 1000 are bundled with npwbs. The method = "zhang" detector requires this one-time download for lengths 1001 through 3000. The artifact is installed in the package-specific user data directory returned by tools::R_user_dir("npwbs", "data"). Use overwrite = TRUE to reinstall an invalid or incompatible artifact. Sequence lengths above 3000 are unsupported.

Value

The installed file path, returned invisibly.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.