Learn R Programming

icmm (version 1.2)

get.zeta.ising: Local posterior probability estimation.

Description

This function estimates the local posterior probability when assuming Ising prior on structured predictors.

Usage

get.zeta.ising(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 estimate a local posterior probability of predictor j.

Value

Return a scalar value of local posterior probability.

Details

Given all other parameters, this function estimates the local posterior probability or the probability that a regression coefficient is not zero conditional on other par ameters. This function is called when assuming Ising prior on structured predictors.

Examples

Run this code
# NOT RUN {
data(simGaussian)
data(linearrelation)
Y<-as.matrix(simGaussian[,1])
X<-as.matrix(simGaussian[,-1])
n<-dim(X)[1]
# Obtain initial values from lasso
data(initbetaGaussian)
initbeta<-as.matrix(initbetaGaussian)
# Get final output from ebvs
# }
# NOT RUN {
output<-icmm(Y, X, b0.start=0, b.start=initbeta, family = "gaussian", 
        ising.prior = TRUE, structure=linearrelation, estalpha = FALSE, 
        alpha = 0.5, maxiter = 100)
# }
# NOT RUN {
b0<-output$coef[1]
# }
# NOT RUN {
beta<-matrix(output$coef[-1], ncol=1)
# }
# NOT RUN {
# Get all parameters for function arguments
# }
# NOT RUN {
w<-get.wprior(beta)
# }
# NOT RUN {
alpha<-0.5
# }
# NOT RUN {
sigma<-get.sigma(Y,X,beta,alpha)
# }
# NOT RUN {
edgeind<-sort(unique(linearrelation[,1]))
# }
# NOT RUN {
hyperparam<-get.ab(beta, linearrelation, edgeind)
# }
# NOT RUN {
# Estimate local posterior probability
# }
# NOT RUN {
j<-1
# }
# NOT RUN {
Yres<-Y-b0-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 {
zeta<-get.zeta.ising(SS=SS, beta=beta, alpha=alpha, hyperparam=hyperparam, 
      structure=linearrelation, edgeind=edgeind, j=j)
# }

Run the code above in your browser using DataLab