sde.init {msde}R Documentation

MCMC initialization.

Description

Specifies the observed SDE data, interobservation times, initial parameter and missing data values to be supplied to sde.post().

Usage

sde.init(model, x, dt, m = 1, nvar.obs, theta)

Arguments

model

An sde.model object.

x

An ⁠nobs x ndims⁠ matrix of data.

dt

A scalar or length nobs-1 vector of interobservations times.

m

Positive integer, such that m-1 evenly-spaced missing data time points are placed between observations. See Details.

nvar.obs

A scalar or length nobs vector of integers between 0 and ndims denoting the number of observed SDE variables in each row of data. Defaults to ndims. See Details.

theta

A length nparams vector of parameter values.

Value

An sde.init object, corresponding to a list with elements:

data

An ⁠ncomp x ndims⁠ matrix of complete data, where ncomp = N_m = m * (nobs-1)+1.

dt.m

The complete data interobservation time, dt_m = dt/m.

nvar.obs.m

The number of variables observed per row of data. Note that nvar.obs.m[(i-1)*m+1] == nvar.obs[ii], and that nvar.obs.m[i-1] == 0 if i is not a multiple of m.

params

Parameter initial values.

Examples

# load Heston's model
hmod <- sde.examples("hest")

# generate some observed data
nObs <- 5
x0 <- c(X = log(1000), Z = 0.1)
X0 <- apply(t(replicate(nObs, x0)), 2, jitter)
dT <- .6
theta <- c(alpha = 0.1, gamma = 1, beta = 0.8, sigma = 0.6, rho = -0.8)

# no missing data
sde.init(model = hmod, x = X0, dt = dT, theta = theta)

# all but endpoint volatilities are missing
sde.init(model = hmod, x = X0, dt = dT, m = 1,
         nvar.obs = c(2, rep(1, nObs-2), 2), theta = theta)

# all volatilities missing,
# two completely missing SDE timepoints between observations
m <- 3 # divide each observation interval into m equally spaced timepoints
sde.init(model = hmod, x = X0, dt = dT,
         m = m, nvar.obs = 1, theta = theta)

[Package msde version 1.0.5 Index]