>> From: Robert Israel "israel"
On Tue, 21 Jan 2003 "theo.h.s.boafo" wrote:
> Hello,
>
> Can anyone help with generating a compound poisson process in Maple.
>
> Regards
>
> Theo
OK, a compound Poisson process is defined by X(t) = sum_{i=1}^N(t) Y_i
for t >= 0, where N(t) is a Poisson process and {Y_i} a family of iid
random variables independent of N(t). I'll suppose you have a procedure
gY that generates independent (pseudo)-random variates with the
distribution for the Y_i. Poisson random variables can be generated
using random in the stats package.
By "generating" the process, I suppose what you want is to generate a
sample from this process, i.e. given 0 < t1 < t2 < ... < tk you want
the values X(t1), X(t2), ..., X(tk) from one simulation of the process.
Suppose the Poisson process N(t) has rate r, so for s < t, N(t) - N(s)
is Poisson with parameter r*(t-s), and X(t) - X(s) is the sum of
that many independent r.v.'s with the distribution for Y_i. Thus
the following procedure will take as input the rate r, the number k
and a list or array L = [t1, t2, ..., t_k], and return an array
[X(t1), X(t2), ..., X(tk)].
> with(stats,random):
compPoisson:= proc(r::numeric, k::posint, L::{list, array, Array})
local S, i, j, t, p, Res;
Res:= array(1..k);
t:= 0; S:= 0;
for j from 1 to k do
p:= r*(L[j]-t);
S:= S + add(gY(), i= 1.. random[poisson[p]](1));
Res[j]:= S;
t:= L[j];
od;
eval(Res)
end;
For example:
> gY:= random[uniform[0,1]]:
compPoisson(3, 5, [1,3,5,7,9]);
[2.073933989, 3.604972042, 6.430861594, 11.44868212, 17.00177618]
Robert Israel "israel"
Department of Mathematics http://www.math.ubc.ca/~israel
University of British Columbia
Vancouver, BC, Canada V6T 1Z2
|