Commit c81702ce authored by Kevin Kunzmann's avatar Kevin Kunzmann

manuscript revision

parent cbf0dd50
...@@ -11,5 +11,6 @@ output* ...@@ -11,5 +11,6 @@ output*
*.Rhistory *.Rhistory
*.out *.out
*.docx *.docx
*.png
*.sif *.sif
*.DS_Store *.DS_Store
...@@ -10,19 +10,17 @@ include: "rules/final_imputation_report.rule" ...@@ -10,19 +10,17 @@ include: "rules/final_imputation_report.rule"
rule create_manuscript_v1_1: rule manuscript:
input: input:
pop_report = rules.prepare_data_v1_1.output, pop_report = rules.prepare_data_v1_1.output,
posteriors = rules.fit_models_validation_v1_1.input, posteriors = rules.fit_models_validation_v1_1.input,
markdown = "manuscript/manuscript.Rmd" markdown = "manuscript/manuscript.Rmd"
output: output:
pdf = "output/v1.1/manuscript.docx", "output/v1.1/manuscript.docx"
figures = "output/v1.1/manuscript_figures.zip"
shell: shell:
""" """
mkdir -p output/v1.1 mkdir -p output/v1.1
Rscript -e "rmarkdown::render(\\"{input.markdown}\\", output_dir = \\"output/v1.1\\", params = list(data_dir = \\"../output/v1.1/data\\", config_file = \\"../config.yml\\"))" Rscript -e "rmarkdown::render('{input.markdown}', output_dir = 'output/v1.1', params = list(data_dir = '../output/v1.1/data', config_file = '../config.yml'))"
mv manuscript/figures.zip {output.figures}
""" """
......
...@@ -600,7 +600,7 @@ df_plot <- rbind( ...@@ -600,7 +600,7 @@ df_plot <- rbind(
ggplot(df_plot, aes(x = model, y = mean_error)) + ggplot(df_plot, aes(x = model, y = mean_error)) +
geom_hline(yintercept = 0, color = "black") + geom_hline(yintercept = 0, color = "black") +
geom_point(aes(color = label), size = .8, position = position_dodge(.3)) + geom_point(aes(color = label), size = .8, position = position_dodge(.4)) +
geom_errorbar( geom_errorbar(
aes(ymin = mean_error - 1.96*se_error, ymax = mean_error + 1.96*se_error, color = label), aes(ymin = mean_error - 1.96*se_error, ymax = mean_error + 1.96*se_error, color = label),
width = .25, position = position_dodge(.3) width = .25, position = position_dodge(.3)
...@@ -616,6 +616,9 @@ ggplot(df_plot, aes(x = model, y = mean_error)) + ...@@ -616,6 +616,9 @@ ggplot(df_plot, aes(x = model, y = mean_error)) +
axis.text.x = element_text(angle = 66, hjust = 1), axis.text.x = element_text(angle = 66, hjust = 1),
legend.position = "bottom" legend.position = "bottom"
) )
ggsave(filename = "overall_locf.pdf", width = 6, height = 3.5)
ggsave(filename = "overall_locf.png", width = 6, height = 3.5, dpi = 300)
``` ```
Firstly, LOCF is overall negatively biased, i.e., Firstly, LOCF is overall negatively biased, i.e.,
...@@ -673,7 +676,7 @@ plot_confusion_matrices <- function(df_predictions, models, nrow = 2, legendpos, ...@@ -673,7 +676,7 @@ plot_confusion_matrices <- function(df_predictions, models, nrow = 2, legendpos,
group_by(fold, model) %>% group_by(fold, model) %>%
do( do(
confusion_matrix = caret::confusionMatrix( confusion_matrix = caret::confusionMatrix(
data = factor(.$prediction, levels = 3:8), data = factor(.$prediction, levels = 3:8),
reference = factor(.$GOSE, levels = 3:8) reference = factor(.$GOSE, levels = 3:8)
) %>% ) %>%
as.matrix %>% as_tibble %>% as.matrix %>% as_tibble %>%
...@@ -688,24 +691,21 @@ plot_confusion_matrices <- function(df_predictions, models, nrow = 2, legendpos, ...@@ -688,24 +691,21 @@ plot_confusion_matrices <- function(df_predictions, models, nrow = 2, legendpos,
# p_cnf_mtrx_raw <- # p_cnf_mtrx_raw <-
df_average_confusion_matrices %>% df_average_confusion_matrices %>%
ggplot(aes(`Observed GOSE`, `Predicted GOSE`, fill = n)) + ggplot(aes(`Observed GOSE`, `Predicted GOSE`)) +
geom_raster(fill = "white") + geom_text(
geom_text(aes( aes(
label = sprintf("%3.f", n) %>% label = sprintf("%3.f", n) %>% ifelse(. == "0.0", "", .),
ifelse(. == "0.0", "", .), fontface = ifelse(`Observed GOSE` == `Predicted GOSE`, 'bold', 'plain')
color = n
), ),
size = scriptsize vjust = .5, size = scriptsize
) + ) +
geom_hline(yintercept = c(2, 4, 6) + .5, color = "black") + geom_hline(yintercept = c(2, 4, 6) + .5, color = "black") +
geom_vline(xintercept = c(2, 4, 6) + .5, color = "black") + geom_vline(xintercept = c(2, 4, 6) + .5, color = "black") +
scale_color_gradient(low = "#999999", high = "black") + coord_fixed(expand = FALSE, xlim = c(0.5, 6.5), ylim = c(0.5, 6.5)) +
#scale_fill_gradient(low = "white", high = "#555555") +
coord_fixed(expand = FALSE) +
labs(x = "observed GOSe", y = "imputed GOSe", fill = "") + labs(x = "observed GOSe", y = "imputed GOSe", fill = "") +
theme_bw() + theme_bw() +
theme( theme(
panel.grid = element_blank(), panel.grid = element_blank(),
legend.position = "none" legend.position = "none"
) + ) +
facet_wrap(~model, nrow = nrow) + facet_wrap(~model, nrow = nrow) +
...@@ -745,7 +745,7 @@ plot_confusion_matrices( ...@@ -745,7 +745,7 @@ plot_confusion_matrices(
) )
ggsave(filename = "confusion_matrices_locf.pdf", width = 6, height = 3) ggsave(filename = "confusion_matrices_locf.pdf", width = 6, height = 3)
ggsave(filename = "confusion_matrices_locf.png", width = 6, height = 3) ggsave(filename = "confusion_matrices_locf.png", width = 6, height = 3, dpi = 300)
``` ```
The absolute-count confusion matrices show that most imputed values are The absolute-count confusion matrices show that most imputed values are
...@@ -800,7 +800,7 @@ plot_summary_measures_cond <- function(df_predictions, models, label) { ...@@ -800,7 +800,7 @@ plot_summary_measures_cond <- function(df_predictions, models, label) {
geom_hline(yintercept = 0, color = "black") + geom_hline(yintercept = 0, color = "black") +
geom_line(aes(y = mean), alpha = .5) + geom_line(aes(y = mean), alpha = .5) +
geom_point(aes(y = mean), size = .3, geom_point(aes(y = mean), size = .3,
position = position_dodge(.2)) + position = position_dodge(.3)) +
geom_errorbar(aes(ymin = mean - 1.96*se, ymax = mean + 1.96*se), geom_errorbar(aes(ymin = mean - 1.96*se, ymax = mean + 1.96*se),
width = .33, width = .33,
size = .5, size = .5,
...@@ -829,7 +829,7 @@ plot_summary_measures_cond( ...@@ -829,7 +829,7 @@ plot_summary_measures_cond(
) )
ggsave(filename = "errors_stratified_locf.pdf", width = 6, height = 3.5) ggsave(filename = "errors_stratified_locf.pdf", width = 6, height = 3.5)
ggsave(filename = "errors_stratified_locf.png", width = 6, height = 3.5, scale = 1.25) ggsave(filename = "errors_stratified_locf.png", width = 6, height = 3.5, scale = 1.25, dpi = 300)
``` ```
Just as with the overall performance, differences are most pronounced in terms Just as with the overall performance, differences are most pronounced in terms
...@@ -885,7 +885,7 @@ plot_confusion_matrices( ...@@ -885,7 +885,7 @@ plot_confusion_matrices(
) )
ggsave(filename = "confusion_matrices_all.pdf", width = 6, height = 3) ggsave(filename = "confusion_matrices_all.pdf", width = 6, height = 3)
ggsave(filename = "confusion_matrices_all.png", width = 6, height = 3) ggsave(filename = "confusion_matrices_all.png", width = 6, height = 3, dpi = 300)
``` ```
...@@ -898,7 +898,7 @@ plot_summary_measures_cond( ...@@ -898,7 +898,7 @@ plot_summary_measures_cond(
) )
ggsave(filename = "imputation_error.pdf", width = 6, height = 3.5) ggsave(filename = "imputation_error.pdf", width = 6, height = 3.5)
ggsave(filename = "imputation_error.png", width = 6, height = 3.5, scale = 1.25) ggsave(filename = "imputation_error.png", width = 6, height = 3.5, scale = 1.25, dpi = 300)
``` ```
...@@ -1019,7 +1019,7 @@ df_ground_truth %>% ...@@ -1019,7 +1019,7 @@ df_ground_truth %>%
panel.grid.major.x = element_blank() panel.grid.major.x = element_blank()
) )
ggsave(filename = "gose_marignal_per_fold.pdf", width = 6, height = 3) ggsave(filename = "gose_marignal_per_fold.pdf", width = 6, height = 3)
ggsave(filename = "gose_marignal_per_fold.png", width = 6, height = 3) ggsave(filename = "gose_marignal_per_fold.png", width = 6, height = 3, dpi = 300)
``` ```
...@@ -1268,9 +1268,4 @@ in the README.md file of the GitLab repository. ...@@ -1268,9 +1268,4 @@ in the README.md file of the GitLab repository.
```{r zip-figures, include=FALSE}
system("zip figures.zip *.png *.pdf")
system("rm *.png *.pdf")
```
# References # References
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment