sde.make.model {msde}R Documentation

Create an SDE model object.

Description

Compiles the C++ code for various SDE-related algorithms and makes the routines available within R.

Usage

sde.make.model(
  ModelFile,
  PriorFile = "default",
  data.names,
  param.names,
  hyper.check,
  OpenMP = FALSE,
  ...
)

Arguments

ModelFile

Path to the header file where the SDE model is defined.

PriorFile

Path to the header file where the SDE prior is defined. See sde.prior() for details.

data.names

Vector of names for the SDE components. Defaults to ⁠X1,...,Xd⁠.

param.names

Vector of names for the SDE parameters. Defaults to ⁠theta1,...,thetap⁠.

hyper.check

A function with arguments hyper, param.names, and data.names used for passing the model hyper parameters to the C++ code. See mvn.hyper.check() for details.

OpenMP

Logical; whether the model is compiled with OpenMP for C++ level parallelization.

...

additional arguments to Rcpp::sourceCpp() for compiling the C++ code.

Value

An sde.model object, consisting of a list with the following elements:

ptr

Pointer to C++ sde object (sdeRobj) implementing the member functions: drift/diffusion, data/parameter validators, loglikelihood, prior distribution, forward simulation, MCMC algorithm for Bayesian inference.

ndims, nparams

The number of SDE components and parameters.

data.names, param.names

The names of the SDE components and parameters.

omp

A logical flag for whether or not the model was compiled for multicore functionality with OpenMP.

See Also

sde.drift(), sde.diff(), sde.valid(), sde.loglik(), sde.prior(), sde.sim(), sde.post().

Examples

# header (C++) file for Heston's model
hfile <- sde.examples("hest", file.only = TRUE)
cat(readLines(hfile), sep = "\n")


# compile the model
param.names <- c("alpha", "gamma", "beta", "sigma", "rho")
data.names <- c("X", "Z")
hmod <- sde.make.model(ModelFile = hfile,
                       param.names = param.names,
                       data.names = data.names)

hmod


[Package msde version 1.0.5 Index]