Description Usage Arguments Value Examples
Evaluates the loglikelihood function given SDE data and parameter values.
1 | sde.loglik(model, x, dt, theta, ncores = 1)
|
model |
An |
x |
A matrix or 3-d array of data with |
dt |
A scalar or vector of length |
theta |
A vector or matrix of parameters with |
ncores |
If |
A vector of loglikelihood evaluations, of the same length as the third dimension of x
and/or first dimension of theta
. If input contains invalid data or parameters an error is thrown.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # load Heston's model
hmod <- sde.examples("hest")
# Simulate data
nreps <- 10
nobs <- 100
theta <- c(alpha = 0.1, gamma = 1, beta = 0.8, sigma = 0.6, rho = -0.8)
Theta <- apply(t(replicate(nreps, theta)), 2, jitter)
x0 <- c(X = log(1000), Z = 0.1)
X0 <- apply(t(replicate(nreps,x0)), 2, jitter)
dT <- 1/252
hsim <- sde.sim(model = hmod, x0 = X0, theta = Theta,
dt = dT, dt.sim = dT/10, nobs = nobs, nreps = nreps)
# single parameter, single data
sde.loglik(model = hmod, x = hsim$data[,,1], dt = dT, theta = theta)
# multiple parameters, single data
sde.loglik(model = hmod, x = hsim$data[,,1], dt = dT, theta = Theta)
# multiple parameters, multiple data
sde.loglik(model = hmod, x = hsim$data, dt = dT, theta = Theta)
|
Number of normal draws required: 10000
Running simulation...
Execution time: 0 seconds.
Bad Draws = 0
[1] 676.7975
[1] 677.4243 677.8487 676.4750 677.3984 677.6822 676.4481 675.5413 677.2725
[9] 677.5212 677.5073
[1] 677.4243 662.4402 696.3139 685.1827 671.5259 663.1523 643.8008 693.0950
[9] 683.0072 685.9122
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.