Anda di halaman 1dari 49

From the sde package to the Yuima Project

S.M. Iacus (University of Milan)

Meielisalp, R/RMetrics Workshop, June 28th - July 2nd, 2009

1 / 41
Overview of the sde
package
Diffusions

Exact likelihood
Pseudo-likelihood
Simulated likelihood
method
Hermite expansion

The Yuima Project Overview of the sde package

2 / 41
Why SDEs?

Overview of the sde


package
Continuous time models are not just a matter of taste, particularly in economics
Diffusions and finance.
Exact likelihood
Pseudo-likelihood
Simulated likelihood
The sde package, is focused on simulation and inference for continuous time
method
models solutions to SDEs observed at discrete times.
Hermite expansion

The Yuima Project


Why continuous time matters if observations are always discrete?

3 / 41
Why SDEs?

Overview of the sde


package
Continuous time models are not just a matter of taste, particularly in economics
Diffusions and finance.
Exact likelihood
Pseudo-likelihood
Simulated likelihood
The sde package, is focused on simulation and inference for continuous time
method
models solutions to SDEs observed at discrete times.
Hermite expansion

The Yuima Project


Why continuous time matters if observations are always discrete?

An example: according to McCrorie & Chambers (2006, J. of Econ.) and


others, spurious Granger causality [tested with VAR models] is only a
consequence of the intervals in which economic data are generated being finer
than the econometricians sampling interval.

Conclusions: assume a continuous time model (SDE). Discretize that, build a


VAR from the discretized SDE and the spurious Granger causality vanishes!

3 / 41
Why SDEs?

Overview of the sde


package
Continuous time models are not just a matter of taste, particularly in economics
Diffusions and finance.
Exact likelihood
Pseudo-likelihood
Simulated likelihood
The sde package, is focused on simulation and inference for continuous time
method
models solutions to SDEs observed at discrete times.
Hermite expansion

The Yuima Project


Why continuous time matters if observations are always discrete?

An example: according to McCrorie & Chambers (2006, J. of Econ.) and


others, spurious Granger causality [tested with VAR models] is only a
consequence of the intervals in which economic data are generated being finer
than the econometricians sampling interval.

Conclusions: assume a continuous time model (SDE). Discretize that, build a


VAR from the discretized SDE and the spurious Granger causality vanishes!

Rephrasing: why using a binomial distribution if your underlying model is a


Gaussian? 3 / 41
A few examples of SDEs

Overview of the sde


package  gBm : dXt = Xt dt + Xt dWt
Diffusions

Exact likelihood
 CIR : dXt = (1 + 2 Xt )dt + 3 Xt dWt
Pseudo-likelihood
Simulated likelihood
method  CKLS : dXt = (1 + 2 Xt )dt + 3 Xt4 dWt
Hermite expansion

The Yuima Project  nonlinear mean reversion (At-Sahalia)


dXt = (1 Xt1 + 0 + 1 Xt + 2 Xt2 )dt + 1 Xt dWt

 double Well potential (bimodal behaviour, highly nonlinear)


dXt = (Xt Xt3 )dt + dWt

 Jacobi diffusion (political polarization):


1
 p
dXt = Xt 2 dt + Xt (1 Xt )dWt

 radial Ornstein-Uhlenbeck : dXt = (Xt1 Xt )dt + dWt


 
2
 hyperbolic diffusion : dXt = 2 2 Xt 2
dt + dWt
+(Xt )
4 / 41
Diffusion processes solutions to SDEs

Overview of the sde


package
From the statistical point of view, we are interested in the parametric family of
Diffusions diffusion process solutions of the SDE
Exact likelihood
Pseudo-likelihood
Simulated likelihood
dXt = b(Xt , )dt + (Xt , )dWt , X 0 = x0 , t [0, T ]
method
Hermite expansion
= (, ) = , where Rp and Rq .
The Yuima Project

Observations always come in discrete time form at some times ti = in ,


i = 0, 1, 2, ..., n, where n is the length of the steps. We denote the
observations by Xn := {Xi = Xti }0in .

5 / 41
Diffusion processes solutions to SDEs

Overview of the sde


package
From the statistical point of view, we are interested in the parametric family of
Diffusions diffusion process solutions of the SDE
Exact likelihood
Pseudo-likelihood
Simulated likelihood
dXt = b(Xt , )dt + (Xt , )dWt , X 0 = x0 , t [0, T ]
method
Hermite expansion
= (, ) = , where Rp and Rq .
The Yuima Project

Observations always come in discrete time form at some times ti = in ,


i = 0, 1, 2, ..., n, where n is the length of the steps. We denote the
observations by Xn := {Xi = Xti }0in .
Different sampling schemes, different statistical procedures:

1. Large sample asymptotics: fixed, T = n as n

2. High frequency: T = nn fixed, n 0 as n

3. Rapidly increasing design: T = n , n 0 as n under


the additional condition nkn 0 for k > 1
5 / 41
Likelihood in discrete time

Overview of the sde


package
By Markov property of diffusion processes, the likelihood has this form
Diffusions
n
Exact likelihood
Y
Pseudo-likelihood Ln () = p (, Xi |Xi1 )p (X0 )
Simulated likelihood
i=1
method
Hermite expansion
Problem: the transition density p (, Xi |Xi1 ) is often not available! Only
The Yuima Project
for OU, CIR and gBm

6 / 41
Likelihood in discrete time

Overview of the sde


package
By Markov property of diffusion processes, the likelihood has this form
Diffusions
n
Exact likelihood
Y
Pseudo-likelihood Ln () = p (, Xi |Xi1 )p (X0 )
Simulated likelihood
i=1
method
Hermite expansion
Problem: the transition density p (, Xi |Xi1 ) is often not available! Only
The Yuima Project
for OU, CIR and gBm

Solutions:

 discretization of the SDE (Euler, Milstein, Ozaki, etc)

 simulation method

 hermite polynomial expansion

 partial differential equations

 other approximations of the transition density


6 / 41
Local Gaussian Approximation. Euler Scheme.

By Euler discretization of the SDE : dXt = b(Xt , )dt + (Xt , )dWt

Xt+t Xt = b(Xt , )t + (Xt , )(Wt+t Wt ),

we get an approximate transition density which is Gaussian. This is widely seen in applied
contexts. But is this approximation good or not? In general no!

For example, for gBm, the true transition density is a log-normal and the Euler schemes provides
only a Gaussian approximation!

It is possible to prove that estimators are not even consistent for non negligible .

7 / 41
Euler, and bias

Overview of the sde


package
Consider OU model
Diffusions

Exact likelihood dXt = (1 2 Xt )dt + 3 dWt , X 0 = x0


Pseudo-likelihood
Simulated likelihood
method Both true and Euler approximation are Gaussian respectively with mean and
Hermite expansion
variance
The Yuima Project

32 e22

1
  1
m(, x) = xe2 + 1 e2 , v(, x) = ,
2 22
and (Euler)

mEuler (, x) = x(1 2 ) + 1 , v Euler (, x) = 32 ,

Only under high-frequency setting, i.e. 0, the approximation is


acceptable.

8 / 41
Simulated likelihood method

Overview of the sde


package Let p (, y|x) be the true transition density of Xt+ at point y given
Diffusions Xt = x. Consider a << , for example = /N for N large enough,
Exact likelihood
and then use the Chapman-Kolmogorov equation as follows:
Pseudo-likelihood
Simulated likelihood Z
method
Hermite expansion p (, y|x) = p (, y|z)p ( , z|x)dz = Ez {p (, y|z)| } ,
The Yuima Project

It means that p (, y|x) is seen as the expected value over all possible
transitions of the process from time t + ( ) to t + , taking into account
that the process was in x at time t.

So we need simulations!

9 / 41
What about N ? We need many simulations

Example: approximation for the CIR model

25
20
conditional density

exact
N=2
15

N=5
N=10
10
5
0

0.00 0.05 0.10 0.15 0.20

10 / 41
What about N ? We need many simulations

Example: approximation for the CIR model

25
20
conditional density

exact
N=2
15

N=5
N=10
10
5
0

0.00 0.05 0.10 0.15 0.20

We need many simulations (N ) for each time points (Xti , Xti + ). But not all simulation
schemes are stable for all models
10 / 41
Numerical instability. Up|Down = 0.1|0.25

At-Sahalia process dXt = (5 11Xt + 6Xt2 Xt3 )dt + dWt , X0 = 5

11 / 41
Numerical instability. Up|Down = 0.1|0.25

At-Sahalia process dXt = (5 11Xt + 6Xt2 Xt3 )dt + dWt , X0 = 5

11 / 41
At-Sahalias approximation

Overview of the sde


package
True likelihood (continuous line), Euler approximation (dashed line), At-Sahalia
Diffusions approximation (dotted line). Where is the dotted line? Coincides with the
Exact likelihood
continuous line! Model dXt = Xt dt + dWt
Pseudo-likelihood
Simulated likelihood
method
Hermite expansion

The Yuima Project 27.5


loglikelihood

27.0
26.5
26.0

3 2 1 0 1 2 3

no need to have small, but (was) very difficult to implement! 12 / 41


The sde package

The sde package implements At-Sahalia method. It also implements the following methods

 local Gaussian (dcEuler), Elerian (dcElerian), Ozaki (dcOzaki) and Shoji-Ozaki


(dcShoji) approximations

 Simulated Likelihood Method (dcSim), Kesslers (dcKessler) and At-Sahalia


(HPloglik) approximations

all of them can be passed to the mle function in R or used to build appropriate likelihood
functions.

13 / 41
The sde package

The sde package also implements many simulation schemes, including: Euler, Milstein,
Milstein2, Elerian, Ozaki, Ozaki-Shoji, Exact Simulation Scheme, Simulation from conditional
distribution, Predictor-Correction scheme, etc via the unique sde.sim function

sde.sim(t0 = 0, T = 1, X0 = 1, N = 100, delta, drift, sigma,


drift.x, sigma.x, drift.xx, sigma.xx, drift.t,
method = c("euler", "milstein", "KPS", "milstein2",
"cdist","ozaki","shoji","EA"),
alpha = 0.5, eta = 0.5, pred.corr = T, rcdist = NULL,
theta = NULL, model = c("CIR", "VAS", "OU", "BS"),
k1, k2, phi, max.psi = 1000, rh, A, M=1)

14 / 41
The sde.sim function

For the OU process, dXt = 5Xt dt + 3.5dWt , it is as easy as

> d <- expression(-5 * x)


> s <- expression(3.5)
> sde.sim(X0=10,drift=d, sigma=s) -> X
> str(X)
Time-Series [1:101] from 0 to 1: 10 9.32 8.79 8.89 8.48 ...

15 / 41
The sde.sim function


For the CIR model dXt = (6 3Xt )dt + 2 Xt dWt

d <- expression( 6-3*x )


s <- expression( 2*sqrt(x) )
sde.sim(X0=10,drift=d, sigma=s) -> X

or, via model name

sde.sim(X0=10, theta=c(6, 3, 2), model="CIR") -> X

or, via exact conditional distribution rcCIR (also implemented in sde)

sde.sim(X0=10, theta=c(6, 3, 2), rcdist=rcCIR, method="cdist") -> X

16 / 41
Also in the sde package

The package also implements other estimation procedures

 estimating functions (linear, quadratic, martingale)

 GMM (but be careful, not really what you want to use with SDE!)

 approximate AIC statistics for model selection (sdeAIC)

 -divergence test statistics for parametric hypotheses testing (not in the book)

 change point (cpoint) analysis; both parametric and nonparametric

 non parametric estimation of drift (ksdrift) and diffusion (ksdiff) coefficients

 Markov Operator distance (MOdist) for clustering of SDE paths

The companion book: Simulation and Inference for Stochastic Differential Equations, with R
Examples, Springer (2008).

17 / 41
Limits of the sde package

Overview of the sde


package  only deals with 1-dimensional SDEs
Diffusions

Exact likelihood
 SDE only driven by a single Wiener noise
Pseudo-likelihood
Simulated likelihood
method  no jumps
Hermite expansion

The Yuima Project  essentially only Markovian SDEs (via specification of cdist)

 (last but not least) written by a single person!

18 / 41
Overview of the sde
package

The Yuima Project


Multidimensional SDE:
theoretical model
SDE
The general Levy

The Yuima Project

19 / 41
The Yuima Project Team

Overview of the sde


package
M. Fukasawa (Osaka Univ.)
The Yuima Project
H. Hino (Waseda Univ., Tokyo)
Multidimensional SDE: S.M. Iacus (Milan Univ.)
theoretical model
SDE
The general Levy
K. Kengo (Tokyo Univ.)
H. Masuda (Kyushu Univ.)
Y. Shimitzu (Osaka Univ.)
M. Uchida (Osaka Univ.)
N. Yoshida (Tokyo Univ.)
. . . more to come

The yuima package1 is written by people working in mathematical statistics


and finance, who actively publish results in the field, have some knowledge of
R, and have the feeling on whats next in the field.

Aims at filling the gap between theory and practice!


1
The Yuima project is funded by the Japan Science Technology (JST) Basic Research Programs PRESTO, Grants-in-Aid for Scientific
Research No. 19340021, and the Global COE program The research and training center for new development in mathematics of Graduate
School of Mathematical Sciences, University of Tokyo.

20 / 41
The yuima package goal: fill the gap between theory and practice

Overview of the sde


package
The Yuima Project aims at implementing, via the yuima package, a very
The Yuima Project
abstract framework to describe probabilistic and statistical properties of
Multidimensional SDE: stochastic processes in a way which is the closest as possible to their
theoretical model
SDE
The general Levy
mathematical counterparts but also computationally efficient.

 it is an S4 package, where the basic class extends to SDEs with jumps,


but soon to semimartingales (non Markov), Markov switching regime
processes, fBm driven SDEs, etc.

 separates the data description from the inference tools and simulation
schemes

 the design allows for multidimensional, multi-noise processes


specification

 it includes a variety of tools useful in finance, like asymptotic expansion


processes via Malliavin calculus
of functionals of Levy

21 / 41
The yuima package

Overview of the sde


package  we plan to add soon I/O functions to connect to other R packages
The Yuima Project (including those presented at this workshop!) to avoid replications
Multidimensional SDE:
theoretical model
SDE
The general Levy
 the package is designed to have three layers

 layer 1: is the very basic, low-level framework, (occasional) user


unfriendly. You have to specify the correct model and arguments;
 layer 2: macros and short-cuts for the common user (e.g. please,
process with NIG structure)
fit this Levy
 layer 3: point & click interface

Layers 1 and 2 almost completed. Layer 3...

Lets see how it is supposed to work.

22 / 41
The yuima package

Overview of the sde


package
The basic object is an S4 object of class yuima, which contains the slots
The Yuima Project
Multidimensional SDE:
theoretical model
yuima object
SDE
The general Levy

of class yuima.model: an abstract


@ model descritiption of the model (e.g. SDE)

of class yuima.data is a wrapper for


@ data any data type zoo, xts, tseries,
etc.

of class yuima.sampling: infor-


mation about the sampling scheme
@ sampling
(random, Poisson, deterministic, tick
times)

of class yuima.characteristic:
@ characteristic
the characteristic triplet and more

23 / 41
The yuima package

Overview of the sde


package
Each slots of the yuima object can be a list of yuima.* objects or an
The Yuima Project
empty slot.
Multidimensional SDE:
theoretical model
SDE
The general Levy
For example, one can have a yuima object foo with only the slot data, and
other two yuima objects bar (and SDE without jumps) and baz (and SDE
with jumps) with only the description of two different models.

Then, we want to fit the data foo to each model bar and baz separately, for
comparisons, model selection, etc.

The yuima package offers several constructors to build each object and merge
them together.

The idea: first describe the model, then manipulate it.

24 / 41
The yuima.model constructor

Overview of the sde 1


package To describe the following SDE: dXt = 3Xt dt + 1+X 2 dWt , we use
t
The Yuima Project
Multidimensional SDE:
theoretical model
> mod1 <- set.model(drift = "-3*x", diffusion = "1/(1+x^2)")
SDE
The general Levy
Solution variable (lhs) not specified. Trying to use state variables
> str(mod1)
Formal class yuima.model [package "yuima"] with 9 slots
..@ drift : expression((-3 * x))
..@ diffusion :List of 1
.. ..$ : expression(1/(1 + x^2))
..@ parameter :Formal class model.parameter [package "yuima"] with 4 sl
.. .. ..@ all : chr(0)
.. .. ..@ common : chr(0)
.. .. ..@ diffusion: chr(0)
.. .. ..@ drift : chr(0)
..@ state.variable : chr "x"
..@ time.variable : chr "t"
..@ noise.number : num 1
..@ equation.number: int 1
..@ dimension : int [1:4] 0 0 0 0
..@ solve.variable : chr "x"

25 / 41
Automatic parameter extraction

Overview of the sde 1


package To describe the following SDE: dXt = Xt dt + 1+X dWt , we use
t
The Yuima Project
Multidimensional SDE:
theoretical model
> mod2 <- set.model(drift = "-theta*x", diffusion = "1/(1+x^gamma)")
SDE
The general Levy
Solution variable (lhs) not specified. Trying to use state variables
> str(mod2)
Formal class yuima.model [package "yuima"] with 9 slots
..@ drift : expression((-theta * x))
..@ diffusion :List of 1
.. ..$ : expression(1/(1 + x^gamma))
..@ parameter :Formal class model.parameter [package "yuima"] with 4 sl
.. .. ..@ all : chr [1:2] "theta" "gamma"
.. .. ..@ common : chr(0)
.. .. ..@ diffusion: chr "gamma"
.. .. ..@ drift : chr "theta"
..@ state.variable : chr "x"
..@ time.variable : chr "t"
..@ noise.number : num 1
..@ equation.number: int 1
..@ dimension : int [1:4] 2 0 1 1
..@ solve.variable : chr "x"

26 / 41
Multidimensional SDE: theoretical model


1 2
1 2/3 1,

dX t = X t
X t
dW t
dXt2 = g(t)dXt3 , , (X01 , X02 , X03 ) = (1.0, 0.1, 1.0)
p
3 3 1
dXt = Xt (dt + (dWt + 1 2 dWt2 ))

(1)
with = 0.1, = 0.2, = 0.7 and g(t) = 0.4 + (0.1 + 0.2t)e2t , for example, where
W = (W 1 , W 2 ) is a 2-dim standard Brownian motion. Then, it corresponds to
Z t Z t
Xt = X0 + b(s, Xs )ds + c(s, Xs )dWs (2)
0 0

with
x2 |x1 |2/3
p0

0
b(s, x) = g(s)x3 , c(s, x) = g(s)x3 g(s) 1 2 x3
3
p
x x 3 1 2 x3
for x = (x1 , x2 , x3 ).
27 / 41
Multidimensional SDE: R code

> mu <- 0.1; sig <- 0.2; rho <- -0.7


> g <- function(t) 0.4 + (0.1 + 0.2*t)* exp(-2*t)
> diff.coef.1 <- function(t, x1, x2, x3) {
+ ret <- 0
+ if(x1 > 0 && x2 > 0) ret <- x2*exp(log(x1)*2/3)
+ ret
+ }
> diff.coef.2 <- function(t, x1, x2, x3=0) {
+ ret <- 0
+ if(x3 > 0) ret <- rho*sig*x3
+ ret
+ }
> diff.coef.3 <- function(t, x1, x2, x3) {
+ ret <- 0
+ if(x3 > 0) ret <- sqrt(1-rho^2)*sig*x3
+ ret
+ }
> diff.coef.matrix <- matrix(c("diff.coef.1(t,x1,x2,x3)", "diff.coef.2(t,x1,x2,x3) * g(t)",
+ "diff.coef.2(t,x1,x2,x3)", "0", "diff.coef.3(t,x1,x2,x3)*g(t)", "diff.coef.3(t,x1,x2,x3)"),
+ 3, 2)
> sabr.mod <- set.model(drift = c("0", "mu*g(t)*x3", "mu*x3"), diffusion = diff.coef.matrix,
+ state.variable = c("x1", "x2", "x3"), solve.variable = c("x1", "x2", "x3"))

28 / 41
Multidimensional SDE

> str(sabr.mod)
Formal class yuima.model [package "yuima"] with 9 slots
..@ drift : expression((0), (mu * g(t) * x3), (mu * x3))
..@ diffusion :List of 3
.. ..$ : expression(diff.coef.1(t, x1, x2, x3), 0)
.. ..$ : expression(diff.coef.2(t, x1, x2, x3) * g(t), diff.coef.3(t, x1, x2, x3) * g(t))
.. ..$ : expression(diff.coef.2(t, x1, x2, x3), diff.coef.3(t, x1, x2, x3))
..@ parameter :Formal class model.parameter [package "yuima"] with 4 slots
.. .. ..@ all : chr "mu"
.. .. ..@ common : chr(0)
.. .. ..@ diffusion: chr(0)
.. .. ..@ drift : chr "mu"
..@ state.variable : chr [1:3] "x1" "x2" "x3"
..@ time.variable : chr "t"
..@ noise.number : int 2
..@ equation.number: int 3
..@ dimension : int [1:4] 1 0 0 1
..@ solve.variable : chr [1:3] "x1" "x2" "x3"

29 / 41
Simulation of paths

# Sets the sampling scheme


> yuima.samp <- set.sampling(Terminal=1,division=1000)

# build the yuima object: put together model and sampling


> my.yuima <- set.yuima(model=sabr.mod, sampling=yuima.samp)

# Solve/Simulate SDE using Euler-Maruyama method


# add the simulated data to the yuima object
> my.sde <- simulate(my.yuima, xinit=c(1.0,0.1,1.0))

# and a plot method exists inherited from zoo package


> plot(my.sde)

30 / 41
The newly generated yuima object

> str(my.sde)
Formal class yuima [package "yuima"] with 4 slots
..@ data :Formal class yuima.data [package "yuima"] with 2 slots
.. .. ..@ original.data: mts [1:1001, 1:3] 1 0.998 0.999 0.996 1.001 ...
.. .. .. ..- attr(*, "dimnames")=List of 2
.. .. .. .. ..$ : NULL
.. .. .. .. ..$ : chr [1:3] "Series 1" "Series 2" "Series 3"
.. .. .. ..- attr(*, "tsp")= num [1:3] 0 1 1000
.. .. .. ..- attr(*, "class")= chr [1:2] "mts" "ts"
.. .. ..@ zoo.data :List of 3
.. .. .. ..$ Series 1:zooreg series from 0 to 1
Data: num [1:1001] 1 0.998 0.999 0.996 1.001 ...
Index: num [1:1001] 0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 ...
Frequency: 1000
.. .. .. ..$ Series 2:zooreg series from 0 to 1
Data: num [1:1001] 0.1 0.104 0.106 0.106 0.103 ...
Index: num [1:1001] 0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 ...
Frequency: 1000
.. .. .. ..$ Series 3:zooreg series from 0 to 1
Data: num [1:1001] 1 1.01 1.01 1.01 1.01 ...
Index: num [1:1001] 0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 ...
Frequency: 1000
..@ model :Formal class yuima.model [package "yuima"] with 9 slots
.. .. ..@ drift : expression((0), (mu * g(t) * x3), (mu * x3))
.. .. ..@ diffusion :List of 3
.. .. .. ..$ : expression(diff.coef.1(t, x1, x2, x3), 0)
.. .. .. ..$ : expression(diff.coef.2(t, x1, x2, x3) * g(t), diff.coef.3(t, x1, x2, x3) * g(t))
.. .. .. ..$ : expression(diff.coef.2(t, x1, x2, x3), diff.coef.3(t, x1, x2, x3))
.. .. ..@ parameter :Formal class model.parameter [package "yuima"] with 4 slots
.. .. .. .. ..@ all : chr "mu"
.. .. .. .. ..@ common : chr(0)
.. .. .. .. ..@ diffusion: chr(0)
.. .. .. .. ..@ drift : chr "mu" 31 / 41
.. .. ..@ state.variable : chr [1:3] "x1" "x2" "x3"
Motivation

It is better than the sde package because it allows for multidimensional specification but also
provide a formal definition of an SDE.

But we need more that this!

32 / 41
Motivation

It is better than the sde package because it allows for multidimensional specification but also
provide a formal definition of an SDE.

processes
But we need more that this! We need at least Levy

Asset prices (left) do not evolve continuously, they exhibit jumps or spikes and log returns (right)
are non-gaussian, skewed, heavy tails
150

80
USD/JPY
145

140

60
135

130

40
125

120

115
20

110

105
0

100
Oct 1997 Oct 1998 Oct 1999 Oct 2000 Oct 2001 Oct 2002 Oct 2003 Oct 2004 !0.02 !0.01 0.0 0.01 0.02

32 / 41

The general Levy SDE

In general the sde.model describes the following d-dimensional SDE:

dXt = a(Xt )dt + b(Xt )dWt


Z Z
+ c(Xt , z)(dt, dz) + c(Xt , z){(dt, dz) (dz)dt},
|z|>1 0<|z|1
X 0 = x0 , (3)

where the ingredients are given as follows.

 the initial random variable X0 Rd ;

 an rW -dimensional standard Wiener process W ;

 a random measure on (0, ) Rr associated with jumps of X , that is,


X
(dt, dz) = 1{Zs 6=0} (s,Zs ) (dt, dz), (4)
s>0

where denotes the Dirac measure 33 / 41



The general Levy SDE

 Z the driving pure-jump Levy


process of the form
Z tZ Z tZ
Zt = z{(ds, dz) (dz)ds} + z(ds, dz); (5)
0 |z|1 0 |z|>1

measure , which is any measure satisfying ({0})


 a Levy = 0 and
(1 |z|2 )(dz) < ;
R

 the coefficient functions a : Rd Rd , b : Rd Rd Rrw , and c : Rd Rr Rd .

34 / 41
Input of the jump part

> set.model( drift = "a(x,theta)", diffusion = "b(x,sigma)",


+ jump.coeff = "c(x,z,xi)", measure = list(*),
+ measure.type = string(**),
+ state.var = c("x"), jump.var = c("z"), time.var = "t",
+ solve.var="c("x") )

where measure and measure.type are strictly related. For example, suppose that Z is a
density
gamma process with Levy

a bz
f (z) = e 1(0,) (z).
z
Then Zt (at, b), therefore one uses

> set.model(measure="dgamma(a*t,b)", measure.type="increment", ...)

35 / 41
Input of the jump part

Suppose that (dz) = 0 F (dz), where 0 0 is a constant and F (z) is a distribution


function (d.f.) of jump size with a parameter vector = (1 , 2 , . . .). This is the Compound
measure.
Poisson formulation of a Levy
In this case users can input the intensity 0 and the d.f. F (z) separately as follows:

> my.meas <- list( intensity=eta0, df=list(F(z,eta1,eta2,...))

where eta0 and F() are defined somewhere in the R workspace and

> set.model( measure = my.meas, measure.type = "CP", ... )

36 / 41
Input of the jump part

measure , i.e.
Or one can directly input the density of the Levy

(dz) = f (z, ) dz.

In this case users can input the intensity 0 and the d.f. F (z) separately as follows:

> set.model(measure = list(density=f(z,eta)), measure.type = "density", ... )

or

> F <- function(z,eta) f(z,eta)


> set.model(measure = list(df=F(z,eta)), measure.type = "density", ... )

measures are implemented in the yuima


Many other options and already coded typical Levy
package (e.g. NIG, stable, tempered stable, bilateral Gamma, etc.)

37 / 41
Simulation and Inference

Once a yuima model is available, it can be passed to the simulate method or to some
estimation methods along with the data.

When passed to simulate, the output is a new yuima.object with both the yuima.model,
yuima.data and yuima.sampling slots.

There is a function called simulate.levy which is a shortcut function, used to simulate Levy

paths according to the above specifications.

For the inference and simulation, the methods are supposed to work, by default, using the best
theory available for the data and the model, up to current literature, unless the user specifies
differently.

e.g. in the high frequency case the limiting distributions are of mixed-normal type, so confidence
intervals and standard errors are more delicate to handle

38 / 41
Toy examples

Just to prove different aspects and flexibility of this approach, we have implemented several
methods

 the covariance estimator of Yoshida-Hayashi for multidimensional Ito processes with


asynchronous data.

 quasi-likelihood estimation for multidimensional diffusions with jumps

 asymptotic expansion of functionals of the solutions of SDEs with small noise (useful in
option pricing)

 change point estimation for multidimensional Ito processes

 Bayes type estimators

 asymptotic expansion of the distribution of estimators (for small sample asymptotics)

39 / 41
A formula-type interface

We also plan to add the formula interface to mimic model specification in R. A few working
examples are
dXt = b(Xt )dt + (Xt )dWt
passed to set.model as

dX ~ b(X)*dt + s(X)*dW

or, the following stochastic volatility model

dXt = b(Xt , , t)dt + (Xt , Yt , )dWt


dYt = d(Yt , )dZt
as

dX ~ b(X,theta,t)*dt + s(X,Y,beta)*dW
dY ~ d(Y,tau)*dZ

40 / 41
First release?

Overview of the sde


package
Roadmap
The Yuima Project
Multidimensional SDE:
 we plan to release openly the basic infrastructure by the end of this year
theoretical model
SDE
The general Levy  implement several basic methods in early 2010

 open development to potential new contributors (if there is enough


interest) mid 2010

 write the point & click layer 3 (...one day!)

41 / 41
First release?

Overview of the sde


package
Roadmap
The Yuima Project
Multidimensional SDE:
 we plan to release openly the basic infrastructure by the end of this year
theoretical model
SDE
The general Levy  implement several basic methods in early 2010

 open development to potential new contributors (if there is enough


interest) mid 2010

 write the point & click layer 3 (...one day!)

41 / 41

Anda mungkin juga menyukai