[][src]Function changepoint::generators::discontinuous_jump

pub fn discontinuous_jump<R: Rng>(
    rng: &mut R,
    mu_1: f64,
    sigma_1: f64,
    mu_2: f64,
    sigma_2: f64,
    switch: usize,
    size: usize
) -> Vec<f64>

Generate a series of draws from two gaussian process that switches at switch into the sequence.

Example

use changepoint::generators::discontinuous_jump;
use rand::rngs::StdRng;
use rand::SeedableRng;
let mut rng: StdRng = StdRng::seed_from_u64(0x12345);
// Generate a sequence of 1000 numbers from two gaussains, G(0, 1) and G(10, 5),
// switching from the first to the second at 500 steps.
let seq: Vec<f64> = discontinuous_jump(
    &mut rng,
    0.0,
    1.0,
    10.0,
    5.0,
    500,
    1000
);
assert_eq!(seq.len(), 1000);