Description Usage Arguments Details Value
Sample from multivariate normal distribution with mean Q^{-1}l and covariance matrix Q^{-1}.
1 2 3 4 5 | rnorm_qinv_l <- function(
n,
Q,
l,
L)
|
n |
number of elements to generate |
Q |
p by p precision matrix. |
l |
p by 1 vector |
L |
NULL by default. If not null, Q is ignored and assumed to be LL^t. |
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.