Blyx Nest Blyx language
Registry / Library
library · v0.1.0

CUSUM

Detect persistent shifts in a sequence of standardized observations with a two-sided cumulative sum.

Source repository · Package JSON

Use CUSUM

use vendor::cusum::cusum;

Run the example

nest demo cusum@0.1.0
blyxc native-run cusum-demo/main.blyx
Example source and expected output
use vendor::cusum::cusum;
fn main() {
    let mut state = cs_empty();
    let observations = [2, 2, -3.5];
    let mut i = 0;
    while i < len(observations) {
        state = cs_step(state, at(observations, i), 0.5, 3.0);
        println!(at(state, 2));
        i += 1;
    }
}

Expected output

0
1
-1

Published versions

VersionPackageSource commitSHA-256
0.1.0Download ZIP4e99a0509d00b7667c058123f62b3b6dce774d834a210a059f57b412a74821ba10ba291847