grad_likelihood_fn: Gradient of the GrOU likelihood function with penalty.

Description Usage Arguments Value Examples

View source: R/likelihood.R

Description

Gradient of the GrOU likelihood function with penalty.

Usage

1
2
3
4
5
6
7
8
grad_likelihood_fn(
  times,
  data,
  thresholds,
  div = 1e+05,
  use_scaling = FALSE,
  log = TRUE
)

Arguments

times

Times at which data is given

data

Values to compute the MLE with.

thresholds

Jump threshold values.

div

Batch size/divisor to avoid large memory allocation.

use_scaling

Brownian motion covariance matrix scaling in the likelihood.

log

Log-scale for the likelihood or not (defaults to FALSE).

Value

(Log)likelihood of the GrOU process with penalty.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
n <- 1000
d <- 10
times <- seq(n)
delta_time <- 0.01
beta_value <- 0.499
noise <- matrix(rnorm(n * d, sd = sqrt(delta_time)), ncol = d)
data <- construct_path(
  diag(d),
  noise = noise, y_init = rep(0, d), delta_time = delta_time
)
thresholds <- rep(delta_time^beta_value, d)
grad_loglik <- grad_likelihood_fn(
  times = times, data = data, thresholds = thresholds, div = 1e2
)
grad_loglik(diag(d))

ntwk documentation built on Sept. 13, 2021, 9:07 a.m.