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

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)
#> $data #> X Z #> [1,] 6.819487 0.09819872 #> [2,] 6.872264 0.09881696 #> [3,] 6.929321 0.10138062 #> [4,] 6.849917 0.10131988 #> [5,] 6.897041 0.09930631 #> #> $dt.m #> [1] 0.6 0.6 0.6 0.6 #> #> $nvar.obs.m #> [1] 2 2 2 2 2 #> #> $params #> alpha gamma beta sigma rho #> 0.1 1.0 0.8 0.6 -0.8 #> #> attr(,"class") #> [1] "sde.init"
# 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)
#> $data #> X Z #> [1,] 6.819487 0.09819872 #> [2,] 6.872264 0.09881696 #> [3,] 6.929321 0.10138062 #> [4,] 6.849917 0.10131988 #> [5,] 6.897041 0.09930631 #> #> $dt.m #> [1] 0.6 0.6 0.6 0.6 #> #> $nvar.obs.m #> [1] 2 1 1 1 2 #> #> $params #> alpha gamma beta sigma rho #> 0.1 1.0 0.8 0.6 -0.8 #> #> attr(,"class") #> [1] "sde.init"
# 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)
#> $data #> X Z #> [1,] 6.819487 0.09819872 #> [2,] 6.837079 0.09840480 #> [3,] 6.854672 0.09861088 #> [4,] 6.872264 0.09881696 #> [5,] 6.891283 0.09967151 #> [6,] 6.910302 0.10052606 #> [7,] 6.929321 0.10138062 #> [8,] 6.902853 0.10136037 #> [9,] 6.876385 0.10134012 #> [10,] 6.849917 0.10131988 #> [11,] 6.865625 0.10064869 #> [12,] 6.881333 0.09997750 #> [13,] 6.897041 0.09930631 #> #> $dt.m #> [1] 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 #> #> $nvar.obs.m #> [1] 1 0 0 1 0 0 1 0 0 1 0 0 1 #> #> $params #> alpha gamma beta sigma rho #> 0.1 1.0 0.8 0.6 -0.8 #> #> attr(,"class") #> [1] "sde.init"