Description Usage Arguments Value Examples
This function is the baysian linear regression version of the algorithm proposed in Bhattacharya et al. (2015). The function is fast because we use fast sampling method compute posterior samples. The method proposed in Bhattacharya et al. (2015) is used in the second step perfectly solving the large p problem. The local shrinkage controlling parameter psi_j are updated via a slice sampling scheme given by Polson et al. (2014). And the parameters phi_j have various inverse gaussian distribution. We generate variates with transformation into multiple roots by Michael et al. (1976).
1 | dl(x, y, burn = 5000, nmc = 5000, thin = 1, hyper = 1/2)
|
x |
input matrix, each row is an observation vector, dimension n*p. |
y |
Response variable, a n*1 vector. |
burn |
Number of burn-in MCMC samples. Default is 5000. |
nmc |
Number of posterior draws to be saved. Default is 5000. |
thin |
Thinning parameter of the chain. Default is 1 means no thinning. |
hyper |
The value of hyperparameter in the prior, can be [1/max(n,p),1/2]. It controls local shrinkage scales through psi. Small values of hyperparameter would lead most of the result close to zero; while large values allow small singularity at zero. We give a method and a function to tuning this parameter. See the function called "dlhyper" for details. |
betamatrix |
Posterior samples of beta. A large matrix (nmc/thin)*p |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ## 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)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.