Learn R Programming

SuperGauss (version 1.0.2)

dSnorm: Density of a multivariate normal with Toeplitz variance matrix.

Description

Efficient density evaluation for the multivariate normal distribution with Toeplitz variance matrix.

Usage

dSnorm(X, mu, acf, log = FALSE)

dSnormDL(X, mu, acf, log = FALSE)

Arguments

X

Vector or matrix, of which each column is a multivariate observation.

mu

Vector or matrix of mean values of compatible dimensions with X. Defaults to all zeros.

acf

Vector containing the first column of the Toeplitz variance matrix. For dSnorm, can also be a Toeplitz object.

log

Logical, whether to return the multivariate normal density on the log scale.

Value

Vector of (log-)densities, one for each column of X.

Details

dSnorm and dSnormDL have identical outputs, with the former using the generalized Schur algorithm and the latter, the Durbin-Levinson algorithm, which is more common but slower. dSnormDL is provided mainly for speed comparisons.

Examples

Run this code
# NOT RUN {
N <- 10
d <- 4
X <- matrix(rnorm(N*d), N, d)
theta <- 0.1
lambda <- 2

mu <- theta^2 * rep(1, N)
acf <- exp(-lambda * (1:N - 1))
acf <- Toeplitz(acf = acf)

dSnorm(X, mu, acf, log = TRUE)
# }

Run the code above in your browser using DataLab