Learn R Programming

sde (version 2.0.18)

sdeDiv: Phi-Divergences test for diffusion processes

Description

Phi-Divergences test for diffusion processes.

Usage

sdeDiv(X, theta1, theta0, phi= expression( -log(x) ), C.phi, K.phi, 
       b, s, b.x, s.x, s.xx, B, B.x, H, S, guess, ...)

Value

x

a list containing the value of the divergence, its pvalue, the likelihood ratio test statistics and its p-value

Arguments

X

a ts object containing a sample path of an sde.

theta1

a vector parameters for the hypothesis H1. If not given, theta1 is estimated from the data.

theta0

a vector parameters for the hypothesis H0.

phi

an expression containing the phi function of the phi-divergence.

C.phi

the value of first derivtive of phi at point 1. If not given, it is calculated within this function.

K.phi

the value of second derivative of phi at point 1. If not given, it is calculated within this function.

b

drift coefficient of the model as a function of x and theta.

s

diffusion coefficient of the model as a function of x and theta.

b.x

partial derivative of b as a function of x and theta.

s.x

partial derivative of s as a function of x and theta.

s.xx

second-order partial derivative of s as a function of x and theta.

B

initial value of the parameters; see details.

B.x

partial derivative of B as a function of x and theta.

H

function of (x,y), the integral of B/s; optional.

S

function of (x,y), the integral of 1/s; optional.

guess

initial value for the parameters to be estimated; optional.

...

passed to the optim function; optional.

Author

Stefano Maria Iacus

Details

The sdeDiv estimate the phi-divergence for diffusion processes defined as D(theta1, theta0) = phi( f(theta1)/f(theta0) ) where f is the likelihood function of the process. This function uses the Dacunha-Castelle and Florens-Zmirou approximation of the likelihood for f.

The parameter theta1 is supposed to be the value of the true MLE estimator or the minimum contrast estimator of the parameters in the model. If missing or NULL and guess is specified, theta1 is estimated using the minimum contrast estimator derived from the locally Gaussian approximation of the density. If both theta1 and guess are missing, nothing can be calculated.

The function always calculates the likelihood ratio test and the p-value of the test statistics. In some cases, the p-value of the phi-divergence test statistics is obtained by simulation. In such a case, the out$est.pval is set to TRUE

Dy default phi is set to -log(x). In this case the phi-divergence and the likelihood ratio test are equivalent (e.g. phi-Div = LRT/2)

For more informations on phi-divergences for discretely observed diffusion processes see the references.

If missing, B is calculated as b/s - 0.5*s.x provided that s.x is not missing.

If missing, B.x is calculated as b.x/s - b*s.x/(s^2)-0.5*s.xx, provided that b.x, s.x, and s.xx are not missing.

If missing, both H and S are evaluated numerically.

References

Dacunha-Castelle, D., Florens-Zmirou, D. (1986) Estimation of the coefficients of a diffusion from discrete observations, Stochastics, 19, 263-284.

De Gregorio, A., Iacus, S.M. (2008) Divergences Test Statistics for Discretely Observed Diffusion Processes, Journal of Statistical Planning and Inference, 140(7), 1744-1753, tools:::Rd_expr_doi("10.1016/j.jspi.2009.12.029").

Examples

Run this code
if (FALSE) {
set.seed(123)
theta0 <- c(0.89218*0.09045,0.89218,sqrt(0.032742))
theta1 <- c(0.89218*0.09045/2,0.89218,sqrt(0.032742/2))

# we test the true model against two competing models
b <- function(x,theta) theta[1]-theta[2]*x
b.x <- function(x,theta)  -theta[2]

s <- function(x,theta) theta[3]*sqrt(x)
s.x <- function(x,theta) theta[3]/(2*sqrt(x))
s.xx <- function(x,theta) -theta[3]/(4*x^1.5)


X <- sde.sim(X0=rsCIR(1, theta1), N=1000, delta=1e-3, model="CIR", 
 theta=theta1)

sdeDiv(X=X, theta0 = theta0,   b=b, s=s, b.x=b.x, s.x=s.x, 
 s.xx=s.xx, method="L-BFGS-B", 
 lower=rep(1e-3,3), guess=c(1,1,1))

sdeDiv(X=X, theta0 = theta1,   b=b, s=s, b.x=b.x, s.x=s.x, 
 s.xx=s.xx, method="L-BFGS-B", 
 lower=rep(1e-3,3), guess=c(1,1,1))

lambda <- -1.75
myphi <-  expression( (x^(lambda+1) -x - lambda*(x-1))/(lambda*(lambda+1)) )

sdeDiv(X=X, theta0 = theta0,   phi = myphi, b=b, s=s, b.x=b.x, 
 s.x=s.x, s.xx=s.xx, method="L-BFGS-B", 
 lower=rep(1e-3,3), guess=c(1,1,1))

sdeDiv(X=X, theta0 = theta1,   phi = myphi, b=b, s=s, b.x=b.x, 
 s.x=s.x, s.xx=s.xx, method="L-BFGS-B", 
 lower=rep(1e-3,3), guess=c(1,1,1))
}

Run the code above in your browser using DataLab