NormalToeplitz: Multivariate normal with Toeplitz variance matrix.

NormalToeplitzR Documentation

Multivariate normal with Toeplitz variance matrix.

Description

Provides methods for the Normal-Toeplitz (NTz) distribution defined as

z ~ NTz(acf)   <=>   z ~ Normal(0, toeplitz(acf)),

i.e., for a multivariate normal with mean zero and variance Tz = toeplitz(acf).

Methods

Public methods


Method new()

Class constructor.

Usage
NormalToeplitz$new(N)
Arguments
N

Size of the NTz random vector.

Returns

A NormalToeplitz object.


Method size()

Get the size of the NTz random vector.

Usage
NormalToeplitz$size()
Returns

Size of the NTz random vector.


Method logdens()

Log-density function.

Usage
NormalToeplitz$logdens(z, acf)
Arguments
z

Density argument. A vector of length N or an N x n_obs matrix where each column is an N-dimensional observation.

acf

A vector of length N containing the autocorrelation (i.e., first row/column) of the Toeplitz variance matrix.

Returns

A scalar or vector of length n_obs containing the log-density of the NTz evaluated at its arguments.


Method grad()

Gradient of the log-density with respect to parameters.

Usage
NormalToeplitz$grad(z, dz, acf, dacf, full_out = FALSE)
Arguments
z

Density argument. A vector of length N.

dz

An N x n_theta matrix containing the gradient dz/dtheta.

acf

A vector of length N containing the autocorrelation of the Toeplitz variance matrix.

dacf

An N x n_theta matrix containing the gradient dacf/dtheta.

full_out

If TRUE, returns the log-density as well (see 'Value').

Returns

A vector of length n_theta containing the gradient of the NTz log-density with respect to theta, or a list with elements ldens and grad consisting of the log-density and the gradient vector.


Method hess()

Hessian of log-density with respect to parameters.

Usage
NormalToeplitz$hess(z, dz, d2z, acf, dacf, d2acf, full_out = FALSE)
Arguments
z

Density argument. A vector of length N.

dz

An N x n_theta matrix containing the gradient dz/dtheta.

d2z

An N x n_theta x n_theta array containing the Hessian d^2z/dtheta^2.

acf

A vector of length N containing the autocorrelation of the Toeplitz variance matrix.

dacf

An N x n_theta matrix containing the gradient dacf/dtheta.

d2acf

An N x n_theta x n_theta array containing the Hessian dacf^2/dtheta^2.

full_out

If TRUE, returns the log-density and its gradient as well (see 'Value').

Returns

An n_theta x n_theta matrix containing the Hessian of the NTz log-density with respect to theta, or a list with elements ldens, grad, and hess consisting of the log-density, its gradient (a vector of size n_theta), and the Hessian matrix, respectively.


Method grad_full()

Full gradient of log-density function.

Usage
NormalToeplitz$grad_full(z, acf, calc_dldz = TRUE, calc_dlda = TRUE)
Arguments
z

Density argument. A vector of length N.

acf

A vector of length N containing the autocorrelation of the Toeplitz variance matrix.

calc_dldz

Whether or not to calculate the gradient with respect to z.

calc_dlda

Whether or not to calculate the gradient with respect to acf.

Returns

A list with elements:

ldens

The log-density evaluated at z and acf.

dldz

The length-N gradient vector with respect to z, if calc_dldz = TRUE.

dlda

The length-N gradient vector with respect to acf, if calc_dlda = TRUE.


Method clone()

The objects of this class are cloneable with this method.

Usage
NormalToeplitz$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.


SuperGauss documentation built on March 18, 2022, 6:35 p.m.