Skip to contents

Computes the gradient of the Gaussian log-likelihood of a univariate process under a model with autocovariance structure defined via B-spline basis functions, either with respect to the coefficients or their logarithms.

Usage

compute_toeplitz_loglik_grad(y, c, knots, k, log_coef = TRUE)

Arguments

y

A numeric vector representing the observed time series.

c

A numeric vector of spectral coefficients.

knots

A numeric vector of knot locations defining the B-spline basis.

k

The degree of the B-spline basis functions.

log_coef

Logical; if TRUE (default), returns the gradient with respect to log(c).

Value

A numeric vector: the gradient of the log-likelihood with respect to c or log(c).

Details

When log_coef = TRUE, this function returns the gradient with respect to the log-transformed spectral coefficients \(\theta = \log(c)\), applying the chain rule. This is useful for optimization in an unconstrained parameter space. When log_coef = FALSE, it returns the gradient with respect to the original coefficients c.