forked from PM-Cardoso/SGLT2-GLP1
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path6.3.slade_assessment_models_4.R
73 lines (49 loc) · 2.19 KB
/
6.3.slade_assessment_models_4.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
####################
## Description:
## - In this file we make a collected of plots comparing assessment
## measurements of several models from 4.1 to 4.4.
####################
# Used in slade to ensure the library being used is my personal library
.libPaths(.libPaths()[c(2,1,3)])
## increase memery usage to 50gb of RAM
options(java.parameters = "-Xmx50g")
library(tidyverse)
# library(bartMachine)
## path to output folder
output_path <- "Samples"
## make directory for outputs
dir.create(output_path)
output_path <- "Samples/SGLT2-GLP1"
## make directory for outputs
dir.create(output_path)
## make directory for outputs
dir.create("Plots")
###############################################################################
###############################################################################
############################### Plots #########################################
###############################################################################
###############################################################################
assessment <- rbind(
cbind(readRDS(paste0(output_path, "/Final_model/Assessment/assessment.rds")), Model = "Model 1"),
cbind(readRDS(paste0(output_path, "/Final_model/John_idea/Assessment/assessment.rds")), Model = "Model 2"),
cbind(readRDS(paste0(output_path, "/Final_model/With_grf/Assessment/assessment.rds")), Model = "Model 3"),
cbind(readRDS(paste0(output_path, "/Final_model/With_grf_no_prop/Assessment/assessment.rds")), Model = "Model 4")
) %>%
as.data.frame() %>%
mutate(`5%` = as.numeric(`5%`),
`50%` = as.numeric(`50%`),
`95%` = as.numeric(`95%`),
Model = factor(Model, levels = c("Model 4", "Model 3", "Model 2", "Model 1")))
plot_assessment <- assessment %>%
ggplot() +
theme_bw() +
geom_errorbar(aes(y = Model, xmin = `5%`, xmax = `95%`, colour = Model), width = 0.2) +
geom_point(aes(x = `50%`, y = Model, shape = Dataset), size = 2, colour = "black") +
facet_wrap(~statistic, ncol = 1, scales = "free") +
theme(axis.title.x = element_blank(),
legend.position = "bottom") +
guides(colour = "none")
#### PDF with all the plots
pdf(file = "Plots/6.3.assessment.pdf")
plot_assessment
dev.off()