Learn R Programming

sde (version 2.0.18)

simple.ef: Simple estimating functions of types I and II

Description

Apply a simple estimating function to find estimates of the parameters of a process solution of a stochastic differential equation.

Usage

simple.ef(X, f, guess, lower, upper)

Value

x

a vector of estimates

Arguments

X

a ts object containing a sample path of an sde.

f

a list of expressions of x and/or y and the parameters to be estimated; see details.

guess

initial value of the parameters; see details.

lower

lower bounds for the parameters; see details.

upper

upper bounds for the parameters; see details.

Author

Stefano Maria Iacus

Details

The function simple.ef minimizes a simple estimating function of the form sum_i f_i(x,y;theta) = 0 or sum_i f_i(x;theta) as a function of theta. The index i varies in 1:length(theta).

The list f is a list of expressions in x or (x,y).

References

Kessler, M. (1997) Estimation of an ergodic diffusion from discrete observations, Scand. J. Statist., 24, 211-229.

Kessler, M. (2000) Simple and Explicit Estimating Functions for a Discretely Observed Diffusion Process, Scand. J. Statist., 27, 65-82.

Examples

Run this code
set.seed(123); 
# Kessler's estimator for O-H process
K.est <- function(x) {
  n.obs <- length(x)
  n.obs/(2*(sum(x^2)))
}

# Least squares estimators for the O-H process
LS.est <- function(x) {
  n <- length(x) -1
  k.sum <- sum(x[1:n]*x[2:(n+1)])
  dt <- deltat(x)
  ifelse(k.sum>0, -log(k.sum/sum(x[1:n]^2))/dt, NA)
}

d <- expression(-1 * x)
s <- expression(1) 
x0 <- rnorm(1,sd=sqrt(1/2))
sde.sim(X0=x0,drift=d, sigma=s,N=2500,delta=0.1) -> X
 
# Kessler's estimator as estimating function
f <- list(expression(2*theta*x^2-1))
simple.ef(X, f, lower=0, upper=Inf)
K.est(X)

# Least Squares estimator as estimating function
f <- list(expression(x*(y-x*exp(-0.1*theta))))
simple.ef(X, f, lower=0, upper=Inf)
LS.est(X)

Run the code above in your browser using DataLab