sde.diff {msde} | R Documentation |
SDE diffusion function.
Description
Computes the SDE model's diffusion function given data and parameter values.
Usage
sde.diff(model, x, theta)
Arguments
model |
An |
x |
A vector or matrix of data with |
theta |
A vector or matrix of parameters with |
Value
A matrix with ndims^2
columns containing the diffusion function evaluated at x
and theta
. Each row corresponds to the upper triangular Cholesky factor of the diffusion matrix. If either input contains invalid SDE data or parameters an error is thrown.
Examples
# load Heston's model
hmod <- sde.examples("hest")
#'
# single input
theta <- c(alpha = 0.1, gamma = 1, beta = 0.8, sigma = 0.6, rho = -0.8)
x0 <- c(X = log(1000), Z = 0.1)
sde.diff(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.diff(model = hmod, x = X0, theta = Theta)
#'
# mixed inputs
sde.diff(model = hmod, x = x0, theta = Theta)
[Package msde version 1.0.5 Index]