simplePdmp: A simple PDMP

Description Usage Format Slots See Also Examples

Description

This is a simple example for a piecewise deterministic markov process defined as pdmpModel. It is included to the package for demonstration purposes and is used in some unit tests and function examples.

Usage

1

Format

An object of class pdmpModel.

Slots

parms

There are no parameters for this model.

init

There is one continous variable f with initial value 0 and one discrete variable d initial value 0.

discStates

The discrete variable d has codomain {-1, 0, 1}.

dynfunc

The continous variable f evolves as linear function f(t) = t if d = 1, as f(t) = -t if d = -1 and is constant zero if d = 0. Its dynamic can therefore be described as df/dt = d.

jumpfunc

There are two jumptypes. The first jumps from d to d - 1, the second from d to d + 1. Both reset f to zero.

ratefunc

A vector of length two determining the probability of a jump being of type 1 or 2. If d = -1, it has value (0, 2) forcing the jumptype to be of type 2. The same takes place for d = 1: ratefunc returnes (2, 0) and the jumptype is therefore always of type 1. In case d = 0, ratefunc returnes (1, 1) which leads to a probability of ½ to have a jumptype of type 1 or 2.

times

The simulations will start at time t = 0 and end at t = 10 with step length 0.01.

See Also

toggleSwitch for a more sophisticated example of a pdmpModel and pdmpModel for the formal description of the S4 class.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## the code used to generate this model:

simplePdmp <- pdmpModel(
    descr = "A simple PDMP",
    init = c(f = 0, d = 0),
    discStates = list(d = c(-1, 0, 1)),
    times = c(from = 0, to = 10, by = 0.01),
    dynfunc = function(t, x, parms) c(x["d"], 0),
    ratefunc = function(t, x, parms) c(1+x["d"], 1-x["d"]),
    jumpfunc = function(t, x, parms, jtype){
         c(0, switch(jtype, x["d"]-1, x["d"]+1))
    })

## load it and plot a simulation:
data("simplePdmp")
plot(sim(simplePdmp))

CharlotteJana/pdmpsim documentation built on July 2, 2019, 5:37 a.m.