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: 0.5.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, and standardised Zhang Z_C 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
Packaged: 2026-08-01 01:57:53 UTC; rosss
Repository: CRAN
Date/Publication: 2026-08-04 08:50:07 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=10000, d=2,
                   displayOutput=FALSE, method="lepage", breakTies=TRUE)
     

Arguments

y

The sequence to test for change points

alpha

Required Type I error rate. Lepage supports 0.05 and 0.01; the other methods support 0.05.

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 built-in thresholds are calibrated for M = 10000, so other values are not supported by the packaged calibration.

d

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

displayOutput

If TRUE then will print some information while searching for change points

method

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

breakTies

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

Details

The built-in thresholds are provided for Lepage, Mann–Whitney, Mood, Cramér–von Mises, and modified Baumgartner statistics using d = 2 and M = 10000. Lepage at alpha = 0.05 uses the final registered book-chapter calibration, while Lepage at alpha = 0.01 retains the established package calibration. Mann–Whitney, Mood, Cramér–von Mises, and modified Baumgartner support alpha = 0.05 only. The sampled interval minimum length is fixed at 10. Thresholds are provided through segment length n = 10000; longer inputs reuse the n = 10000 threshold with one warning. Modified-Baumgartner values above n = 3000 use the fitted extension accepted for the package rather than direct Monte-Carlo calibration.

The "zhang" method is the exact mean/standard-deviation-standardised Zhang Z_C detector used in the paper. It uses d = 4, M = 10000, alpha = 0.05, strict threshold exceedance, and registered length-specific thresholds. 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.

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.