prec_to_cov: Get covariance matrix from precision matrix

View source: R/utility.R

prec_to_covR Documentation

Get covariance matrix from precision matrix

Description

The covariance matrix is the inverse of the precision matrix. By default, the function solve is used for inversion. If it fails (e.g., singular system), then MASS::ginv is used instead, and returns the Moore-Penrose generalised inverse of the precision matrix.

Usage

prec_to_cov(prec_mat)

Arguments

prec_mat

Precision matrix (either of 'matrix' type or sparse matrix on which as.matrix can be used)

Value

Precision matrix


TheoMichelot/hmmTMB documentation built on Dec. 13, 2024, 11:52 a.m.