EULERloglik {sde}R Documentation

Euler approximation of the likelihood

Description

Euler approximation of the likelihood of a process solution of a stochastic differential equation. These functions are useful to calculate approximated maximum-likelihood estimators when the transition density of the process is not known.

Usage

EULERloglik(X, theta, d, s, log = TRUE) 

Arguments

X a ts object containg a sample path of a sde.
theta vector of parameters.
d,s drift and diffusion coefficient. See details.
log logical; if TRUE, the log-likelihood is returned.

Details

The function EULERloglik returns the Euler approximation of the log-likelihood. The functions s and d are the drift and diffusion coefficients with arguments (t,x,theta).

Value

x a number

Note

This package is a companion to the book Simulation and Inference for Stochastic Differential Equation, Springer, NY.

Author(s)

Stefano Maria Iacus

Examples

set.seed(123)
d <- expression(-1*x)
s <- expression(2) 
sde.sim(drift=d, sigma=s) -> 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(-3,3,length=100)
sapply(xx, function(x) true.loglik(c(x,4))) -> py
sapply(xx, function(x) EULERloglik(X,c(x,4),B,S)) -> pz

plot(xx,py,type="l",xlab=expression(beta),ylab="log-likelihood") # true
lines(xx,pz, lty=2) # Euler

[Package sde version 1.9.14 Index]