BayesPen-package: Bayesian Penalized Credible Regions

Description Details Author(s) References Examples

Description

Performs the Bayesian penalized credible regions methods for variable selection (Bondell and Reich 2012) and confounder selection (Wilson and Reich 2014). The solution path can be computed from the posterior mean and covariance matrix for a variety of models. The function BayesPen performs confounder or variable selection from the posterior means and covariances of a Bayesian regression model. The wrapper functions BayesPen.lm and BayesPen.lm.confounders fit linear models with code based on the BLM package (Campos and Rodriguez 2012) and run BayesPen together in one step.

Details

Package: BayesPen
Type: Package
Version: 1.1
Date: 2014-02-16
License: GPL (>= 2)

Author(s)

Ander Wilson, Howard D. Bondell, and Brian J. Reich

Maintainer: Ander Wilson <awilson@hsph.harvard.edu>

References

Bondell, H. D. and Reich, B. J. (2012). Consistent high-dimensional Bayesian variable selection via penalized credible regions. J. Am. Statist. Assoc. 107, 1610-1624.

Wilson A., Reich B. J. (2014). Confounder selection via penalized credible regions. Biometrics 70: 852-861.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
######################
#Variable Selection
set.seed(1234)
dat <- SimExample(500,model="BR1")
X <- dat$X
y <- dat$y

#fit the full model assuming flat priors on beta
fit1 <- lm(y~X-1)
betahat <- coef(fit1)
cov <- vcov(fit1)

#find solution path
fit.BayesPen <- BayesPen(beta=betahat, beta_cov=cov)

#refit the model
refit <- BayesPen.refit(y,X,fit.BayesPen)

#plot it
BayesPen.plot(refit)


######################
#Confounder Selection
set.seed(1234)
dat <- SimExample(500,model="WPD2")
X <- dat$X
U <- dat$U
W <- cbind(X,U)
y <- dat$y

#fit the full outcome model assuming flat priors on beta
fit1 <- lm(y~W-1)
betahat <- coef(fit1)
cov <- vcov(fit1)

#fit the full exposure model assuming flat priors on beta
fit2 <- lm(X~U-1)
gammahat <- coef(fit2)

#find solution path
fit.BayesPen <- BayesPen(beta=betahat, beta_cov=cov, confounder.weights=c(0,gammahat), force=1)

#refit the model
refit <- BayesPen.refit(y,W,fit.BayesPen)

#plot it
BayesPen.plot(refit)

AnderWilson/BayesPen documentation built on May 5, 2019, 4:56 a.m.