Learn R Programming

BIPOD (version 0.2.1)

DiffSim: Simulation of a 2-dimensional diffusion process. See the Model argument for options.

Description

Function for simulation of 2-dimensional diffusion processes, using the Euler-maruyama scheme.

Usage

DiffSim(n, start, Delta, driftpar, Sigma, seed, thin=1, Model)

Arguments

n
positive integer: Length of simulation.
start
Numerical vector: Starting point for the simulation.
Delta
Numerical: Time interval between observations.
driftpar
Numerical vector. Parameters of the FitzHugh-Nagumo model.
Sigma
2*2 diffusion matrix.
seed
Integer: Gives the seed for the random number generator. If seed
thin
Integer: Output only every 'thin' simulation.
Model
Character specifying the model. Currently one of 'OU', 'FHN', 'FHN5' and 'CIR'.

Value

  • An (n/thin) by 2 matrix.

Examples

Run this code
FH <- DiffSim(n        = 10000,
              start    = c(1,1),
              Delta    = .001,
              driftpar = c(10,0.6,1.5,0.0),
              Sigma    = diag(c(.5,.3)),
              seed     = 1,
              thin     = 100,
              Model    = "FHN")
matplot(FH,type="l")

Run the code above in your browser using DataLab