ksmooth: Nonparametric invariant density, drift, and diffusion...

ksmoothR Documentation

Nonparametric invariant density, drift, and diffusion coefficient estimation

Description

Implementation of simple Nadaraya-Watson nonparametric estimation of drift and diffusion coefficient, and plain kernel density estimation of the invariant density for a one-dimensional diffusion process.

Usage

ksdrift(x, bw, n = 512)
ksdiff(x, bw, n = 512)
ksdens(x, bw, n = 512)

Arguments

x

a ts object.

bw

bandwidth.

n

number of points in which to calculate the estimates.

Details

These functions return the nonparametric estimate of the drift or diffusion coefficients for data x using the Nadaraya-Watson estimator for diffusion processes.

ksdens returns the density estimates of the invariant density.

If not provided, the bandwidth bw is calculated using Scott's rule (i.e., bw = len^(-1/5)*sd(x)) where len=length(x) is the number of observed points of the diffusion path.

Value

val

an invisible list of x and y coordinates and an object of class density in the case of invariant density estimation

Author(s)

Stefano Maria Iacus

References

Ait-Sahalia, Y. (1996) Nonparametric pricing of interest rate derivative securities, Econometrica, 64, 527-560.

Bandi, F., Phillips, P. (2003) Fully nonparametric estimation of scalar diffusion models, Econometrica, 71, 241-283.

Florens-Zmirou, D. (1993) On estimating the diffusion coefficient from discrete observations, Journal of Applied Probability, 30, 790-804.

Examples

set.seed(123)
theta <- c(6,2,1)
X <- sde.sim(X0 = rsCIR(1, theta), model="CIR", theta=theta,
     N=1000,delta=0.1)

b <- function(x)
 theta[1]-theta[2]*x

sigma <- function(x)
 theta[3]*sqrt(x)
  
minX <- min(X)
maxX <- max(X)

par(mfrow=c(3,1))
curve(b,minX,maxX)
lines(ksdrift(X),lty=3)

curve(sigma,minX, maxX)
lines(ksdiff(X),lty=3)

f <-function(x) dsCIR(x, theta)
curve(f,minX,maxX)
lines(ksdens(X),lty=3)

sde documentation built on Sept. 9, 2022, 3:07 p.m.