Learn R Programming

MultiATSM (version 0.3.6)

logdet: computes the logarithm of determinant of a matrix A

Description

computes the logarithm of determinant of a matrix A

Usage

logdet(A, opt)

Arguments

A

squared matrix

opt

"chol" or "NULL" (text)

Details

Theoretically, this function should be functionally equivalent to log(det(A)). However, it avoids the overflow/underflow problems that are likely to happen when applying det to large matrices. The key idea is based on the mathematical fact that the determinant of a triangular matrix equals the product of its diagonal elements. Hence, the matrix's log-determinant is equal to the sum of their logarithm values. By keeping all computations in log-scale, the problem of underflow/overflow caused by product of many numbers can be effectively circumvented. The implementation is based on LU factorization.

References

This function is based on the "logdet" function by Le and Singleton (2018).
"A Small Package of Matlab Routines for the Estimation of Some Term Structure Models."
(Euro Area Business Cycle Network Training School - Term Structure Modelling). Available at: https://cepr.org/40029