BayesianLasso: A Bayesian Lasso Regression function with gibbs sampling

Description Usage Arguments Value References Examples

View source: R/StatComp21038R.R

Description

A function that can complete the Bayesian Lasso Regression and can use empirical bayes and hyperpriors method.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
BayesianLasso(
  x,
  y,
  center = T,
  scale = T,
  a=1,
  b=1,
  n.max = 10000,
  E = TRUE,
  r = 1,
  d = 1
)

Arguments

x

predictor variables

y

response variable

center

TRUE/FALSE (default: TRUE, if the design matrix x has been centered)

scale

TRUE/FALSE (default: TRUE, if the design matrix x has been scaled)

a, b

parameter of sigma2's prior, default 1,1, if a=0,b=0, means the prior of sigma2 is 1/sigma2

n.max

n of interations (default: 10000)

E

TRUE/FALSE (default: TRUE, estimating lambda by empircal bayes; FALSE, estimating lambda by Hyperprior method.)

r, d

hyper-Gamma prior for lambda^2 if E = FALSE

Value

beta: the median of matrix Beta.

tau2: the median of matrix Tau2

sigma2: the median of vector Sigma2

lambda: the median of vector Lambda

References

Park, Trevor, and George Casella. "The bayesian lasso." Journal of the American Statistical Association 103.482 (2008): 681-686.

Examples

1
2
3
4
5
6
7
8
## Not run: 
data(Data)
attach(Data)
x<-Data$diabetes.x
y<-Data$diabetes.y
BayesianLasso(x,y,a=0,b=0)

## End(Not run)

USTCLifengLiu/StatComp21038 documentation built on Dec. 23, 2021, 10:18 p.m.