pub struct NonHomogeneousPoisson {
pub rate_fn: Box<dyn Fn(f64) -> f64>,
pub rate_max: f64,
}Expand description
Non-homogeneous Poisson process with time-varying rate function lambda(t).
Fields§
§rate_fn: Box<dyn Fn(f64) -> f64>Rate function lambda(t).
rate_max: f64Upper bound on the rate function (for thinning algorithm).
Implementations§
Source§impl NonHomogeneousPoisson
impl NonHomogeneousPoisson
pub fn new(rate_fn: Box<dyn Fn(f64) -> f64>, rate_max: f64) -> Self
Sourcepub fn arrivals(&self, rng: &mut Rng, duration: f64) -> Vec<f64>
pub fn arrivals(&self, rng: &mut Rng, duration: f64) -> Vec<f64>
Generate arrival times using the thinning (Lewis-Shedler) algorithm.
- Generate candidate arrival from homogeneous Poisson(rate_max)
- Accept with probability lambda(t) / rate_max
Sourcepub fn counting_path(&self, rng: &mut Rng, duration: f64) -> Vec<(f64, usize)>
pub fn counting_path(&self, rng: &mut Rng, duration: f64) -> Vec<(f64, usize)>
Generate counting process path.
Sourcepub fn expected_count(&self, duration: f64, n_points: usize) -> f64
pub fn expected_count(&self, duration: f64, n_points: usize) -> f64
Expected number of arrivals in [0, t] = integral of lambda(s) ds. Computed via simple trapezoidal rule.
Auto Trait Implementations§
impl Freeze for NonHomogeneousPoisson
impl !RefUnwindSafe for NonHomogeneousPoisson
impl !Send for NonHomogeneousPoisson
impl !Sync for NonHomogeneousPoisson
impl Unpin for NonHomogeneousPoisson
impl UnsafeUnpin for NonHomogeneousPoisson
impl !UnwindSafe for NonHomogeneousPoisson
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more