## set seed value
set.seed(66)
## set dimension of problem
n <- 200
k <- 4
## set parameter values
beta <- c(-1,-.5,0,2.5)
## simulate Laplace distributed data
X <- cbind(1,matrix(runif(n=n*(k-1)),nrow=n))
y <- X%*%beta
Vo1 <- rgamma(n=n,shape=1,scale=2)
ystar <- y + sqrt(Vo1)*rnorm(n=n)
y <- ifelse(ystar>0,1,0)
table(y)
## prepare the inputs
Data <- list(y=y,X=X,p=.5)
Prior <- list(lambda_shape=.01,lambda_scale=.01)
Mcmc <- list(R=5000,keep=1)
## estimate the parameters
out <- QRb.AL(Data=Data,Prior=Prior,Mcmc=Mcmc)
## calculate posterior median and credible intervals
apply(out$betadraw,FUN=quantile,MARGIN=2,prob=c(.025,.5,.975))Run the code above in your browser using DataLab