rgmrf: Sample from a multivariate Gaussian with a sparse precision...

View source: R/gmrf.R

rgmrfR Documentation

Sample from a multivariate Gaussian with a sparse precision matrix

Description

Draw samples from a multivariate Gaussian distribution specified by a sparse precision matrix. This is numerically efficient for high-dimensional but sparse systems.

Usage

rgmrf(n, mean = 0, Q)

Arguments

n

Number of samples to draw.

mean

Mean vector (or scalar, which will be recycled to match the dimension of Q).

Q

Sparse precision matrix (\Sigma^{-1}).

Value

A matrix of samples with rows corresponding to samples and columns to dimensions.

Examples

rgmrf(3, mean = c(1, 2, 3), Q = Matrix::Diagonal(3))

RTMBdist documentation built on Oct. 31, 2026, 5:07 p.m.