get.wpost {icmm}R Documentation

Estimate posterior probability of mixing weight.

Description

With the Ising prior on structured predictors, this function gets the posterior probability of mixing weight.

Usage

get.wpost(SS, beta, alpha, hyperparam, structure, edgeind, j)

Arguments

SS

a scalar value of sufficient statistic for regression coefficient.

beta

a (p*1) matrix of regression coefficients.

alpha

a scalar value of hyperparameter alpha.

hyperparam

a two-dimensional vector of hyperparameters a and b.

structure

a data frame stores the information of structure among predictors.

edgeind

a vector stores primary keys of structure.

j

an index ranges from 1 to p. This function estimates a posterior probability of a mixing weight corresponding to predictor j.

Details

With the Ising prior on structured predictors, the problem is transformed into the realm of empirical Bayes thresholding with Laplace prior by estimating the posterior probability of mixing weight. The posterior probability is used to find the posterior median of a regression coefficient.

Value

Return a scalar value of a posterior probability of mixing weight for predictor.

Author(s)

Vitara Pungpapong, Min Zhang, Dabao Zhang

Examples

data(simGaussian)
Y<-as.matrix(simGaussian[,1])
X<-as.matrix(simGaussian[,-1])
n<-dim(X)[1]
data(linearrelation)
edgeind<-sort(unique(linearrelation[,1]))
# Obtain initial values from lasso
data(initbetaGaussian)
beta<-as.matrix(initbetaGaussian)
# Initiate all other parameters
alpha<-0.5
sigma<-get.sigma(Y=Y, X=X, beta=beta, alpha=alpha)
hyperparam<-get.ab(beta, linearrelation, edgeind)
# Estimate the posterior probability of first predictor
j<-1
Yres<-Y-X%*%beta+X[,j]*beta[j,1]
sxy<-t(Yres)%*%X[,j]
ssx<-sum(X[,j]^2)
SS<-sqrt(n-1)*sxy/(sigma*ssx)
wpost<-get.wpost(SS=SS, beta=beta, alpha=alpha, hyperparam=hyperparam, 
       structure=linearrelation, edgeind=edgeind, j=j)

[Package icmm version 1.2 Index]