Learn R Programming

sde (version 2.0.18)

SIMloglik: Pedersen's approximation of the likelihood

Description

Pedersen's approximation of the likelihood of a process solution of a stochastic differential equation. This function is useful to calculate approximated maximum likelihood estimators when the transition density of the process is not known. It is computationally intensive.

Usage

SIMloglik(X, theta, d, s,  M=10000, N=2, log=TRUE)

Value

x

a number

Arguments

X

a ts object containing a sample path of an sde.

theta

vector of parameters.

d,s

drift and diffusion coefficients; see details.

log

logical; if TRUE, the log-likelihood is returned.

N

number of subintervals; see details.

M

number of Monte Carlo simulations, which should be an even number; see details.

Author

Stefano Maria Iacus

Details

The function SIMloglik returns the simulated log-likelihood obtained by Pedersen's method. The functions s and d are the drift and diffusion coefficients with arguments (t,x,theta).

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

Run this code
if (FALSE) {
set.seed(123)
d <- expression(-1*x)
s <- expression(2) 
sde.sim(drift=d, sigma=s,N=50,delta=0.01) -> X

S <- function(t, x, theta) sqrt(theta[2])
B <- function(t, x, theta) -theta[1]*x

true.loglik <- function(theta) {
 DELTA <- deltat(X)
 lik <- 0
 for(i in 2:length(X))
  lik <- lik + dnorm(X[i], mean=X[i-1]*exp(-theta[1]*DELTA), 
   sd = sqrt((1-exp(-2*theta[1]*DELTA))*
              theta[2]/(2*theta[1])),TRUE)
 lik  
}

xx <- seq(-10,10,length=20)
sapply(xx, function(x) true.loglik(c(x,4))) -> py
sapply(xx, function(x) EULERloglik(X,c(x,4),B,S)) -> pz
sapply(xx, function(x) SIMloglik(X,c(x,4),B,S,M=10000,N=5)) -> pw

plot(xx,py,type="l",xlab=expression(beta),
   ylab="log-likelihood",ylim=c(0,15)) # true
lines(xx,pz, lty=2) # Euler
lines(xx,pw, lty=3) # Simulated
}

Run the code above in your browser using DataLab