simulate_sde_on_branch: Simulate a stochastic differential equation on a branch....

View source: R/simsde.R

simulate_sde_on_branchR Documentation

Simulate a stochastic differential equation on a branch. using the yuima

Description

The function simulates a stochastic differential equation on a branch using the yuima package.

Usage

simulate_sde_on_branch(branch.length, model.yuima, X0, step)

Arguments

branch.length

The length of the branch.

model.yuima

A object that yuima can understand in order to simulate a stochastic differential equation, see Example.

X0

The value at the start of the branch.

step

The simulation step size that is provided to yuima.

Details

The function is a wrapper for calling yuima::simulate().

Value

It returns a matrix whose first row are the time points on the branch and the remaining rows the values of the trait(s).

Author(s)

Krzysztof Bartoszek

References

Bartoszek, K. and Lio', P (2019). Modelling trait dependent speciation with Approximate Bayesian Computation. Acta Physica Polonica B Proceedings Supplement 12(1):25-47.

Brouste A., Fukasawa M., Hino H., Iacus S. M., Kamatani K., Koike Y., Masuda H., Nomura R., Ogihara T., Shimuzu Y., Uchida M., Yoshida N. (2014). The YUIMA Project: A Computational Framework for Simulation and Inference of Stochastic Differential Equations. Journal of Statistical Software, 57(4): 1-51.

Iacus S. M., Mercuri L., Rroji E. (2017). COGARCH(p,q): Simulation and Inference with the yuima Package. Journal of Statistical Software, 80(4): 1-49.

See Also

setModel, setSampling, simulate,

Examples

## simulate a 3D OUBM process on a branch
set.seed(12345)

A <-c("-(x1-1)-2*x3","-(x2+1)+2*x3",0)
S <- matrix( c( 1, 2, 0, 0, 1 , 0, 0, 0, 
2), 3, 3,byrow=TRUE)
yuima.3d <- yuima::setModel(drift = A, diffusion = S,
state.variable=c("x1","x2","x3"),solve.variable=c("x1","x2","x3") )
X0<-c(0,0,0)
step<-0.5 ## for keeping example's running time short <5s as CRAN policy, 
          ## in reality should be much smaller e.g. step<-0.001          
            
time<-1
simulate_sde_on_branch(time,yuima.3d,X0,step)

pcmabc documentation built on May 9, 2022, 9:09 a.m.