dcSim {sde} | R Documentation |
Pedersen's simulated transition density
Description
Simulated transition density X(t) | X(t0) = x0 of a diffusion process based on
Pedersen's method.
Usage
dcSim(x0, x, t, d, s, theta, M=10000, N=10, log=FALSE)
Arguments
x0 |
the value of the process at time |
x |
value in which to evaluate the conditional density. |
t |
lag or time. |
theta |
parameter of the process; see details. |
log |
logical; if TRUE, probabilities |
d |
drift coefficient as a function; see details. |
s |
diffusion coefficient as a function; see details. |
N |
number of subintervals; see details. |
M |
number of Monte Carlo simulations, which should be an even number; see details. |
Details
This function returns the value of the conditional density of
at point
x
.
The functions d
and s
, must be functions of t
,
x
, and theta
.
Value
x |
a numeric vector |
Author(s)
Stefano Maria Iacus
References
Pedersen, A. R. (1995) A new approach to maximum likelihood estimation for stochastic differential equations based on discrete observations, Scand. J. Statist., 22, 55-71.
Examples
## Not run:
d1 <- function(t,x,theta) theta[1]*(theta[2]-x)
s1 <- function(t,x,theta) theta[3]*sqrt(x)
from <- 0.08
x <- seq(0,0.2, length=100)
sle10 <- NULL
sle2 <- NULL
sle5 <- NULL
true <- NULL
set.seed(123)
for(to in x){
sle2 <- c(sle2, dcSim(from, to, 0.5, d1, s1,
theta=c(2,0.02,0.15), M=50000,N=2))
sle5 <- c(sle5, dcSim(from, to, 0.5, d1, s1,
theta=c(2,0.02,0.15), M=50000,N=5))
sle10 <- c(sle10, dcSim(from, to, 0.5, d1, s1,
theta=c(2,0.02,0.15), M=50000,N=10))
true <- c(true, dcCIR(to, 0.5, from, c(2*0.02,2,0.15)))
}
par(mar=c(5,5,1,1))
plot(x, true, type="l", ylab="conditional density")
lines(x, sle2, lty=4)
lines(x, sle5, lty=2)
lines(x, sle10, lty=3)
legend(0.15,20, legend=c("exact","N=2", "N=5", "N=10"),
lty=c(1,2,4,3))
## End(Not run)