dlvs: Function to do Bayesian variable selection via penalized...

Description Usage Arguments Value Examples

Description

This is a function using the algorithm doing variable selection via penalized credible interval proposed by Bondell et al. (2012). The computation of the proposed sequence is doing matrix computing and using existing LASSO software.

Usage

1
dlvs(dlresult)

Arguments

dlresult

Posterior samples of beta. A large matrix (nmc/thin)*p

Value

betatil

Variable selection result of beta, a p*1 vector. Most of the values shrinks to 0

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
## Not run: 
 rho=0.5
  p=1000
  n=100
  #set up correlation matrix
  m<-matrix(NA,p,p)
  for(i in 1:p){
    for(j in i:p)
      m[i,j]=rho^(j-i)}
  m[lower.tri(m)]<-t(m)[lower.tri(m)]
  #generate x
  library("mvtnorm")
  x=rmvnorm(n,mean=rep(0,p),sigma=m)
  #generate beta
  beta=c(rep(0,10),runif(n=5,min=-1,max=1),rep(0,20),runif(n=5,min=-1,max=1),rep(0,p-40))
  #generate y
  y=x%*%beta+rnorm(n)
  hyper=dlhyper(x,y)
  dlresult=dl(x,y,hyper=hyper)
  dlvs(dlresult)
## End(Not run)

xylimeng/BayesianVariableSelection documentation built on May 4, 2019, 3:19 p.m.