Description Usage Arguments Details Value
View source: R/rpost_regression_coef.R
Generate a N(μ, Σ) random variable where
Σ = (X^tX + D^{-1})^{-1},
μ = Σ X^t α.
The algorithm is O(np^2); for large p it performs fast.
1 2 3 4 5 | rpost_regression_coef <- function(
X,
D,
alpha,
u = NULL)
|
X |
n by p matrix |
D |
p by p matrix |
alpha |
n by 1 vector |
u |
Optional. If specified, don't generate u \sim N(0, D). |
The algorithm is from
Bhattacharya, Anirban, Antik Chakraborty, and Bani K. Mallick. "Fast sampling with Gaussian scale mixture priors in high-dimensional regression." Biometrika (2016): asw042.
The algorithm is as follows:
1. Sample u \sim N(0, D), d \sim N(0, I_n)
2. Set v = Xu + d
3. Solve (XDX^t + I_n)w = (α - v)
4. Return β = u + DX^tw
beta |
An p x 1 vector |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.