sde.drift: SDE drift function.

Description Usage Arguments Value Examples

View source: R/sde.drift.R

Description

Computes the SDE model's drift function given data and parameter values.

Usage

1
sde.drift(model, x, theta)

Arguments

model

An sde.model object.

x

A vector or matrix of data with ndims columns.

theta

A vector or matrix of parameters with nparams columns.

Value

A matrix with ndims columns containing the drift function evaluated at x and theta. If either input contains invalid SDE data or parameters an error is thrown.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# load Heston's model
hmod <- sde.examples("hest")

# single input
x0 <- c(X = log(1000), Z = 0.1)
theta <- c(alpha = 0.1, gamma = 1, beta = 0.8, sigma = 0.6, rho = -0.8)
sde.drift(model = hmod, x = x0, theta = theta)

# multiple inputs
nreps <- 10
Theta <- apply(t(replicate(nreps,theta)),2,jitter)
X0 <- apply(t(replicate(nreps,x0)),2,jitter)
sde.drift(model = hmod, x = X0, theta = Theta)

msde documentation built on Dec. 17, 2021, 9:07 a.m.