# How to plot two random functions (Together)

I have ploted the next following jump diffusion model using Mathematica 10

$$X_t=X_0 e^{\sigma W_t+(v-\sigma /2)t}(1+J_1)\cdots(1+J_{N_t})$$ namely, a Geometric Brownian motion with compound Poisson jumps.

For this I have used the next code:

Pp =
TransformedProcess[g[t] E^(j[t]),
{g \[Distributed] GeometricBrownianMotionProcess[v, σ, 1],
j \[Distributed] CompoundPoissonProcess[λ, NormalDistribution[0, 0.85]]},
t];

data = RandomFunction[Pp /. {v -> 0.5, σ -> 0.5, λ -> 2.1, μ -> 0.92, δ -> 0.425,
r -> 1}, {0, 3, 0.001}, 3];

ListLinePlot[data, PlotRange -> All]


The thing is that, together with the resultant graphic, I would like to plot the generating Poisson Process. Any idea? Thanks!

• What does "plot the process" mean? – David G. Stork Jun 22 '15 at 16:04
• Plot the Poisson Stochastic Process, the function. – Edin_91 Jun 22 '15 at 16:31

I'm not quite following your question, but are you possibly looking for this?

Pp = TransformedProcess[{g[t] E^(j[t]), j[t]},
{g \[Distributed] GeometricBrownianMotionProcess[v, \[Sigma], 1],
j \[Distributed] CompoundPoissonProcess[\[Lambda], NormalDistribution[0, 0.85]]}, t];

data = RandomFunction[Pp /.
{v -> 0.5, \[Sigma] -> 0.5, \[Lambda] -> 2.1,
\[Mu] -> 0.92, \[Delta] -> 0.425, r -> 1},
{0, 3, 0.001}];

ListLinePlot[data, PlotRange -> All] EDIT:

"Improved" answer. This is really a hack: it splits the TemporalData object with two sets of data into two time-value arrays, and in addition to passing both arrays as-is to ListLinePlot, counts amount of value transitions before every point on the second of these time-value arrays. Not very pretty, but works.

Pp = TransformedProcess[{g[t] E^(j[t]), j[t]},
{g \[Distributed] GeometricBrownianMotionProcess[v, \[Sigma], 1],
j \[Distributed] CompoundPoissonProcess[\[Lambda], NormalDistribution[0, 0.85]]}, t];

data = RandomFunction[Pp /.
{v -> 0.5, \[Sigma] -> 0.5, \[Lambda] -> 2.1,
\[Mu] -> 0.92, \[Delta] -> 0.425, r -> 1},
{0, 3, 0.001}];

processeddata = {#1, #2, {#2[], #1} & @@@
FoldList[{#1[] + Boole[#1[[2, 2]] != #2[]], #2} &, {0,
First@#2}, Rest@#2]} & @@
Table[{#1, #2[[n]]} & @@@ First@data["Paths"], {n, 2}];

ListLinePlot[processeddata, PlotRange -> All] • Hi, @kirma. It is almost this. I want to plot a function that for each jump increments one unit when the jumps in the grafic ocurr. reference.wolfram.com/language/ref/PoissonProcess.html – Edin_91 Jun 22 '15 at 18:44
• @Edin_91 Improved the answer; sadly I don't know how to do this natively on the side of random processes. – kirma Jun 22 '15 at 19:20
• Yes, that it is exactly what I need. Could you provide me the code to plot the Poisson Process and Compund Process together with the Geometric Brownian Motion? (I mean to combine your both answer) – Edin_91 Jun 22 '15 at 19:26
• If you give me points in my question will be able to point you up :) – Edin_91 Jun 22 '15 at 19:27
• If you need any explanation don´t hesitate to ask me – Edin_91 Jun 22 '15 at 19:27