| ksmooth | R Documentation | 
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.
ksdrift(x, bw, n = 512) ksdiff(x, bw, n = 512) ksdens(x, bw, n = 512)
| x | a  | 
| bw | bandwidth. | 
| n | number of points in which to calculate the estimates. | 
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.
| val | an invisible list of  | 
Stefano Maria Iacus
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.
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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.