msde.sim: Simulation Of A Mixed Stochastic Differential Equation

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

Simulation of M independent trajectories of a mixed stochastic differential equation (SDE) with linear drift

dX_j(t)= (α_j- β_j X_j(t))dt + σ_j a(X_j(t)) dW_j(t) , j=1, ..., M.

There can be up to two random effects (α_j, β_j) in the drift and one random effect σ_j in the diffusion coefficient.

Usage

1
2
3
msde.sim(M, T, N = 100, model, drift.random, diffusion.random, drift.param,
  diffusion.param, nb.mixt = 1, mixt.prop = 1, t0 = 0, X0 = 0.01,
  delta = T/N, op.plot = 0, add.plot = FALSE)

Arguments

M

number of trajectories.

T

horizon of simulation.

N

number of simulation steps, default Tx100.

model

name of the SDE: 'OU' (Ornstein-Uhlenbeck) or 'CIR' (Cox-Ingersoll-Ross).

drift.random

random effects in the drift: 0 if no random effect, 1 if one additive random effect, 2 if one multiplicative random effect or c(1,2) if 2 random effects.

diffusion.random

random effect in the diffusion coefficient: 0 if no random effect, 1 if one multiplicative random effect.

drift.param

vector (not mixture) or matrix (mixture) of values of the fixed effects and/or the parameters of the distribution of the random effects in the drift (see details).

diffusion.param

diffusion parameter if the diffusion coefficient is fixed, vector of parameters c(a,λ) of the distribution of the diffusion random effect otherwise.

nb.mixt

number of mixture components if the drift random effects follow a mixture distribution, default nb.mixt=1.

mixt.prop

vector of mixture proportions if the drift random effects follow a mixture distribution, default mixt.prop=1.

t0

time origin, default 0.

X0

initial value of the process, default X0=0.001.

delta

time step of the simulation (T/N).

op.plot

1 if a plot of the trajectories is required, default 0.

add.plot

1 for add trajectories to an existing plot

Details

Simulation of N discrete observations on time interval [t0,T] of M independent trajectories of the SDE

dX_j(t)= (α_j- β_j X_j(t))dt + σ_j \ a(X_j(t)) dW_j(t),

j=1,…,M, where the (W_j(t)) are independant Wiener processes.

Specification of α,β,σ

The diffusion includes either a fixed effect or a random effect:

  1. if diffusion.random = 0: σ_j \equiv σ is fixed, and diffusion.param = σ. In this case, the drift includes no, one or two random effects:

    1. if drift.random = 0: α_j \equiv α and β_j \equiv β are fixed, and drift.param=c(α,β)

    2. if drift.random = 1: α_j is random with distribution N(μ_{α},ω^2_{α}) whereas β_j \equiv β is fixed, and drift.param=c(μ_{α},ω^2_{α},β)

    3. if drift.random = 2: α_j \equiv α is fixed and β_j is random with distribution N(μ_{β},ω^2_{β}), and drift.param=c(α, μ_{β},ω^2_{β})

    4. if drift.random = c(1,2): α_j and β_j are random with distributions N(μ_{α},ω^2_{α}) and N(μ_{β},ω^2_{β}) respectively, and drift.param = c(μ_{α},ω^2_{α},μ_{β},ω^2_{β})

  2. if diffusion.random = 1: σ_j is random such that 1/σ_j^2 \sim Γ, and drift.param=c(a,λ). In this case, the drift includes at least one random effect:

    1. if drift.random = 1: α_j is random with distribution N(μ_{α}, σ_j^2 ω^2_{α}) whereas β_j \equiv β is fixed, and drift.param=c(μ_{α},ω^2_{α},β)

    2. if drift.random = 2: α_j \equiv α is fixed and β_j is random with distribution N(μ_{β},σ_j^2 ω^2_{β}), and drift.param=c(α, μ_{β},ω^2_{β})

    3. if drift.random = c(1,2): α_j and β_j are random with distributions N(μ_{α},σ_j^2 ω^2_{α}) and N(μ_{β}, σ_j^2 ω^2_{β}) respectively, and drift.param = c(μ_{α},ω^2_{α},μ_{β},ω^2_{β})

    If the random effects in the drift follow a mixture distribution (nb.mixt=K, K>1), drift.param is a matrix instead of a vector. Each line of the matrix contains, as above, the parameter values for each mixture component.

Value

X

matrix (M x (N+1)) of the M trajectories.

times

vector of the N+1 simulated observation times from t0 to T.

phi

vector (or matrix) of the M simulated random effects of the drift.

psi

vector of the M simulated values of σ_j.

Author(s)

Maud Delattre and Charlotte Dion

References

This function mixedsde.sim is based on the package sde, function sde.sim. See

Simulation and Inference for stochastic differential equation, S.Iacus, Springer Series in Statistics 2008 Chapter 2

See Also

https://CRAN.R-project.org/package=sde

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
 
 # Example 1 : one random effect in the drift and one fixed effect in the diffusion coefficient
 sim <- msde.sim(M = 30, T = 1, N = 1000, model = 'OU', drift.random = 2,
                diffusion.random = 0, drift.param = c(0,1,sqrt(0.4/4)), diffusion.param = 0.5)
                
 # Example 2 : two random effects in the drift and one random effect in the diffusion coefficient

 sim <- msde.sim(M = 30, T = 1, N = 1000, model = 'OU', drift.random = c(1,2),
                diffusion.random = 1, drift.param = c(1,0.5,0.5,0.5), diffusion.param = c(8,1/2))
          
 # Example 3 : one fixed effect and one mixture random effect in the drift, and one fixed effect in
 # the diffusion coefficient
 
 sim <- msde.sim(M = 30, T = 1, N = 1000, model = 'OU', 
                 drift.random = 1, drift.param = 
                 matrix(c(0.5,1.8,0.25,0.25,1,1),nrow=2,byrow=FALSE),
                 diffusion.random = 0, diffusion.param = 0.1, 
                 nb.mixt = 2, mixt.prop = c(0.5,0.5))
                 
# Example 4 : CIR with one random effect in the drift and one random effect in the diffusion 
# coefficient

sim <- msde.sim(M = 30, T = 1, N = 1000, model = 'CIR', drift.random = 2,
                diffusion.random = 1, drift.param = c(4,1,0.1), diffusion.param = c(8,0.5),
                X0 = 1)
 

MsdeParEst documentation built on May 2, 2019, 3:01 a.m.