rpost_regression_coef: Generate posterior for regression coefecients

Description Usage Arguments Details Value

View source: R/rpost_regression_coef.R

Description

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.

Usage

1
2
3
4
5
rpost_regression_coef <- function(
  X,
  D,
  alpha,
  u = NULL)

Arguments

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).

Details

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

Value

beta

An p x 1 vector


dcbdan/s525 documentation built on May 19, 2019, 10:48 p.m.