get.full.posterior: Approximation Posterior Expectations from Mr.ASH Fit

View source: R/misc.R

get.full.posteriorR Documentation

Approximation Posterior Expectations from Mr.ASH Fit

Description

Recover the parameters specifying the variational approximation to the posterior distribution of the regression coefficients. To streamline the model fitting implementation, and to reduce memory requirements, mr.ash does not store all the parameters needed to specify the approximate posterior.

Usage

get.full.posterior(fit)

Arguments

fit

A Mr.ASH fit obtained, for example, by running mr.ash.

Value

A list object with the following elements:

phi

An p x K matrix containing the posterior assignment probabilities, where p is the number of predictors, and K is the number of mixture components. (Each row of phi should sum to 1.)

m

An p x K matrix containing the posterior means conditional on assignment to each mixture component.

s2

An p x K matrix containing the posterior variances conditional on assignment to each mixture component.

Examples

## generate synthetic data
set.seed(1)
n           = 200
p           = 300
X           = matrix(rnorm(n*p),n,p)
beta        = double(p)
beta[1:10]  = 1:10
y           = X %*% beta + rnorm(n)

## fit mr.ash
fit.mr.ash  = mr.ash(X, y)

## recover full posterior
full.post   = get.full.posterior(fit.mr.ash)


stephenslab/mr.ash.alpha documentation built on Oct. 31, 2023, 4:21 p.m.