Description Usage Arguments Details Value
View source: R/rnorm_qinv_l_chol.R
Sample from multivariate normal distribution with mean Q^{-1}l and covariance matrix Q^{-1} where Q = LL^t.
1 2 3 4 | rnorm_qinv_l_chol <- function(
n,
L,
l)
|
n |
number of elements to generate |
L |
NULL by default. If not null, Q is ignored and assumed to be LL^t. |
l |
p by 1 vector |
The algorithm is as follows
1. Cholesky decomposition of Q into LL^t. (This step is skipped if L is passed in).
2. Sample z from rnorm(p). Let y = Lz + l.
3. Solve for x in LL^tx = y and return.
x |
An p x 1 vector if n=1 otherwise a n by p matrix |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.