Last updated: 2020-03-17

Checks: 5 1

Knit directory: mr-ash-workflow/

This reproducible R Markdown analysis was created with workflowr (version 1.3.0). The Checks tab describes the reproducibility checks that were applied when the results were created. The Past versions tab lists the development history.


The R Markdown is untracked by Git. To know which version of the R Markdown file created these results, you’ll want to first commit it to the Git repo. If you’re still working on the analysis, you can ignore this warning. When you’re finished, you can run wflow_publish to commit the R Markdown file and build the HTML.

Great job! The global environment was empty. Objects defined in the global environment can affect the analysis in your R Markdown file in unknown ways. For reproduciblity it’s best to always run the code in an empty environment.

The command set.seed(20191007) was run prior to running the code in the R Markdown file. Setting a seed ensures that any results that rely on randomness, e.g. subsampling or permutations, are reproducible.

Great job! Recording the operating system, R version, and package versions is critical for reproducibility.

Nice! There were no cached chunks for this analysis, so you can be confident that you successfully produced the results during this run.

Great! You are using Git for version control. Tracking code development and connecting the code version to the results is critical for reproducibility. The version displayed above was the version of the Git repository at the time these results were generated.

Note that you need to be careful to ensure that all relevant files for the analysis have been committed to Git prior to generating the results (you can use wflow_publish or wflow_git_commit). workflowr only checks the R Markdown file, but you know if there are other scripts or data files that it depends on. Below is the status of the Git repository when the results were generated:


Ignored files:
    Ignored:    .Rhistory
    Ignored:    .Rproj.user/

Untracked files:
    Untracked:  .DS_Store
    Untracked:  .gitignore
    Untracked:  analysis/Figure1_Sourcecode.Rmd
    Untracked:  analysis/Figure2_Plot.Rmd
    Untracked:  analysis/Figure2_Sourcecode.Rmd
    Untracked:  analysis/Figure3_Plot.Rmd
    Untracked:  analysis/Figure3_Sourcecode.Rmd
    Untracked:  analysis/Figure4_Plot.Rmd
    Untracked:  analysis/Figure5_Plot.Rmd
    Untracked:  analysis/Figure6_Plot.Rmd
    Untracked:  analysis/Figure6_Sourcecode.Rmd
    Untracked:  backup/
    Untracked:  docs/figure/Figure3_Plot.Rmd/
    Untracked:  figure1_for_paper.pdf
    Untracked:  figure2_for_paper.pdf
    Untracked:  figure3_for_paper.pdf
    Untracked:  figure4_for_paper.pdf
    Untracked:  figure5_for_paper.pdf
    Untracked:  figure6_for_paper.pdf
    Untracked:  results/fig1_1.RDS
    Untracked:  results/scenario1.RDS
    Untracked:  results/scenario10.RDS
    Untracked:  results/scenario11.RDS
    Untracked:  results/scenario2.RDS
    Untracked:  results/scenario3.RDS
    Untracked:  results/scenario4.RDS
    Untracked:  results/scenario5.RDS
    Untracked:  results/scenario6.RDS
    Untracked:  results/scenario7.RDS
    Untracked:  results/scenario8.RDS
    Untracked:  results/scenario9.RDS

Unstaged changes:
    Deleted:    MR.ASH.Rmd
    Deleted:    Plots_for_paper.Rmd
    Modified:   README.md
    Modified:   analysis/.DS_Store
    Deleted:    analysis/Plots_for_paper.Rmd
    Deleted:    analysis/Result10_Correlation.Rmd
    Deleted:    analysis/Result11_UpdateOrder.Rmd
    Deleted:    analysis/Result12_Initialization.Rmd
    Deleted:    analysis/Result13_LocalCorrelation.Rmd
    Deleted:    analysis/Result15_EstimationOfSigma.Rmd
    Deleted:    analysis/Result16.Rmd
    Deleted:    analysis/Result19_Design.Rmd
    Deleted:    analysis/Result1_Ridge.Rmd
    Deleted:    analysis/Result25_SignalShape.Rmd
    Deleted:    analysis/Result2_Nonconvex.Rmd
    Deleted:    analysis/Result35_CrossValidation.Rmd
    Deleted:    analysis/Result3_Sparse.Rmd
    Deleted:    analysis/Result4_Highdim.Rmd
    Deleted:    analysis/Result5_SparseSignal.Rmd
    Deleted:    analysis/Result6_PVE.Rmd
    Deleted:    analysis/Result7_LowdimIndepGauss.Rmd
    Deleted:    analysis/Result8_RealGenotype.Rmd
    Deleted:    analysis/Result9_Changepoint.Rmd
    Deleted:    analysis/Results105_Correlation2.Rmd
    Deleted:    analysis/Results17_AccuracyofVariational.Rmd
    Modified:   code/sim_wrapper.R
    Deleted:    dsc/Makefile
    Deleted:    dsc/explore_results.R
    Deleted:    dsc/functions/fit.R
    Deleted:    dsc/functions/predict.R
    Deleted:    dsc/functions/score.R
    Deleted:    dsc/functions/simulate.R
    Deleted:    dsc/modules/fit/elastic_net.R
    Deleted:    dsc/modules/fit/lasso.R
    Deleted:    dsc/modules/fit/mr_ash.R
    Deleted:    dsc/modules/fit/ridge.R
    Deleted:    dsc/modules/fit/varbvs.R
    Deleted:    dsc/modules/predict/predict_linear.R
    Deleted:    dsc/modules/score/rsse.R
    Deleted:    dsc/modules/simulate/sparse_normal.R
    Deleted:    dsc/modules/simulate/sparse_t.R
    Deleted:    dsc/mr_ash.dsc
    Deleted:    figure/Plots_for_paper.Rmd/.figure1-1.png-DbQE
    Deleted:    figures/figure0_paper.pdf
    Deleted:    figures/figure10_paper.pdf
    Deleted:    figures/figure12_paper.pdf
    Deleted:    figures/figure1_paper.pdf
    Deleted:    figures/figure2_paper.pdf
    Deleted:    figures/figure3_paper.pdf
    Deleted:    figures/figure4_paper.pdf
    Deleted:    figures/figure5_paper.pdf
    Deleted:    figures/figure6_paper.pdf
    Deleted:    figures/figure7_paper.pdf
    Deleted:    figures/figure8_paper.pdf
    Deleted:    figures/figure9_paper.pdf
    Modified:   results/.DS_Store
    Deleted:    results/.Rapp.history
    Deleted:    results/BayesLinReg1.RDS
    Deleted:    results/BayesLinReg2.RDS
    Deleted:    results/BayesShape1.RDS
    Deleted:    results/CaisaMethods.RDS
    Deleted:    results/Ridge_for_paper.RDS
    Deleted:    results/blockacc50020.RDS
    Deleted:    results/changepoint1.RDS
    Deleted:    results/changepoint2.RDS
    Deleted:    results/design.RDS
    Deleted:    results/design4.RDS
    Deleted:    results/diffpve.RDS
    Deleted:    results/diffpve500200020.RDS
    Deleted:    results/diffrho.RDS
    Deleted:    results/dsc.RData
    Deleted:    results/ecorr5001000020.RDS
    Deleted:    results/ecorr500200020.RDS
    Deleted:    results/ecorr50020020.RDS
    Deleted:    results/equicorr.RDS
    Deleted:    results/equicorr100050020.RDS
    Deleted:    results/equicorr20.RDS
    Deleted:    results/equicorr30.RDS
    Deleted:    results/equicorr40.RDS
    Deleted:    results/equicorr50.RDS
    Deleted:    results/equicorr500200020.RDS
    Deleted:    results/equicorr50020020.RDS
    Deleted:    results/equicorrfdr500200020.RDS
    Deleted:    results/equicorrfdr50020020.RDS
    Deleted:    results/equicorrnew500200020.RDS
    Deleted:    results/equicorrnew50020020.RDS
    Deleted:    results/estsigma.RDS
    Deleted:    results/highdim2.RDS
    Deleted:    results/highdim25020.RDS
    Deleted:    results/highdim50020
    Deleted:    results/highdim50020.RDS
    Deleted:    results/highdim_pve0.5.RDS
    Deleted:    results/highdimdiffnpnew.RDS
    Deleted:    results/highdimdiffp2.RDS
    Deleted:    results/highdimresults.RDS
    Deleted:    results/initialization.RDS
    Deleted:    results/initialization1.RDS
    Deleted:    results/initialization500200020.RDS
    Deleted:    results/initialization50020020.RDS
    Deleted:    results/initialization50020020.RDS.backup
    Deleted:    results/largen200020.RDS
    Deleted:    results/largen20020.RDS
    Deleted:    results/localcorr.RDS
    Deleted:    results/localcorr100050020.RDS
    Deleted:    results/localcorr20.RDS
    Deleted:    results/localcorr40.RDS
    Deleted:    results/localcorr50.RDS
    Deleted:    results/localcorr500200020.RDS
    Deleted:    results/localcorr50020020.RDS
    Deleted:    results/localcorrfdr500200020.RDS
    Deleted:    results/localcorrfdr50020020.RDS
    Deleted:    results/mcmc50020.RDS
    Deleted:    results/mcmc50020.RDS.backup
    Deleted:    results/mcmccorr500200020.RDS
    Deleted:    results/mcmcecorr500200020.RDS
    Deleted:    results/mcmcecorr50020020.RDS
    Deleted:    results/mcmcecorr50020020.RDS.backup
    Deleted:    results/newhighdim.RDS
    Deleted:    results/newridge10.RDS
    Deleted:    results/newridge20.RDS
    Deleted:    results/newupdateorder_rho0.95.RDS
    Deleted:    results/nonconvexnew.RDS
    Deleted:    results/onebigchange1.RDS
    Deleted:    results/onesmallchange1.RDS
    Deleted:    results/onesmallchange2.RDS
    Deleted:    results/pve100050020.RDS
    Deleted:    results/pve5001000020.RDS
    Deleted:    results/pve5001000020.RDS.backup
    Deleted:    results/pve500200020.RDS
    Deleted:    results/pve500200020.RDS.backup
    Deleted:    results/pve50020020.RDS
    Deleted:    results/pve50020020.RDS.backup
    Deleted:    results/realgenotype+random.RDS
    Deleted:    results/realgenotype.RDS
    Deleted:    results/realgenotype22.RDS
    Deleted:    results/realgenotype_pve0.5.RDS
    Deleted:    results/realgenotypepve.RDS
    Deleted:    results/ridge1.RDS
    Deleted:    results/ridge2.RDS
    Deleted:    results/ridge_pve0.5.RDS
    Deleted:    results/ridgediffnp copy.RDS
    Deleted:    results/ridgediffnp.RDS
    Deleted:    results/signalshape100050020.RDS
    Deleted:    results/signalshape25
    Deleted:    results/signalshape25.RDS
    Deleted:    results/signalshape30.RDS
    Deleted:    results/signalshape50.RDS
    Deleted:    results/signalshape500200020.RDS
    Deleted:    results/signalshape500200020.RDS.backup
    Deleted:    results/signalshape50020020.RDS
    Deleted:    results/signalshape50020020.RDS.backup
    Deleted:    results/signalshape_pve0.99.RDS
    Deleted:    results/signalshapetotal.RDS
    Deleted:    results/sparse50010000.RDS
    Deleted:    results/sparsediffnp.RDS
    Deleted:    results/sparsesignal.RDS
    Deleted:    results/sparsesignal_pve0.5.RDS
    Deleted:    results/sparsity50010000.RDS
    Deleted:    results/sparsity50010000.RDS.backup
    Deleted:    results/sparsity500200.RDS
    Deleted:    results/sparsity5002000.RDS
    Deleted:    results/sparsity5002000.RDS.backup
    Deleted:    results/sparsity500200020.RDS
    Deleted:    results/sparsity50020020.RDS
    Deleted:    results/sparsityconst50010000.RDS
    Deleted:    results/sparsityconst500200.RDS
    Deleted:    results/sparsityconst5002000.RDS
    Deleted:    results/subogdancandes.RDS
    Deleted:    results/subogdancandes1010100020.RDS
    Deleted:    results/subogdancandesnew.RDS
    Deleted:    results/temp1.RDS
    Deleted:    results/updateg.RDS
    Deleted:    results/updateorder500200020.RDS
    Deleted:    results/updateorder500200020.RDS.backup
    Deleted:    results/updateorder50020020.RDS
    Deleted:    results/updateorder_rho0.95.RDS
    Deleted:    results/updateordernew1.RDS
    Deleted:    results/updateordernew2.RDS

Note that any generated files, e.g. HTML, png, CSS, etc., are not included in this status report because it is ok for generated content to have uncommitted changes.


There are no past versions. Publish this analysis with wflow_publish() to start tracking its development.


library(ggplot2); library(cowplot);
## function for color
gg_color_hue <- function(n) {
  hues = seq(15, 375, length = n + 1)
  hcl(h = hues, l = 65, c = 100)[1:n]
}

Figure

Scenario 11

Scenario 11 (Varying \(p\)): \(n = \textrm{500}\), \(p \in [\textrm{20},\textrm{20,000}]\), \(s = \textrm{20}\), \(\textrm{Design} = \textrm{IndepGauss}\), \(\textrm{PVE} = 0.5\) and \(\textrm{SignalShape} = \textrm{PointNormal}\).

res_df       = readRDS("results/scenario11.RDS")
method_list  = c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE","E-NET","Lasso",
                 "Ridge","SCAD.2tuning","MCP.2tuning","SCAD.1tuning","MCP.1tuning","L0Learn")
df           = data.frame()
p_range      = c(20,50,100,200,500,1000,2000,5000,10000,20000)
for (i in 1:10) {
res_df[[i]]$fit   = rep(method_list, each = 20)
res_df[[i]]$fit   = factor(res_df[[i]]$fit, levels = method_list)
df                = rbind(df, data.frame(pred = c(colMeans(matrix(res_df[[i]]$pred, 20, 13))),
                                         time2 = apply(matrix(res_df[[i]]$time, 20, 13), 2, median),
                                         time = c(colMeans(matrix(res_df[[i]]$time, 20, 13))),
                                         p    = p_range[i],
                                         fit  = method_list))
}
df$fit = factor(df$fit, levels = method_list)
df = df[df$fit %in% c("Mr.ASH","E-NET","Lasso","Ridge","SCAD.2tuning",
                      "MCP.2tuning","SCAD.1tuning","MCP.1tuning","L0Learn"),]
df = df[df$p %in% c(20,50,200,500,1000,2000,10000,20000),]
df$size = 0.5
df$size[1:8] = 1.2
col   = gg_color_hue(13)[c(1:6,5,6,7)]
df$lt = "solid"
df$lt[49:64] = "dashed"
shape = c(19,17,24,25,9,3,11,4,5,7,8,10,1)[c(1:6,5,6,7)]
p1    = ggplot(df) + geom_line(aes(x = p, y = pred, color = fit), size = df$size, linetype = df$lt) +
  geom_point(aes(x = p, y = pred, color = fit, shape = fit), size = 2.5) +
  theme_cowplot(font_size = 22) +
  scale_x_continuous(trans = "log10", breaks = c(20,50,200,500,1000,2000,10000,20000)) +
  labs(y = "predictior error (rmse / sigma)", x = "number of coefficients (p)") +
  theme(axis.line = element_blank(),
        plot.title = element_text(hjust = 0.5),
        axis.title.x = element_blank(),
        axis.text.x  = element_text(angle = 45,hjust = 1),
        axis.title.y = element_blank()) +
  scale_color_manual(values = col) +
  scale_shape_manual(values = shape) +
  scale_y_continuous(trans = "log10", breaks = c(1,1.1,1.2,1.3,1.4)) +
  coord_cartesian(ylim = c(1,1.3))
fig_dummy4 = p1
fig_main = p1 + theme(legend.position = "none")
suptitle   = ggdraw() + draw_label("Varying p", fontface  = 'bold', size = 14) 
subtitle   = ggdraw() + draw_label("Scenario: IndepGauss + PointNormal, n = 500, p = 20-20000, s = 20, pve = 0.5", fontface  = 'bold', size = 14) 
fig11_1    = plot_grid(fig_main, ncol = 1, rel_heights = c(0.05,0.95))
res_df       = readRDS("results/scenario11.RDS")
method_list  = c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE","E-NET","Lasso",
                 "Ridge","SCAD.2tuning","MCP.2tuning","SCAD.1tuning","MCP.1tuning","L0Learn")
df           = data.frame()
p_range      = c(20,50,100,200,500,1000,2000,5000,10000,20000)
for (i in 1:10) {
res_df[[i]]$fit   = rep(method_list, each = 20)
res_df[[i]]$fit   = factor(res_df[[i]]$fit, levels = method_list)
df                = rbind(df, data.frame(pred = c(colMeans(matrix(res_df[[i]]$pred, 20, 13))),
                                         time2 = apply(matrix(res_df[[i]]$time, 20, 13), 2, median),
                                         time = c(colMeans(matrix(res_df[[i]]$time, 20, 13))),
                                         p    = p_range[i],
                                         fit  = method_list))
}
df$fit = factor(df$fit, levels = method_list)
df = df[df$fit %in% c("Mr.ASH","E-NET","Lasso","Ridge","SCAD.2tuning",
                      "MCP.2tuning","SCAD.1tuning","MCP.1tuning","L0Learn"),]
df$size = 0.5
df$size[1:5] = 1.2; df$size[46:50] = 1.2;
col   = gg_color_hue(13)[c(1:6,5,6,7)]
df$lt = "solid"
df$lt[c(31:40,76:85)] = "dashed"
shape = c(19,17,24,25,9,3,11,4,5,7,8,1,2,6)[c(1:6,5,6,7)]
p1    = ggplot() + geom_line(aes(x = df$p[df$p <= 500], y = df$time[df$p <= 500], color = df$fit[df$p <= 500]),
                                 size = df$size[df$p <= 500], linetype = df$lt[df$p <= 500]) +
  geom_point(aes(x = df$p[df$p <= 500], y = df$time[df$p <= 500], color = df$fit[df$p <= 500],
                 shape = df$fit[df$p <= 500]), size = 2.5) +
  scale_color_manual(values = col) +
  scale_shape_manual(values = shape)
fig_main = p1 + geom_line(aes(x = df$p[df$p > 500], y = df$time[df$p > 500], color = df$fit[df$p > 500]),
                              size = df$size[df$p > 500], linetype = df$lt[df$p > 500]) + 
    geom_point(aes(x = df$p[df$p > 500], y = df$time[df$p > 500], color = df$fit[df$p > 500],
                   shape = df$fit[df$p > 500]), size = 2.5) +
  theme_cowplot(font_size = 22) +
  scale_x_continuous(trans = "log10", breaks = p_range) +
  labs(y = "computation time (seconds)", x = "number of nonzero coefficients (s)") +
  theme(axis.line = element_blank(),
        plot.title = element_text(hjust = 0.5),
        legend.position = "none",
        axis.title.x = element_blank(),
        axis.text.x  = element_text(angle = 45,hjust = 1),
        axis.title.y = element_blank()) +
  scale_y_continuous(trans = "log10", breaks = c(0.01,0.1,1,10,100)) +
  coord_cartesian(ylim = c(0.01,300))
subtitle   = ggdraw() + draw_label("Computation Time (seconds)", fontface = 'bold', size = 14) 
fig11_2    = plot_grid(fig_main, ncol = 1, rel_heights = c(0.05,0.95))
res_df       = readRDS("./results/scenario11.RDS")
method_list  = c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE","E-NET","Lasso",
                 "Ridge","SCAD.2tuning","MCP.2tuning","SCAD.1tuning","MCP.1tuning","L0Learn")
df           = data.frame()
p_range      = c(20,50,100,200,500,1000,2000,5000,10000,20000)
for (i in 1:10) {
res_df[[i]]$fit   = rep(method_list, each = 20)
res_df[[i]]$fit   = factor(res_df[[i]]$fit, levels = method_list)
df                = rbind(df, data.frame(pred = c(colMeans(matrix(res_df[[i]]$pred, 20, 13))),
                                         time2 = apply(matrix(res_df[[i]]$time, 20, 13), 2, median),
                                         time = c(colMeans(matrix(res_df[[i]]$time, 20, 13))),
                                         p    = p_range[i],
                                         fit  = method_list))
}
df$fit = factor(df$fit, levels = c("Mr.ASH","E-NET","Lasso", "Ridge","SCAD.2tuning","MCP.2tuning","L0Learn",
                                   "varbvs","BayesB","B-Lasso","SuSiE","SCAD.1tuning","MCP.1tuning"))
df = df[df$p %in% c(20,50,200,500,1000,2000,10000,20000),]
df$size = 0.5
df$size[1:8] = 1.2
col   = gg_color_hue(13)[c(1:11,5,6)]
df$lt = "solid"
shape = c(19,17,24,25,9,3,11,4,5,7,8,10,1)[c(1:11,5,6)]
df$lt[89:104] = "dashed"
df$Method = df$fit
fig_dummy4 = ggplot(df) + geom_line(aes(x = p, y = pred, color = Method), size = df$size, linetype = df$lt) +
  geom_point(aes(x = p, y = pred, color = Method, shape = Method), size = 2.5) +
  theme_cowplot(font_size = 22) +
  scale_x_continuous(trans = "log10", breaks = c(20,50,200,500,1000,2000,10000,20000)) +
  labs(y = "predictior error (rmse / sigma)", x = "number of coefficients (p)") +
  theme(axis.line = element_blank(),
        plot.title = element_text(hjust = 0.5),
        axis.title.x = element_blank(),
        axis.text.x  = element_text(angle = 45,hjust = 1),
        axis.title.y = element_blank()) +
  scale_color_manual(values = col) +
  scale_shape_manual(values = shape) +
  scale_y_continuous(trans = "log10", breaks = c(1,1.1,1.2,1.3,1.4)) +
  coord_cartesian(ylim = c(1,1.3))
res_df       = readRDS("results/scenario11.RDS")
method_list  = c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE","E-NET","Lasso",
                 "Ridge","SCAD.2tuning","MCP.2tuning","SCAD.1tuning","MCP.1tuning","L0Learn")
df           = data.frame()
p_range      = c(20,50,100,200,500,1000,2000,5000,10000,20000)
for (i in 1:10) {
res_df[[i]]$fit   = rep(method_list, each = 20)
res_df[[i]]$fit   = factor(res_df[[i]]$fit, levels = method_list)
df                = rbind(df, data.frame(pred = c(colMeans(matrix(res_df[[i]]$pred, 20, 13))),
                                         time2 = apply(matrix(res_df[[i]]$time, 20, 13), 2, median),
                                         time = c(colMeans(matrix(res_df[[i]]$time, 20, 13))),
                                         p    = p_range[i],
                                         fit  = method_list))
}
df$fit = factor(df$fit, levels = method_list)
df = df[df$p %in% c(20,50,200,500,1000,2000,10000,20000),]
df = df[df$fit %in% c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE"),]
df$size = 0.5
df$size[1:8] = 1.2
col   = gg_color_hue(13)[c(1,8:11)]
df$lt = "solid"
shape = c(19,17,24,25,9,3,11,4,5,7,8,10,1)[c(1,8:11)]
p1    = ggplot(df) + geom_line(aes(x = p, y = pred, color = fit), size = df$size, linetype = df$lt) +
  geom_point(aes(x = p, y = pred, color = fit, shape = fit), size = 2.5) +
  theme_cowplot(font_size = 22) +
  scale_x_continuous(trans = "log10", breaks = c(20,50,200,500,1000,2000,10000,20000)) +
  labs(y = "predictior error (rmse / sigma)", x = "number of coefficients (p)") +
  theme(axis.line = element_blank(),
        plot.title = element_text(hjust = 0.5),
        axis.title.x = element_blank(),
        axis.text.x  = element_text(angle = 45,hjust = 1),
        axis.title.y = element_blank()) +
  scale_color_manual(values = col) +
  scale_shape_manual(values = shape) +
  scale_y_continuous(trans = "log10", breaks = c(1,1.1,1.2,1.3,1.4)) +
  coord_cartesian(ylim = c(1,1.3))
fig_main = p1 + theme(legend.position = "none")
# suptitle   = ggdraw() + draw_label("Varying p", fontface  = 'bold', size = 14) 
# subtitle   = ggdraw() + draw_label("Scenario: IndepGauss + PointNormal, n = 500, p = 20-20000, s = 20, pve = 0.5", fontface  = 'bold', size = 14) 
fig11_3    = plot_grid(fig_main, ncol = 1, rel_heights = c(0.05,0.95))
res_df       = readRDS("results/scenario11.RDS")
method_list  = c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE","E-NET","Lasso",
                 "Ridge","SCAD.2tuning","MCP.2tuning","SCAD.1tuning","MCP.1tuning","L0Learn")
df           = data.frame()
p_range      = c(20,50,100,200,500,1000,2000,5000,10000,20000)
for (i in 1:10) {
res_df[[i]]$fit   = rep(method_list, each = 20)
res_df[[i]]$fit   = factor(res_df[[i]]$fit, levels = method_list)
df                = rbind(df, data.frame(pred = c(colMeans(matrix(res_df[[i]]$pred, 20, 13))),
                                         time2 = apply(matrix(res_df[[i]]$time, 20, 13), 2, median),
                                         time = c(colMeans(matrix(res_df[[i]]$time, 20, 13))),
                                         p    = p_range[i],
                                         fit  = method_list))
}
df$fit = factor(df$fit, levels = c("Mr.ASH","E-NET","Lasso", "Ridge","SCAD.1tuning","MCP.1tuning","L0Learn",
                      "varbvs","BayesB","B-Lasso","SuSiE","SCAD.2tuning","MCP.2tuning"))
df = df[df$fit %in% c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE"),]
df$size = 0.5
df$size[1:9] = 1.2
col   = gg_color_hue(13)[c(1,8:11)]
shape = c(19,17,24,25,9,3,11,4,5,7,8,10,1)[c(1,8:11)]
fig_main = ggplot(df) + geom_line(aes(x = p, y = time, color = fit),
                              size = df$size) + 
    geom_point(aes(x = p, y = time, color = fit, shape = fit), size = 2.5) +
  theme_cowplot(font_size = 22) +
  scale_x_continuous(trans = "log10", breaks = p_range) +
  labs(y = "computation time (seconds)", x = "number of nonzero coefficients (s)") +
  theme(axis.line = element_blank(),
        plot.title = element_text(hjust = 0.5),
        legend.position = "none",
        axis.text.x  = element_text(angle = 45,hjust = 1),
        axis.title.x = element_blank(),
        axis.title.y = element_blank()) +
  scale_y_continuous(trans = "log10", breaks = c(0.01,0.1,1,10,100), limits = c(0.01,300)) +
  scale_color_manual(values = col) +
  scale_shape_manual(values = shape)
#subtitle   = ggdraw() + draw_label("Computation Time (seconds)", fontface = 'bold', size = 14) 
fig11_4    = plot_grid(fig_main, ncol = 1, rel_heights = c(0.05,0.95))

Draw Figure

yaxis1   = ggdraw() + draw_label("predictior error (rmse / sigma)", size = 25, angle = 90)
yaxis2   = ggdraw() + draw_label("computation time (seconds)", size = 25, angle = 90)
figure6  = plot_grid(yaxis1, fig11_1, fig11_3, yaxis2, fig11_2, fig11_4, ncol = 3, rel_widths = c(0.03,0.5,0.5))
title    = ggdraw() + draw_label("Varying p (Scenario 11)", fontface = 'bold', size = 24)
legend   <- get_legend(fig_dummy4 +
                         theme_cowplot(font_size = 22) +
                         theme(legend.box.margin = margin(0, 0, 0, 12),
                               legend.key.size = unit(0.8, "cm")))
xaxis    = ggdraw() + draw_label("number of coefficients (p)", size = 25, angle = 0)
figure6  = plot_grid(plot_grid(title, plot_grid(figure6, xaxis, rel_heights = c(0.97,0.03), nrow = 2),
                               ncol = 1, rel_heights = c(0.05,0.95)),
                     legend, nrow = 1, rel_widths = c(0.9,0.15))
ggsave("figure6_for_paper.pdf", figure6, width = 18, height = 15)

sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.3

Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib

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] cowplot_0.9.4 ggplot2_3.2.1

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.3       knitr_1.22       magrittr_1.5     workflowr_1.3.0 
 [5] tidyselect_0.2.5 munsell_0.5.0    colorspace_1.4-1 R6_2.4.1        
 [9] rlang_0.4.2      dplyr_0.8.3      stringr_1.4.0    tools_3.5.3     
[13] grid_3.5.3       gtable_0.3.0     xfun_0.6         withr_2.1.2     
[17] git2r_0.25.2     htmltools_0.4.0  assertthat_0.2.1 yaml_2.2.0      
[21] lazyeval_0.2.2   rprojroot_1.3-2  digest_0.6.23    tibble_2.1.3    
[25] lifecycle_0.1.0  crayon_1.3.4     farver_2.0.3     purrr_0.3.3     
[29] fs_1.3.0         glue_1.3.1       evaluate_0.13    rmarkdown_1.12  
[33] labeling_0.3     stringi_1.4.5    pillar_1.4.3     compiler_3.5.3  
[37] scales_1.1.0     backports_1.1.5  pkgconfig_2.0.3