Class Rap_sample
A RAP (H0, H1) generalises a MAP by dropping the sign constraints on the
two matrices, so the CTMC walk of Map_sample does not apply. Sampling
is instead performed on the conditional (vector) representation: with a row
vector v satisfying v*e = 1, the next inter-event time has survival
function S_v(x) = v*expm(H0*x)*e and density
f_v(x) = -v*expm(H0*x)*H0*e = v*expm(H0*x)*H1*e, and after an event at
x the vector is updated to
v <- v*expm(H0*x)*H1 / (v*expm(H0*x)*H1*e)
The generated sequence is therefore correlated: it reproduces the
autocorrelation of the process, not merely its ME marginal. Starting v from
the embedded stationary vector Map_pie makes each inter-event time
marginally stationary. A MAP is the special case in which H0 has non-negative
off-diagonal entries and H1 is non-negative; the algorithm is exact there too,
although Map_sample.MapSampler is cheaper for that case.
Because v changes at every draw, no inversion table can be cached across
draws. What is cached is the sequence expm(H0*t_i) on a fixed time
grid (built with a single matrix exponential and repeated matrix products),
together with the column vectors expm(H0*t_i)*e. A draw then costs
only vector products: the conditional survival at a grid point is a dot
product against the cached column, so no matrix exponential is evaluated per
draw.
- Since:
- LINE 3.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classStateful RAP sampler that carries the conditional phase vector across draws, so successive inter-event times are correlated as in the process. -
Method Summary
Modifier and TypeMethodDescriptionstatic double[]rap_sample(MatrixCell RAP, long n, Random random) Generates a correlated sample sequence from a Rational Arrival Process.static double[]rap_sample(Matrix H0, Matrix H1, long n, Random random) Generates a correlated sample sequence from a Rational Arrival Process given its two matrices.
-
Method Details
-
rap_sample
Generates a correlated sample sequence from a Rational Arrival Process.The returned inter-event times are not i.i.d.: they carry the autocorrelation of the process, obtained by propagating the conditional phase vector across events. A MAP is the special case in which H0 has non-negative off-diagonal entries and H1 is non-negative.
- Parameters:
RAP- the process as a MatrixCell {H0, H1}n- the number of samples to generaterandom- the random number generator to use- Returns:
- an array of n correlated inter-event times
-
rap_sample
Generates a correlated sample sequence from a Rational Arrival Process given its two matrices.- Parameters:
H0- the hidden-transition matrixH1- the visible-transition matrixn- the number of samples to generaterandom- the random number generator to use- Returns:
- an array of n correlated inter-event times
-