I want to implement a custom random process thing1 to pass to RandomFunction.

The process I have in mind is conceptually extremely simple: two alternating Poisson processes, with rates λ1 and λ2 2. I'm hoping that there's a comparably simple way to combine two PoissonProcess things to yield the thing I'm after.

Does anyone know how to do this?

1The documentation for RandomFunction mumbles something to the effect that this function takes a "proc" as its first argument, but, as usual, leaves it to the user to guess what this could be.

2Just to be clear, these two processes are "in series", not "in parallel". IOW, only one of the two processes is active at any given time, and it remains active until its next event, at which point the other process becomes active.

  • $\begingroup$ proc is the process $\endgroup$ – chuy Jun 19 '15 at 17:48
  • $\begingroup$ @chuy: I realize that; what I'm getting at is that "proc" is a completely opaque reference; the documentation conveys no information whatsoever about how one would implement such a thing programmatically in the Wolfram language. $\endgroup$ – kjo Jun 19 '15 at 17:59
  • $\begingroup$ TransformedProcess? $\endgroup$ – chuy Jun 19 '15 at 18:15
  • 2
    $\begingroup$ It does seem as if you want something like TransformedProcess[If[(* event *), p1[t], p2[t]], {p1 \[Distributed] PoissonProcess[λ1], p2 \[Distributed] PoissonProcess[λ2]}, t]. But there's still a nice question here: "I have a process that is not built-in; how do I get RandomFunction[] to recognize and simulate it?" $\endgroup$ – J. M.'s torpor Jun 19 '15 at 18:58
  • 1
    $\begingroup$ @kjo I feel you. In my own words, I'd state an example of a question like "how do implement a process such as myOwnPoissonProcess = ... without actually using the built-in process functions?" $\endgroup$ – LLlAMnYP Jun 19 '15 at 19:04

ContinuousMarkovProcess provides a general mechanism for creating a Markovian (i.e. memoryless) random process with continuous index (e.g. time) and countably finite states. A Poisson process has countably infinite states, so you can't quite get there from here. You can specify alot of states to study the process before it hits some maximum.

Your two transition rate process, but counting only up to a maximum of m=100, would be:

m = 100;
\[Lambda][1] = 1/2;
\[Lambda][2] = 2;
q = SparseArray[{
    {i_?EvenQ, j_} /; i == j - 1 -> \[Lambda][1],
    {i_?OddQ, j_} /; i == j - 1 -> \[Lambda][2]}, {m, m}];
q = q - DiagonalMatrix[Total[q, {2}]];
p = ContinuousMarkovProcess[1, q];

And a plot to emphasize the rate change between states:

T = 10;
    RandomFunction[p, {0, T}],
    InterpolationOrder -> 0,
    ColorFunctionScaling -> False,
    ColorFunction -> Function[{t, p}, If[EvenQ[Round[p]], Black, Red]]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.