make_Q | R Documentation |
A function for setting up a conditional autoregressive (CAR) or simultaneous autoregressive (SAR) precision matrix for use as a prior in Bayesian models
make_Q(n_dims, phi, use_spam = TRUE, prec_model = "CAR")
n_dims |
is a vector of length M that are the dimensions of the CAR/SAR matrix at each resolution |
phi |
is a vector of length M with each element between -1 and 1 that defines the strength of the autoregressive process. Typically this will be set to 1 for use as a prior in penalized Bayesian models |
use_spam |
is a boolean flag to determine whether the output is a list of spam matrix objects ( |
prec_model |
is a string that takes the values "CAR" or "SAR" and defines the graphical structure for the precision matrix. |
a list of n x n sparse spam matrices or Matrix matrices of class "dgCMatrix" (see Matrix package for details)
n_dims <- c(4, 8) phi <- c(0.8, 0.9) Q <- make_Q(n_dims, phi) ## plot the precision matrix structure at each resolution layout(matrix(1:2, 1, 2)) spam::display(Q[[1]]) spam::display(Q[[2]])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.