sde.valid: SDE data and parameter validators.

Description Usage Arguments Value Examples

Description

Checks whether input SDE data and parameters are valid.

Usage

1
2
3
sde.valid.data(model, x, theta)

sde.valid.params(model, theta)

Arguments

model

An sde.model object.

x

A length-ndims vector or ndims-column matrix of SDE data.

theta

A length-nparams vector or nparams-column of SDE parameter values.

Value

A logical scalar or vector indicating whether the given data/parameter pair is valid.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Heston's model
# valid data is: Z > 0
# valid parameters are: gamma, sigma > 0, |rho| < 1, beta > .5 * sigma^2
hmod <- sde.examples("hest") # load model

theta <- c(alpha = 0.1, gamma = 1, beta = 0.8, sigma = 0.6, rho = -0.8)

# valid data
x0 <- c(X = log(1000), Z = 0.1)
sde.valid.data(model = hmod, x = x0, theta = theta)

# invalid data
x0 <- c(X = log(1000), Z = -0.1)
sde.valid.data(model = hmod, x = x0, theta = theta)

# valid parameters
theta <- c(alpha = 0.1, gamma = 1, beta = 0.8, sigma = 0.6, rho = -0.8)
sde.valid.params(model = hmod, theta = theta)

# invalid parameters
theta <- c(alpha = 0.1, gamma = -4, beta = 0.8, sigma = 0.6, rho = -0.8)
sde.valid.params(model = hmod, theta = theta)

msde documentation built on May 2, 2019, 2:05 a.m.