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

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

# 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)
#> [,1] [,2] #> [1,] 0.09875 7.95
# 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)
#> [,1] [,2] #> [1,] 0.10012521 7.681225 #> [2,] 0.09890065 7.908508 #> [3,] 0.10066564 7.803266 #> [4,] 0.10013100 7.936043 #> [5,] 0.09723187 7.843591 #> [6,] 0.09690432 7.791269 #> [7,] 0.09895958 7.813965 #> [8,] 0.09949616 8.015569 #> [9,] 0.09962971 7.928145 #> [10,] 0.09718042 8.149479