Commit c81702ce authored by Kevin Kunzmann's avatar Kevin Kunzmann

manuscript revision

parent cbf0dd50
......@@ -11,5 +11,6 @@ output*
*.Rhistory
*.out
*.docx
*.png
*.sif
*.DS_Store
......@@ -10,19 +10,17 @@ include: "rules/final_imputation_report.rule"
rule create_manuscript_v1_1:
rule manuscript:
input:
pop_report = rules.prepare_data_v1_1.output,
posteriors = rules.fit_models_validation_v1_1.input,
markdown = "manuscript/manuscript.Rmd"
output:
pdf = "output/v1.1/manuscript.docx",
figures = "output/v1.1/manuscript_figures.zip"
"output/v1.1/manuscript.docx"
shell:
"""
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\\"))"
mv manuscript/figures.zip {output.figures}
Rscript -e "rmarkdown::render('{input.markdown}', output_dir = 'output/v1.1', params = list(data_dir = '../output/v1.1/data', config_file = '../config.yml'))"
"""
......
......@@ -600,7 +600,7 @@ df_plot <- rbind(
ggplot(df_plot, aes(x = model, y = mean_error)) +
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(
aes(ymin = mean_error - 1.96*se_error, ymax = mean_error + 1.96*se_error, color = label),
width = .25, position = position_dodge(.3)
......@@ -616,6 +616,9 @@ ggplot(df_plot, aes(x = model, y = mean_error)) +
axis.text.x = element_text(angle = 66, hjust = 1),
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.,
......@@ -673,7 +676,7 @@ plot_confusion_matrices <- function(df_predictions, models, nrow = 2, legendpos,
group_by(fold, model) %>%
do(
confusion_matrix = caret::confusionMatrix(
data = factor(.$prediction, levels = 3:8),
data = factor(.$prediction, levels = 3:8),
reference = factor(.$GOSE, levels = 3:8)
) %>%
as.matrix %>% as_tibble %>%
......@@ -688,24 +691,21 @@ plot_confusion_matrices <- function(df_predictions, models, nrow = 2, legendpos,
# p_cnf_mtrx_raw <-
df_average_confusion_matrices %>%
ggplot(aes(`Observed GOSE`, `Predicted GOSE`, fill = n)) +
geom_raster(fill = "white") +
geom_text(aes(
label = sprintf("%3.f", n) %>%
ifelse(. == "0.0", "", .),
color = n
ggplot(aes(`Observed GOSE`, `Predicted GOSE`)) +
geom_text(
aes(
label = sprintf("%3.f", n) %>% ifelse(. == "0.0", "", .),
fontface = ifelse(`Observed GOSE` == `Predicted GOSE`, 'bold', 'plain')
),
size = scriptsize
vjust = .5, size = scriptsize
) +
geom_hline(yintercept = c(2, 4, 6) + .5, color = "black") +
geom_vline(xintercept = c(2, 4, 6) + .5, color = "black") +
scale_color_gradient(low = "#999999", high = "black") +
#scale_fill_gradient(low = "white", high = "#555555") +
coord_fixed(expand = FALSE) +
coord_fixed(expand = FALSE, xlim = c(0.5, 6.5), ylim = c(0.5, 6.5)) +
labs(x = "observed GOSe", y = "imputed GOSe", fill = "") +
theme_bw() +
theme(
panel.grid = element_blank(),
panel.grid = element_blank(),
legend.position = "none"
) +
facet_wrap(~model, nrow = nrow) +
......@@ -745,7 +745,7 @@ plot_confusion_matrices(
)
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
......@@ -800,7 +800,7 @@ plot_summary_measures_cond <- function(df_predictions, models, label) {
geom_hline(yintercept = 0, color = "black") +
geom_line(aes(y = mean), alpha = .5) +
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),
width = .33,
size = .5,
......@@ -829,7 +829,7 @@ plot_summary_measures_cond(
)
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
......@@ -885,7 +885,7 @@ plot_confusion_matrices(
)
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(
)
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 %>%
panel.grid.major.x = element_blank()
)
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.
```{r zip-figures, include=FALSE}
system("zip figures.zip *.png *.pdf")
system("rm *.png *.pdf")
```
# 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