Last updated: 2020-04-08
Checks: 6 1
Knit directory: mr-ash-workflow/
This reproducible R Markdown analysis was created with workflowr (version 1.4.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 file has unstaged changes. 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 job! Using relative paths to the files within your workflowr project makes it easier to run your code on other machines.
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: .Rproj.user/
Untracked files:
Untracked: .DS_Store
Untracked: .Rhistory
Untracked: .gitignore
Untracked: analysis/Figure4_Sourcecode1.Rmd
Untracked: analysis/Figure4_Sourcecode2.Rmd
Untracked: figure4and5_for_paper.pdf
Untracked: results/scenario1-4_box.RDS
Untracked: results/scenario11.RDS.backup
Untracked: results/scenario121.RDS
Untracked: results/scenario122.RDS
Untracked: results/scenario5-6_box.RDS
Unstaged changes:
Modified: analysis/Figure10_Sourcecode.Rmd
Modified: analysis/Figure2_Plot.Rmd
Modified: analysis/Figure2_Sourcecode2.Rmd
Modified: analysis/Figure3_Plot.Rmd
Deleted: analysis/Figure3_Sourcecode1.Rmd
Deleted: analysis/Figure3_Sourcecode2.Rmd
Modified: analysis/Figure4_Plot.Rmd
Modified: analysis/Figure5_Plot.Rmd
Modified: analysis/Figure6_Plot.Rmd
Modified: analysis/Figure6_Sourcecode.Rmd
Modified: analysis/Figure7_Plot.Rmd
Modified: analysis/Figure7_Sourcecode.Rmd
Modified: analysis/Figure8_Plot.Rmd
Modified: analysis/Figure8_Sourcecode.Rmd
Modified: figure10_for_paper.pdf
Modified: figure1_for_paper.pdf
Modified: figure2_for_paper.pdf
Modified: figure3_for_paper.pdf
Modified: figure4_for_paper.pdf
Modified: figure5_for_paper.pdf
Modified: figure6_for_paper.pdf
Modified: figure7_for_paper.pdf
Modified: figure8_for_paper.pdf
Modified: results/.DS_Store
Deleted: results/scenario1-5_box.RDS
Modified: results/scenario11.RDS
Modified: results/scenario11_box.RDS
Deleted: results/scenario6_box.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.
These are the previous versions of the R Markdown and HTML files. If you’ve configured a remote Git repository (see ?wflow_git_remote
), click on the hyperlinks in the table below to view them.
File | Version | Author | Date | Message |
---|---|---|---|---|
html | faff970 | Youngseok Kim | 2020-03-31 | Build site. |
Rmd | 8eb9686 | Youngseok | 2020-03-31 | finalize results1 |
html | 8eb9686 | Youngseok | 2020-03-31 | finalize results1 |
Rmd | 1c5a698 | Youngseok | 2020-03-31 | finalize results1 |
html | 1c5a698 | Youngseok | 2020-03-31 | finalize results1 |
Rmd | bc4226c | Youngseok Kim | 2020-03-18 | update analysis/, readme.md |
html | bc4226c | Youngseok Kim | 2020-03-18 | update analysis/, readme.md |
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]
}
res_df = readRDS("./results/scenario7.RDS")
method_list = c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE","E-NET","Lasso","Ridge","SCAD","MCP","L0Learn")
df = data.frame()
n_range = c(200,500,1000,2000,5000)
for (i in 1:5) {
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, 11))),
time2 = apply(matrix(res_df[[i]]$time, 20, 11), 2, median),
time = c(colMeans(matrix(res_df[[i]]$time, 20, 11))),
n = n_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","MCP","L0Learn"),]
df$size = 0.5
df$size[1:5] = 1.2
col = gg_color_hue(13)[1:7]
shape = c(19,17,24,25,9,3,11,4,5,7,8,1,2,6)[1:7]
df$Method = df$fit
p1 = ggplot(df) + geom_line(aes(x = n, y = pred, color = Method), size = df$size) +
geom_point(aes(x = n, y = pred, color = Method, shape = Method), size = 2.5) +
theme_cowplot(font_size = 22) +
scale_x_continuous(trans = "log10", breaks = n_range) +
labs(y = "predictior error (rmse / sigma)", x = "sample size (n)") +
theme(axis.line = element_blank(),
plot.title = element_text(hjust = 0.5),
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.4))
fig_dummy1 = p1
fig_main = p1 + theme(legend.position = "none")
#suptitle = ggdraw() + draw_label("Varying n", fontface = 'bold', size = 22)
#subtitle = ggdraw() + draw_label("Scenario: IndepGauss + PointNormal, n = 200-5000, p = 2000, s = 20, pve = 0.5", fontface = 'bold', size = 22)
#fig1_7 = plot_grid(suptitle, subtitle,fig_main, ncol = 1, rel_heights = c(0.04,0.04,0.95))
#subtitle = ggdraw() + draw_label("Varying n (Scenario 7)", fontface = 'bold', size = 22)
subtitle = ggdraw() + draw_label("Varying n", fontface = 'bold.italic', size = 22)
fig1_7 = plot_grid(subtitle, fig_main, ncol = 1, rel_heights = c(0.08,0.92))
res_df = readRDS("./results/scenario8.RDS")
method_list = c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE","E-NET","Lasso","Ridge","SCAD","MCP","L0Learn")
method_level = c("Mr.ASH","E-NET","Lasso","Ridge",
"SCAD","MCP","L0Learn",
"varbvs","BayesB","B-Lasso","SuSiE")
col = gg_color_hue(13)[1:11]
shape = c(19,17,24,25,9,3,11,4,5,7,8)
pve_list = seq(0,0.9,0.1)
sdat = data.frame()
for (i in 1:10) {
sdat = rbind(sdat, data.frame(pred = colMeans(matrix(res_df[[i]]$pred, 20, 11)),
time = colMeans(matrix(res_df[[i]]$time, 20, 11)),
fit = method_list,
pve = pve_list[i]))
}
sdat$fit = factor(sdat$fit, levels = method_level)
sdat = sdat[sdat$fit %in% c("Mr.ASH","E-NET","Lasso","Ridge",
"SCAD","MCP","L0Learn"),]
sdat$size = 0.5
sdat$size[1:10] = 1.2
p1 = ggplot(sdat) + geom_line(aes(x = pve, y = pred, color = fit), size = sdat$size) +
geom_point(aes(x = pve, y = pred, color = fit, shape = fit), size = 2.5) +
scale_x_continuous(breaks = pve_list) +
theme_cowplot(font_size = 22) +
labs(y = "predictior error (rmse / sigma)", x = "signal strength (PVE)") +
theme(axis.line = element_blank(),
plot.title = element_text(hjust = 0.5),
axis.text.x = element_text(angle = 45,hjust = 1),
axis.title.y = element_blank(),
legend.position = "none") +
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.35))
fig_main = p1
#suptitle = ggdraw() + draw_label("Varying PVE (or SNR, Noise Variance)", fontface = 'bold', size = 22)
#subtitle = ggdraw() + draw_label("Scenario: IndepGauss + PointNormal, n = 500, p = 2000, s = 20, pve = 0-0.9", fontface = 'bold', size = 22)
#fig1_8 = plot_grid(suptitle, subtitle,fig_main, ncol = 1, rel_heights = c(0.04,0.04,0.95))
# subtitle = ggdraw() + draw_label("Varying PVE / Signal-to-Noise Ratio (Scenario 8)", fontface = 'bold', size = 22)
subtitle = ggdraw() + draw_label("Varying PVE", fontface = 'bold.italic', size = 22)
fig1_8 = plot_grid(subtitle, fig_main, ncol = 1, rel_heights = c(0.08,0.92))
res_df = readRDS("./results/scenario9.RDS")
method_list = c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE","E-NET","Lasso","Ridge","SCAD","MCP","L0Learn")
method_level = c("Mr.ASH","E-NET","Lasso","Ridge",
"SCAD","MCP","L0Learn",
"varbvs","BayesB","B-Lasso","SuSiE")
x_range = 2^(c(1,2,3,4,5,6,7,8) - 1)
df = data.frame()
for (i in 1:8) {
res_df[[i]] = res_df[[i]][1:220,]
res_df[[i]]$fit = rep(method_list, each = 20)
res_df[[i]]$fit = factor(res_df[[i]]$fit, levels = method_level)
df = rbind(df, data.frame(pred = c(colMeans(matrix(res_df[[i]]$pred, 20, 11))),
df = x_range[i],
fit = method_list))
}
df = df[df$fit %in% c("Mr.ASH","E-NET","Lasso","Ridge","SCAD","MCP","L0Learn"),]
df$fit = factor(df$fit, levels = method_level)
df$size = 0.5
df$size[1:8] = 1.2
col = gg_color_hue(13)[1:7]
shape = c(19,17,24,25,9,3,11,4,5,7,8,1)[1:7]
p1 = ggplot(df) + geom_line(aes(x = df, y = pred, color = fit), size = df$size) +
geom_point(aes(x = df, y = pred, color = fit, shape = fit), size = 2.5) +
theme_cowplot(font_size = 22) +
scale_x_continuous(trans = "log10", breaks = c(1,2,4,8,16,32,64,128),
labels = c("t (df=1)","t (df=2)","t (df=4)","t (df=8)","Laplace",
"Normal","Uniform","Constant")) +
labs(y = "predictior error (rmse / sigma)", x = "signal shape (h)") +
theme(axis.line = element_blank(),
plot.title = element_text(hjust = 0.5),
axis.text.x = element_text(angle = 45,hjust = 1),
axis.title.y = element_blank(),
legend.position = "none") +
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.5))
fig_main = p1
#suptitle = ggdraw() + draw_label("Varying Signal Shape (p = 200, s = 200)", fontface = 'bold', size = 22)
#subtitle = ggdraw() + draw_label("Scenario: IndepGauss + Spike-and-Slab, n = 500, p = 200, s = 200, pve = 0.5", fontface = 'bold', size = 22)
#fig1_9 = plot_grid(suptitle, subtitle,fig_main, ncol = 1, rel_heights = c(0.04,0.04,0.95))
# subtitle = ggdraw() + draw_label("Varying Signal Shape, Dense Signal (Scenario 9)", fontface = 'bold', size = 22)
subtitle = ggdraw() + draw_label("Varying h (dense)", fontface = 'bold.italic', size = 22)
fig1_9 = plot_grid(subtitle, fig_main, ncol = 1, rel_heights = c(0.08,0.92))
res_df = readRDS("./results/scenario10.RDS")
method_list = c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE","E-NET","Lasso","Ridge","SCAD","MCP","L0Learn")
method_level = c("Mr.ASH","E-NET","Lasso","Ridge",
"SCAD","MCP","L0Learn",
"varbvs","BayesB","B-Lasso","SuSiE")
x_range = 2^(c(1,2,3,4,5,6,7,8) - 1)
df = data.frame()
for (i in 1:8) {
res_df[[i]] = res_df[[i]][1:220,]
res_df[[i]]$fit = rep(method_list, each = 20)
res_df[[i]]$fit = factor(res_df[[i]]$fit, levels = method_level)
df = rbind(df, data.frame(pred = c(colMeans(matrix(res_df[[i]]$pred, 20, 11))),
df = x_range[i],
fit = method_list))
}
df = df[df$fit %in% c("Mr.ASH","E-NET","Lasso","Ridge","SCAD","MCP","L0Learn"),]
df$fit = factor(df$fit, levels = method_level)
df$size = 0.5
df$size[1:8] = 1.2
col = gg_color_hue(13)[1:7]
shape = c(19,17,24,25,9,3,11,4,5,7,8,1)[1:7]
p1 = ggplot(df) + geom_line(aes(x = df, y = pred, color = fit), size = df$size) +
geom_point(aes(x = df, y = pred, color = fit, shape = fit), size = 2.5) +
theme_cowplot(font_size = 22) +
scale_x_continuous(trans = "log10", breaks = c(1,2,4,8,16,32,64,128),
labels = c("t (df=1)","t (df=2)","t (df=4)","t (df=8)","Laplace",
"Normal","Uniform","Constant")) +
labs(y = "predictior error (rmse / sigma)", x = "signal shape (h)") +
theme(axis.line = element_blank(),
plot.title = element_text(hjust = 0.5),
axis.text.x = element_text(angle = 45,hjust = 1),
axis.title.y = element_blank(),
legend.position = "none") +
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.4))
fig_main = p1
#suptitle = ggdraw() + draw_label("Varying Signal Shape (p = 2000, s = 20)", fontface = 'bold', size = 22)
#subtitle = ggdraw() + draw_label("Scenario: IndepGauss + Spike-and-Slab, n = 500, p = 2000, s = 20, pve = 0.5", fontface = 'bold', size = 22)
#fig1_10 = plot_grid(suptitle, subtitle,fig_main, ncol = 1, rel_heights = c(0.04,0.04,0.95))
# subtitle = ggdraw() + draw_label("Varying Signal Shape, Sparse Signal (Scenario 10)", fontface = 'bold', size = 22)
subtitle = ggdraw() + draw_label("Varying h", fontface = 'bold.italic', size = 22)
fig1_10 = plot_grid(subtitle, fig_main, ncol = 1, rel_heights = c(0.08,0.92))
res_df = readRDS("./results/scenario7.RDS")
method_list = c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE","E-NET","Lasso","Ridge","SCAD","MCP","L0Learn")
df = data.frame()
n_range = c(200,500,1000,2000,5000)
for (i in 1:5) {
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, 11))),
time2 = apply(matrix(res_df[[i]]$time, 20, 11), 2, median),
time = c(colMeans(matrix(res_df[[i]]$time, 20, 11))),
n = n_range[i],
fit = method_list))
}
df$fit = factor(df$fit, levels = method_list)
df = df[df$fit %in% c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE"),]
df$size = 0.5
df$size[1:5] = 1.2
col = gg_color_hue(13)[c(1,8:11)]
shape = c(19,17,24,25,9,3,11,4,5,7,8,1)[c(1,8:11)]
df$Method = df$fit
p1 = ggplot(df) + geom_line(aes(x = n, y = pred, color = Method), size = df$size) +
geom_point(aes(x = n, y = pred, color = Method, shape = Method), size = 2.5) +
theme_cowplot(font_size = 22) +
scale_x_continuous(trans = "log10", breaks = n_range) +
labs(y = "predictior error (rmse / sigma)", x = "sample size (n)") +
theme(axis.line = element_blank(),
plot.title = element_text(hjust = 0.5),
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.4))
fig_dummy2 = p1
fig_main = p1 + theme(legend.position = "none")
#suptitle = ggdraw() + draw_label("Varying n", fontface = 'bold', size = 22)
#subtitle = ggdraw() + draw_label("Scenario: IndepGauss + PointNormal, n = 200-5000, p = 2000, s = 20, pve = 0.5", fontface = 'bold', size = 22)
#fig1_7 = plot_grid(suptitle, subtitle,fig_main, ncol = 1, rel_heights = c(0.04,0.04,0.95))
subtitle = ggdraw() + draw_label("Varying n", fontface = 'bold.italic', size = 22)
fig2_7 = plot_grid(subtitle, fig_main, ncol = 1, rel_heights = c(0.08,0.92))
res_df = readRDS("./results/scenario8.RDS")
method_list = c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE","E-NET","Lasso","Ridge","SCAD","MCP","L0Learn")
method_level = c("Mr.ASH","E-NET","Lasso","Ridge",
"SCAD","MCP","L0Learn",
"varbvs","BayesB","B-Lasso","SuSiE")
col = gg_color_hue(13)[c(1,8:11)]
shape = c(19,17,24,25,9,3,11,4,5,7,8,1)[c(1,8:11)]
pve_list = seq(0,0.9,0.1)
sdat = data.frame()
for (i in 1:10) {
sdat = rbind(sdat, data.frame(pred = colMeans(matrix(res_df[[i]]$pred, 20, 11)),
time = colMeans(matrix(res_df[[i]]$time, 20, 11)),
fit = method_list,
pve = pve_list[i]))
}
sdat$fit = factor(sdat$fit, levels = method_level)
sdat = sdat[sdat$fit %in% c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE"),]
sdat$size = 0.5
sdat$size[1:10] = 1.2
p1 = ggplot(sdat) + geom_line(aes(x = pve, y = pred, color = fit), size = sdat$size) +
geom_point(aes(x = pve, y = pred, color = fit, shape = fit), size = 2.5) +
scale_x_continuous(breaks = pve_list) +
theme_cowplot(font_size = 22) +
labs(y = "predictior error (rmse / sigma)", x = "signal strength (PVE)") +
theme(axis.line = element_blank(),
plot.title = element_text(hjust = 0.5),
axis.text.x = element_text(angle = 45,hjust = 1),
axis.title.y = element_blank(),
legend.position = "none") +
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.35))
fig_main = p1
#suptitle = ggdraw() + draw_label("Varying PVE (or SNR, Noise Variance)", fontface = 'bold', size = 22)
#subtitle = ggdraw() + draw_label("Scenario: IndepGauss + PointNormal, n = 500, p = 2000, s = 20, pve = 0-0.9", fontface = 'bold', size = 22)
#fig1_8 = plot_grid(suptitle, subtitle,fig_main, ncol = 1, rel_heights = c(0.04,0.04,0.95))
subtitle = ggdraw() + draw_label("Varying PVE", fontface = 'bold.italic', size = 22)
fig2_8 = plot_grid(subtitle, fig_main, ncol = 1, rel_heights = c(0.08,0.92))
res_df = readRDS("./results/scenario9.RDS")
method_list = c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE","E-NET","Lasso","Ridge","SCAD","MCP","L0Learn")
method_level = c("Mr.ASH","E-NET","Lasso","Ridge",
"SCAD","MCP","L0Learn",
"varbvs","BayesB","B-Lasso","SuSiE")
x_range = 2^(c(1,2,3,4,5,6,7,8) - 1)
df = data.frame()
for (i in 1:8) {
res_df[[i]] = res_df[[i]][1:220,]
res_df[[i]]$fit = rep(method_list, each = 20)
res_df[[i]]$fit = factor(res_df[[i]]$fit, levels = method_level)
df = rbind(df, data.frame(pred = c(colMeans(matrix(res_df[[i]]$pred, 20, 11))),
df = x_range[i],
fit = method_list))
}
df = df[df$fit %in% c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE"),]
df$fit = factor(df$fit, levels = method_level)
df$size = 0.5
df$size[1:8] = 1.2
col = gg_color_hue(13)[c(1,8:11)]
shape = c(19,17,24,25,9,3,11,4,5,7,8,1)[c(1,8:11)]
p1 = ggplot(df) + geom_line(aes(x = df, y = pred, color = fit), size = df$size) +
geom_point(aes(x = df, y = pred, color = fit, shape = fit), size = 2.5) +
theme_cowplot(font_size = 22) +
scale_x_continuous(trans = "log10", breaks = c(1,2,4,8,16,32,64,128),
labels = c("t (df=1)","t (df=2)","t (df=4)","t (df=8)","Laplace",
"Normal","Uniform","Constant")) +
labs(y = "predictior error (rmse / sigma)", x = "signal shape (h)") +
theme(axis.line = element_blank(),
plot.title = element_text(hjust = 0.5),
axis.text.x = element_text(angle = 45,hjust = 1),
axis.title.y = element_blank(),
legend.position = "none") +
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,sqrt(2)))
fig_main = p1
#suptitle = ggdraw() + draw_label("Varying Signal Shape (p = 200, s = 200)", fontface = 'bold', size = 22)
#subtitle = ggdraw() + draw_label("Scenario: IndepGauss + Spike-and-Slab, n = 500, p = 200, s = 200, pve = 0.5", fontface = 'bold', size = 22)
#fig1_9 = plot_grid(suptitle, subtitle,fig_main, ncol = 1, rel_heights = c(0.04,0.04,0.95))
subtitle = ggdraw() + draw_label("Varying h (dense)", fontface = 'bold.italic', size = 22)
fig2_9 = plot_grid(subtitle, fig_main, ncol = 1, rel_heights = c(0.08,0.92))
res_df = readRDS("./results/scenario10.RDS")
method_list = c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE","E-NET","Lasso","Ridge","SCAD","MCP","L0Learn")
method_level = c("Mr.ASH","E-NET","Lasso","Ridge",
"SCAD","MCP","L0Learn",
"varbvs","BayesB","B-Lasso","SuSiE")
x_range = 2^(c(1,2,3,4,5,6,7,8) - 1)
df = data.frame()
for (i in 1:8) {
res_df[[i]] = res_df[[i]][1:220,]
res_df[[i]]$fit = rep(method_list, each = 20)
res_df[[i]]$fit = factor(res_df[[i]]$fit, levels = method_level)
df = rbind(df, data.frame(pred = c(colMeans(matrix(res_df[[i]]$pred, 20, 11))),
df = x_range[i],
fit = method_list))
}
df = df[df$fit %in% c("Mr.ASH","varbvs","BayesB","B-Lasso","SuSiE"),]
df$fit = factor(df$fit, levels = method_level)
df$size = 0.5
df$size[1:8] = 1.2
col = gg_color_hue(13)[c(1,8:11)]
shape = c(19,17,24,25,9,3,11,4,5,7,8,1)[c(1,8:11)]
p1 = ggplot(df) + geom_line(aes(x = df, y = pred, color = fit), size = df$size) +
geom_point(aes(x = df, y = pred, color = fit, shape = fit), size = 2.5) +
theme_cowplot(font_size = 22) +
scale_x_continuous(trans = "log10", breaks = c(1,2,4,8,16,32,64,128),
labels = c("t (df=1)","t (df=2)","t (df=4)","t (df=8)","Laplace",
"Normal","Uniform","Constant")) +
labs(y = "predictior error (rmse / sigma)", x = "signal shape (h)") +
theme(axis.line = element_blank(),
plot.title = element_text(hjust = 0.5),
axis.text.x = element_text(angle = 45,hjust = 1),
axis.title.y = element_blank(),
legend.position = "none") +
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.4))
fig_main = p1
#suptitle = ggdraw() + draw_label("Varying Signal Shape (p = 2000, s = 20)", fontface = 'bold', size = 22)
#subtitle = ggdraw() + draw_label("Scenario: IndepGauss + Spike-and-Slab, n = 500, p = 2000, s = 20, pve = 0.5", fontface = 'bold', size = 22)
#fig1_10 = plot_grid(suptitle, subtitle,fig_main, ncol = 1, rel_heights = c(0.04,0.04,0.95))
subtitle = ggdraw() + draw_label("Varying h", fontface = 'bold.italic', size = 22)
fig2_10 = plot_grid(subtitle, fig_main, ncol = 1, rel_heights = c(0.08,0.92))
figure4 = plot_grid(fig1_7, fig1_8, fig1_9, fig1_10, ncol = 2, rel_heights = c(0.5,0.53))
legend <- get_legend(fig_dummy1 +
theme_cowplot(font_size = 22) +
theme(legend.box.margin = margin(0, 0, 0, 12),
legend.key.size = unit(0.8, "cm")))
yaxis = ggdraw() + draw_label("predictior error (rmse / sigma)", size = 25, angle = 90)
figure4 = plot_grid(plot_grid(plot_grid(yaxis,
figure4, rel_widths = c(0.03,0.97), nrow = 1),
ncol = 1, rel_heights = c(0.05,0.95)),
legend, nrow = 1, rel_widths = c(0.9,0.1))
ggsave("figure4_for_paper.pdf", figure4, width = 18, height = 15.5)
figure5 = plot_grid(fig2_7, fig2_8, fig2_9, fig2_10, ncol = 2, rel_widths = c(0.5,0.53))
title = ggdraw() + draw_label("Adaptation to Dimension, Signal Shape and PVE (Penalized Linear Regression)", fontface = 'bold', size = 22)
legend <- get_legend(fig_dummy2 +
theme_cowplot(font_size = 22) +
theme(legend.box.margin = margin(0, 0, 0, 12),
legend.key.size = unit(0.8, "cm")))
yaxis = ggdraw() + draw_label("predictior error (rmse / sigma)", size = 25, angle = 90)
figure5 = plot_grid(plot_grid(plot_grid(yaxis,
figure5, rel_widths = c(0.03,0.97), nrow = 1),
ncol = 1, rel_heights = c(0.05,0.95)),
legend, nrow = 1, rel_widths = c(0.9,0.1))
ggsave("figure5_for_paper.pdf", figure5, width = 18, height = 15.5)
figure45 = plot_grid(figure4, figure5, ncol = 1)
ggsave("figure4and5_for_paper.pdf", figure45, width = 18, height = 24)
sessionInfo()
R version 3.5.3 (2019-03-11)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14
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_1.0.0 ggplot2_3.2.1
loaded via a namespace (and not attached):
[1] Rcpp_1.0.3 compiler_3.5.3 pillar_1.4.3 git2r_0.26.1
[5] workflowr_1.4.0 tools_3.5.3 digest_0.6.23 evaluate_0.14
[9] lifecycle_0.1.0 tibble_2.1.3 gtable_0.3.0 pkgconfig_2.0.3
[13] rlang_0.4.2 yaml_2.2.0 xfun_0.9 withr_2.1.2
[17] stringr_1.4.0 dplyr_0.8.3 knitr_1.25 fs_1.3.1
[21] rprojroot_1.3-2 grid_3.5.3 tidyselect_0.2.5 glue_1.3.1
[25] R6_2.4.1 rmarkdown_1.15 purrr_0.3.2 farver_2.0.3
[29] magrittr_1.5 whisker_0.4 backports_1.1.5 scales_1.1.0
[33] htmltools_0.3.6 assertthat_0.2.1 colorspace_1.4-1 stringi_1.4.5
[37] lazyeval_0.2.2 munsell_0.5.0 crayon_1.3.4