Learn R Programming

icmm (version 1.2)

get.beta.ising: Obtain a regression coefficient when assuming Ising prior (with structured predictors).

Description

Given a sufficient statistic for a regression coefficient, this function estimates a coefficient when assuming the Ising model to incorporate the prior of structured predictors.

Usage

get.beta.ising(SS, wpost, alpha, scaledfactor)

Arguments

SS

a sufficient statistic for a regression coefficient.

wpost

a posterior probability of mixing weight.

alpha

a scalar value for hyperparameter alpha.

scaledfactor

a scalar value for multiplicative factor.

Value

a scalar value of regression coefficient.

Details

Given a posterior probability of mixing weight, empirical Bayes thresholding is employed to obtain a posterior median of a regression coefficient.

Examples

Run this code
# NOT RUN {
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
# }
# NOT RUN {
sigma<-get.sigma(Y=Y, X=X, beta=beta, alpha=alpha)
# }
# NOT RUN {
hyperparam<-get.ab(beta, linearrelation, edgeind)
# }
# NOT RUN {
# Obtain regression coefficient
# }
# NOT RUN {
j<-1
# }
# NOT RUN {
Yres<-Y-X%*%beta+X[,j]*beta[j,1]
# }
# NOT RUN {
sxy<-t(Yres)%*%X[,j]
# }
# NOT RUN {
ssx<-sum(X[,j]^2)
# }
# NOT RUN {
SS<-sqrt(n-1)*sxy/(sigma*ssx)
# }
# NOT RUN {
wpost<-get.wpost(SS, beta, alpha, hyperparam, linearrelation, edgeind, j)
# }
# NOT RUN {
beta[j,1]<-get.beta.ising(SS=SS, wpost=wpost, alpha=alpha, 
           scaledfactor=sigma/sqrt(n-1))
# }

Run the code above in your browser using DataLab