mjpModel-class: Class mjpModel

Description Usage Arguments Slots References See Also

Description

An S4 class to represent a Markov jump process (MJP).
This class is based on the simecol Package and provides a possibility to simulate Markov jump processes.

Usage

1
2
3
4
mjpModel(obj = NULL, descr = character(0), jumpfunc = function(t, x,
  parms, jtype) x, ratefunc = function(t, x, parms) c(0),
  times = c(from = 0, to = 10, by = 1), init = c(0, 0), parms = c(0),
  out = NULL, solver = "Gdirect", initfunc = NULL)

Arguments

obj

pdmpModel object that is being built.

descr

a string containing a short description of the model. This parameter is optional and only used in plot methods.

jumpfunc

a function(t, x, parms, jtype) that returns the next discrete state the process will jump to. This state depends on parameter jtype. The number of possible jtypes is determined by function ratefunc. The value for jtype will be chosen randomly during simulation, depending ot the rates given in ratefunc.

ratefunc

a function(t, x, parms) that returns a vector with transition rates from the actual state to another state. Only non zero rates are given. The length of the returned vector determines the number of different jumptypes.

times

vector of time steps or vector with three named values "from", "to", "by" specifying the simulation time steps. The from-to-by can be edited with fixParms.

init

initial state of the simulation. This is a named vector giving the names of all variables and their start value.

parms

a list with constant model parameters.

out

NULL or an object of class deSolve. If a simulation is done with method sim, the result will be stored in this parameter.

solver

a function or a character string specifying the numerical algorithm used.At the moment it is ignored since only the "direct" algorithm of Gillespie ("Gdirect") is implemented.

initfunc

this parameter can hold an optional function which has a pdmpModel as only parameter and returnes a (modified) pdmp. This function is called automatically when a new object is created by new or when it is reinitialized by initialize(obj) or before starting a simulation with sim(obj, initialize = TRUE).

Slots

descr

a string containing a short description of the model. This slot is optional and only used in plot methods.

parms

a list with constant model parameters.

times

vector of time steps or vector with three named values "from", "to", "by" specifying the simulation time steps. The from-to-by can be edited with fixParms.

init

initial state of the simulation. This is a named vector giving the names of all variables and their start value.

ratefunc

a function(t, x, parms) that returns a vector with transition rates from the actual state to another state. Only non zero rates are given. The length of the returned vector determines the number of different jumptypes.

jumpfunc

a function(t, x, parms, jtype) that returns the next state the process will jump to. This state depends on parameter jtype. The number of possible jtypes is determined by function ratefunc. The value for jtype will be chosen randomly during simulation, depending ot the rates given in ratefunc.

solver

a function or a character string specifying the numerical algorithm used. At the moment it is ignored since only the direct algorithm of Gillespie ("Gdirect") [Gil77] is implemented.

initfunc

this slot can hold an optional function which has a mjpModel as only parameter and returnes an object of class mjpModel. This function is called automatically when a new object is created by new or when it is reinitialized by initialize(obj) or before starting a simulation with sim(obj, initialize = TRUE).

out

NULL or an object of class deSolve. If a simulation is done with method sim, the result will be stored in this slot.

References

[Gil77] Gillespie, Daniel T. (1977). "Exact Stochastic Simulation of Coupled Chemical Reactions".
The Journal of Physical Chemistry 81 (25): 2340–2361. doi:10.1021/j100540a008.

See Also

See SIRstoch and KendallBD for two examples that have a detailed documentation explaining every slot. Class mjpModel provides a method sim for simulation, mjpModel-accessors{accessor functions} (with names identical to the slot names) to get or set model parameters, time steps, initial values, the vectorfields, the transition rates and the solver. See multSim and multSimCsv to perform multiple simulations for a mjpModel.


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