simplePoly: Model 'simplePoly'

Description Usage Format Examples

Description

This model is equivalent to model simplePdmp, which is given as example in package pdmpsim. Model simplePoly is defined as a polyPdmpModel object. Apart from that, it models exactly the same mechanism as simplePdmp. 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 polyPdmpModel of length 1.

Examples

 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
library("spray")
#------ code to generate this model -----

simplePoly <- new("polyPdmpModel",
   descr = "polyModel with two jumptypes",
   init = c(f = 0, d = 0),
   times = c(from = 0, to = 10, by = 0.01),
   discStates = list(d = -1:1),
   dynpolys = quote(list(
     list(overall = lone(2,2)) # variant 2
   )),
   ratepolys = quote(list(
     list(0, 1, 2), # first jumptype
     list(2, 1, 0)  # second jumptype
   )),
   jumpfunc = function(t, x, parms, jtype){
     c(0, switch(jtype, x["d"]-1, x["d"]+1))
   }
 )

#------- comparison of the models --------------

data("simplePoly")
data("simplePdmp")
identical(sim(simplePoly, outSlot = FALSE, seed = 5),
          sim(simplePdmp, outSlot = FALSE, seed = 5))

CharlotteJana/pdmppoly documentation built on Sept. 4, 2019, 4:40 p.m.