Bayespredmse: Prediction or MSE

Description Usage Arguments Value References Examples

View source: R/StatComp21038R.R

Description

A function that can complete the Bayesian Lasso Regression and get the prediction or MSE.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
Bayespredmse(
  x,
  y,
  x1 = as.matrix(0, 1, 1),
  center = T,
  scale = T,
  a = 1,
  b = 1,
  n.max = 10000,
  E = TRUE,
  r = 1,
  d = 1,
  pred = T
)

Arguments

x

predictor variables

y

response variable

x1

a matrix which should be given if pred = T

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

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

pred

TRUE/FALSE (default: TRUE, we need the prediction; FALSE, we need the MSE)

Value

pred: the prediction

MSE: the MSE

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
Bayespredmse(x,y,a=0,b=0,pred=F)

## End(Not run)

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