NormalToeplitz | R Documentation |
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)
.
new()
Class constructor.
NormalToeplitz$new(N)
N
Size of the NTz random vector.
A NormalToeplitz
object.
size()
Get the size of the NTz random vector.
NormalToeplitz$size()
Size of the NTz random vector.
logdens()
Log-density function.
NormalToeplitz$logdens(z, acf)
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.
A scalar or vector of length n_obs
containing the log-density of the NTz evaluated at its arguments.
grad()
Gradient of the log-density with respect to parameters.
NormalToeplitz$grad(z, dz, acf, dacf, full_out = FALSE)
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').
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.
hess()
Hessian of log-density with respect to parameters.
NormalToeplitz$hess(z, dz, d2z, acf, dacf, d2acf, full_out = FALSE)
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').
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.
grad_full()
Full gradient of log-density function.
NormalToeplitz$grad_full(z, acf, calc_dldz = TRUE, calc_dlda = TRUE)
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
.
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
.
clone()
The objects of this class are cloneable with this method.
NormalToeplitz$clone(deep = FALSE)
deep
Whether to make a deep clone.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.