Description Usage Format Slots See Also Examples
This is a more complicated example, of a PDMP jumping at borders
pdmpBorder
, where we consider stochastic jumps
as well as fixes jumps at borders.
The model describes the energy of an individual, which can live in
different areas an be in different modi, which lead to a differant
dynamic and between which the individual switches
stochastically and fixed, in case of reaching a border.
The minimum border 0 means that the individual dies and therefor the
process terminates.
The Maximum border forces a jump into another modus.
1 | OÖK
|
An object of class pdmpBorder
.
init
There is onecontinous variable dz which describe the energy of the considered individuum and two discrete variables dz and dz, which describe the modus and area of the individuum.
discStates
One discrete variable dz models the modus it has codomain {1, 2, 3} where 1 means that the individuum is in search modus, 2 means that the individuum is eating ans 3 means that it is in flight modus. The other one dz models the area whith codomain {1, 2, 3}.
dynfunc
The dynamic of the continous variable depends on the velocity at the last jump (borderjump or stochastic jump), and the new discrete state.
jumpfunc
There are four jumptypes, the first two just change the modus, and the other ones just the area.
ratefunc
A vector of length four determining the probability of a jump being of jumptype 1, 2, 3 or 4 (two possible modusjumps and two possible areajumps). The rates of modus change are modelled constant but the rates of changing the area are dependig on the engery value. Here, the rates areachanging are zero iff the modus is unequal to 1, which means that the model assumes, that the individuum just changes the area iff it is in searching modus.
parms
There are are a number of parameters that appear in the dynamics and rates of the process. First of all there are the parameters of decrease and increase of energy in the different states β, a_11, a_21, a_31, a_22, a_12, a_32, a_23, a_13, a_33. Then we have area change rates, which are depending on the engergy and the recent area (=searching individuum) s_12, s_21, s_31, s_13, s_23, s_32 and we have the modus change rates, differing in each area on the recent modus, because of different food resources, competitors and hunters κ112, κ113, κ131, κ132, κ121, κ123, κ212, κ213, κ231, κ232, κ221, κ223, κ312, κ313, κ331, κ332, κ321, κ323. The values of the parameters in this example are artificial and are not based on real data.
times
The simulations will start at time t = 0
and end at the terminating borderjump.
borroot
Every value, which forces the process to jump into a fixed state is stored in the vector borroot. In this example it has dimension one and is the engery maximum of 2.
terroot
Every value, which forces the process to terminate is stored in the vector terroot. In this example it has dimension one and is the energy minimum of 0.
borderfunc
In case the process reaches a borroot (f.e. energy of 9), the borderfunc forces the process to jump into modus seach (=1).
IBBall
for an easier example of a pdmpBorder
.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | OÖK <- pdmpBorder(descr = "3Gebiete, Übergangsraten sind nicht zeitkonstant",
parms = list(β = 1, a_11 = -1, a_21 = -1.5, a_31 = -1.2, a_22 = 2, a_12 = 2.5, a_32 = 3, a_23= -2.5, a_13 = -3, a_33 = -2,
s_12 = 1, s_21 = 2, s_31 = 1, s_13 = 2, s_23 = 3, s_32 = 4,
κ112 = 5, κ113 = 3, κ131 = 3, κ132 = 0, κ121 = 0, κ123 = 1, κ212 = 5, κ213 = 3, κ231 = 3, κ232 = 0, κ221 = 0,
κ223 = 1 , κ312 = 4.5, κ313 = 3, κ331 = 3, κ332 = 0, κ321 = 0, κ323 = 1),
init = c(energy = 6, area = 1, modi = 2),
borroot = function(t, x, parms){return(c(x[1]-9))},
terroot = function(t, x, parms){return(c(x[1]))},
discStates = list(area = (c(1, 2, 3)), modi = c(1, 2, 3)),
dynfunc = function(t, x, parms) {
denergy <- with(as.list(c(x, parms)),switch(area, switch(modi, a_11*energy - β, a_12 - β*energy, a_13*energy - β),
switch(modi, a_21*energy - β, a_22 - β*energy, a_23*energy - β),
switch(modi, a_31*energy - β, a_32 - β*energy, a_33*energy - β)))
return(c(denergy, 0, 0))
},
ratefunc = function(t, x, parms) {
return(with(as.list(c(x, parms)), c(switch(area, switch(modi, c(κ112, κ113, s_12*energy, s_13*energy), c(κ123, κ121, 0, 0), c(κ131, κ132, 0, 0)),
switch(modi, c(κ212, κ213, s_23*energy, s_21*energy), c(κ223, κ221, 0, 0), c(κ231, κ232, 0, 0)),
switch(modi, c(κ312, κ313, s_31*energy, s_32*energy), c(κ323, κ321, 0, 0), c(κ331, κ332, 0, 0))))))
},
jumpfunc = function(t, x, parms, jtype) {
return(with(as.list(c(x,parms)), c(x[1], switch(jtype, switch(x[2], 1, 2, 3), switch(x[2], 1, 2, 3),
switch(x[2], 2 ,3 ,1), switch(x[2], 3, 2, 1)),
switch(jtype, switch(x[3], 2, 3, 1), switch(x[3], 3, 1, 2), switch(x[3], 1, 2, 3), switch(x[3], 1, 2, 3)))))
},
borderfunc = function(t, x, parms){ return(with(as.list(c(x,parms)), c(x[1:2], 1)))
},
times = c(from = 0, to = 100, by = 0.1))
# load it and plot a simulation:
data("OÖK")
plot(sim(OÖK))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.