sde.make.model: Create an SDE model object.

Description Usage Arguments Value See Also Examples

Description

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

Usage

1
2
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:

model.ptr

Pointer to C++ sde object (sdeCobj) 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# 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

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