model (t1,t2) times = do
  let lam = 3.0; nMax = 30; a = 1.0; b = 365.0/200.0

  -- n change points, n+1 intervals
  n <- min nMax <$> poisson lam

  -- even numbered order statistics over the interval [t1,t2]
  s' <- orderedSample (2*n+1) (uniform t1 t2)
  let s = t1:[s'!(2*i-1) | i <- [1..n]]

  -- n+1 rates
  g <- iid (n+1) (gamma a b)

  let intervals = get_intervals g s t2

  times ~> poisson_processes intervals

  return [ "n" %=% n, "s" %=% s, "g" %=% g, "intervals" %=% intervals]
model (t1,t2) times = do
  let lam = 3.0; nMax = 30; a = 1.0; b = 365.0/200.0

  -- n change points, n+1 intervals
  n <- min nMax <$> poisson lam

  -- even numbered order statistics over the interval [t1,t2]
  s' <- orderedSample (2*n+1) (uniform t1 t2)
  let s = t1:[s'!(2*i-1) | i <- [1..n]]

  -- n+1 rates
  g <- iid (n+1) (gamma a b)

  let intervals = get_intervals g s t2

  times ~> poisson_processes intervals

  return [ "n" %=% n, "s" %=% s, "g" %=% g, "intervals" %=% intervals]
model (t1,t2) times = do
  let lam = 3.0; nMax = 30; a = 1.0; b = 365.0/200.0

  -- n change points, n+1 intervals
  n <- min nMax <$> poisson lam

  -- even numbered order statistics over the interval [t1,t2]
  s' <- orderedSample (2*n+1) (uniform t1 t2)
  let s = t1:[s'!(2*i-1) | i <- [1..n]]

  -- n+1 rates
  g <- iid (n+1) (gamma a b)

  let intervals = get_intervals g s t2

  times ~> poisson_processes intervals

  return [ "n" %=% n, "s" %=% s, "g" %=% g, "intervals" %=% intervals]