Last updated: 2017-05-31

Code version: 71d3478

Introduction

Comparison of Lasso and elastic net (both glmnet), Bayesian bridge (BayesBridge), spike-and-slab priors (BoomSpikeSlab), and SBR on the diabetes data set.

library(lars)
library(glmnet)
library(BoomSpikeSlab)
library(BayesBridge)
source("../code/SBRr.R")
data("diabetes")
X = diabetes$x
y = diabetes$y
y = y - mean(y)
X2 = diabetes$x2

Results

Variable selection

### LASSO
sel.lasso
 [1] "sex"     "bmi"     "map"     "hdl"     "ltg"     "glu"     "age^2"  
 [8] "bmi^2"   "glu^2"   "age:sex" "age:map" "age:ltg" "age:glu" "bmi:map"
### Elastic Net
sel.enet
 [1] "sex"     "bmi"     "map"     "hdl"     "ltg"     "glu"     "age^2"  
 [8] "bmi^2"   "glu^2"   "age:sex" "age:map" "age:ltg" "age:glu" "sex:map"
[15] "bmi:map"
### Spike & Slab
sel.sns
[1] "sex"     "bmi"     "map"     "hdl"     "ltg"     "age:sex"
### SBR
sel.sbr
[1] "sex"     "bmi"     "map"     "hdl"     "ltg"     "glu^2"   "age:sex"
[8] "bmi:map"

Variable Estimation

Estimated by BayesBridge

beta.sel.bridge
        sex         bmi         map         hdl         ltg         glu 
-187.220611  521.446979  290.986603 -200.901374  491.400663   34.096183 
      age^2       bmi^2       glu^2     age:sex     age:map     age:ltg 
  18.273652   46.329517   96.197398  152.909847   35.342764   82.393787 
    age:glu     sex:map     bmi:map 
   4.276401   18.655936   92.034007 

Session information

sessionInfo()
R version 3.3.3 (2017-03-06)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS Sierra 10.12.5

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] BayesBridge_0.6     BoomSpikeSlab_0.7.0 Boom_0.5           
[4] MASS_7.3-45         glmnet_2.0-5        foreach_1.4.3      
[7] Matrix_1.2-8        lars_1.2           

loaded via a namespace (and not attached):
 [1] Rcpp_0.12.10     codetools_0.2-15 lattice_0.20-34  digest_0.6.12   
 [5] rprojroot_1.2    grid_3.3.3       backports_1.0.5  git2r_0.18.0    
 [9] magrittr_1.5     evaluate_0.10    stringi_1.1.2    rmarkdown_1.5   
[13] iterators_1.0.8  tools_3.3.3      stringr_1.2.0    yaml_2.1.14     
[17] htmltools_0.3.6  knitr_1.15.1    

This R Markdown site was created with workflowr