| HPloglik {sde} | R Documentation |
Ait-Sahalia Hermite polynomial expansion and 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.
HPloglik(X, theta, M, F, s, log=TRUE)
X |
a ts object containg a sample path of a sde. |
theta |
vector of parameters. |
M |
list of derivatives. See details. |
F |
the transform function. See details. |
s |
drift and diffusion coefficient. See details. |
log |
logical; if TRUE, the log-likelihood is returned. |
The function HPloglik returns Hermite-polynomial approximation of the
likelihood of a diffusion process transformed to have unitary diffusion
coefficient. The function F is the transform function and
s is the original diffusion coefficients. The list of functions
M contain the transformed drift in M[[1]] and the
subsequent 6 derivatives in x of M[[1]]. The functions
F, s and M have arguments (t,x,theta).
For more information see references.
x |
a number |
Stefano Maria Iacus
Ait-Sahalia, Y. (1996) Testing Continuous-Time Models of the Spot Interest Rate, Review of Financial Studies, 9(2), 385-426.
set.seed(123)
d <- expression(-1*x)
s <- expression(2)
sde.sim(drift=d, sigma=s) -> X
M0 <- function(t, x, theta) -theta[1]*x
M1 <- function(t, x, theta) -theta[1]
M2 <- function(t, x, theta) 0
M3 <- function(t, x, theta) 0
M4 <- function(t, x, theta) 0
M5 <- function(t, x, theta) 0
M6 <- function(t, x, theta) 0
mu <- list(M0, M1, M2, M3, M4, M5, M6)
F <- function(t, x, theta) x/sqrt(theta[2])
S <- function(t, x, theta) sqrt(theta[2])
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) HPloglik(X,c(x,4),mu,F,S)) -> px
sapply(xx, function(x) true.loglik(c(x,4))) -> py
plot(xx,px,type="l",xlab=expression(beta),ylab="log-likelihood") # approx
lines(xx,py, lty=3) # true