Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unnecessary arguments and add plots by group (thesis) #5

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 6 additions & 18 deletions epiAnalysis/scripts/analysis.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ df_sensitivity <-
"_sensitivity.RDS"
))


name_of_current_run <- paste0("remove_unnecessary_args_", Sys.Date())
## Set up values used throughout for comp_labels and covariates--------------------------------------------------------------------
# Comp labels
comp_labels <-
Expand Down Expand Up @@ -810,11 +810,8 @@ plot_maxi_matrix_transfers(
yllimit = 0.8,
yulimit = 1.3,
plot_log = TRUE,
units = "hr/day",
granularity = 2000,
theme = NULL,
point_specification = ggplot2::geom_point(size = 1)
)
granularity = 2000,
)
dev.off()

## Matrix plots: model comparison-----------------------------------------
Expand Down Expand Up @@ -901,10 +898,7 @@ for (pair in model_pair_list) {
yllimit = 0.8,
yulimit = 1.3,
plot_log = TRUE,
units = "hr/day",
granularity = 1000,
point_specification = ggplot2::geom_point(size = 2)
)
granularity = 1000)

dev.off()

Expand All @@ -928,10 +922,8 @@ compare_all_transfers_side_by_side_three(
yllimit = 0.8,
yulimit = 1.3,
plot_log = TRUE,
units = "hr/day",
granularity = 1000,
point_specification = ggplot2::geom_point(size = 2)
)
)
dev.off()

### Write these models into df of numbers
Expand Down Expand Up @@ -981,12 +973,8 @@ compare_all_transfers_ism_side_by_side(
yllimit = 0.8,
yulimit = 1.3,
plot_log = TRUE,
lower_quantile = 0.05,
upper_quantile = 0.95,
units = "hr/day",
granularity = 1000,
point_specification = ggplot2::geom_point(size = 2)
)
)
dev.off()

### Write numbers_df --------------------------------------------------
Expand Down
16 changes: 1 addition & 15 deletions epiAnalysis/useful_functions/arrange_plots_matrix.R
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
plot_maxi_matrix_transfers <-
function(comp_model,
fixed_values = NULL,
part_1 = NULL,
comp_labels,
yllimit = NULL,
yulimit = NULL,
plot_log = FALSE,
lower_quantile = 0.05,
upper_quantile = 0.95,
units = "unitless",
specified_units = NULL,
terms = TRUE,
granularity = 10000,
point_specification = ggplot2::geom_point(size = 2),
theme = NULL,
plotstitle = NULL) {
#------------------------------------------------------------------
Expand All @@ -22,13 +14,9 @@ plot_maxi_matrix_transfers <-
type <- epicoda:::process_model_type(comp_model)

# Labels
if (!is.null(part_1)) {
comp_labels <- alter_order_comp_labels(comp_labels, part_1)
}
transf_labels <-
transf_labels(comp_labels,
transformation_type = "ilr",
part_1 = part_1)
transformation_type = "ilr")
# Datasets
dataset1 <- get_dataset_from_model(model = comp_model, comp_labels = comp_labels, transf_labels = transf_labels, type = type)

Expand Down Expand Up @@ -59,14 +47,12 @@ plot_maxi_matrix_transfers <-
granularity = granularity,
units = "hr/day",
comp_labels = comp_labels,
terms = terms,
plot_log = plot_log,
yllimit = yllimit,
yulimit = yulimit,
xllimit = xllimit,
xulimit = xulimit,
y_label = y_label,
fixed_values = fixed_values,
point_specification = ggplot2::geom_point(size = 1.5)
)
assign(paste0("p_", comp_labels[i], "_", comp_labels[j], "_model1"), pfirst )
Expand Down
18 changes: 1 addition & 17 deletions epiAnalysis/useful_functions/compare_plot2.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,11 @@ compare_all_transfers_side_by_side <-
ebc2 = "peachpuff",
pc1 = "blue",
pc2 = "darkred",
fixed_values = NULL,
part_1 = NULL,
comp_labels,
yllimit = NULL,
yulimit = NULL,
plot_log = FALSE,
lower_quantile = 0.05,
upper_quantile = 0.95,
units = "unitless",
specified_units = NULL,
terms = TRUE,
granularity = 10000,
point_specification = ggplot2::geom_point(size = 2),
theme = NULL,
plotstitle = NULL) {
#------------------------------------------------------------------
Expand All @@ -36,13 +28,9 @@ compare_all_transfers_side_by_side <-
}

# Labels
if (!is.null(part_1)) {
comp_labels <- alter_order_comp_labels(comp_labels, part_1)
}
transf_labels <-
transf_labels(comp_labels,
transformation_type = "ilr",
part_1 = part_1)
transformation_type = "ilr")
# Datasets
dataset1 <- get_dataset_from_model(model = comp_model, comp_labels = comp_labels, transf_labels = transf_labels, type = type)
dataset2 <- get_dataset_from_model(model = comp_model2, comp_labels = comp_labels, transf_labels = transf_labels, type = type)
Expand Down Expand Up @@ -74,14 +62,12 @@ compare_all_transfers_side_by_side <-
granularity = granularity,
units = "hr/day",
comp_labels = comp_labels,
terms = terms,
plot_log = plot_log,
yllimit = yllimit,
yulimit = yulimit,
xllimit = xllimit,
xulimit = xulimit,
y_label = y_label,
fixed_values = fixed_values,
point_specification = ggplot2::geom_point(size = 1.5, colour = pc1),
error_bar_colour = ebc1
)
Expand All @@ -94,13 +80,11 @@ compare_all_transfers_side_by_side <-
granularity = granularity,
units = "hr/day",
comp_labels = comp_labels,
terms = terms,
plot_log = plot_log,
yllimit = yllimit,
yulimit = yulimit,
xllimit = xllimit,
xulimit = xulimit,
fixed_values = fixed_values,
y_label = " ",
point_specification = ggplot2::geom_point(size = 1.5, colour = pc2),
error_bar_colour = ebc2
Expand Down
25 changes: 3 additions & 22 deletions epiAnalysis/useful_functions/compare_plot3.R
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,11 @@ compare_all_transfers_side_by_side_three <-
pc1 = "blue",
pc2 = "darkred",
pc3 = "darkgreen",
fixed_values = NULL,
part_1 = NULL,
comp_labels,
yllimit = NULL,
yulimit = NULL,
plot_log = FALSE,
lower_quantile = 0.05,
upper_quantile = 0.95,
units = "unitless",
specified_units = NULL,
terms = TRUE,
granularity = 10000,
point_specification = ggplot2::geom_point(size = 2),
theme = NULL,
plotstitle = NULL) {
#------------------------------------------------------------------
# First we calculate the shared limits for all the plots
Expand All @@ -35,13 +26,9 @@ compare_all_transfers_side_by_side_three <-
}

# Labels
if (!is.null(part_1)) {
comp_labels <- alter_order_comp_labels(comp_labels, part_1)
}
transf_labels <-
transf_labels <-
transf_labels(comp_labels,
transformation_type = "ilr",
part_1 = part_1)
transformation_type = "ilr")
# Datasets
dataset1 <- get_dataset_from_model(model = comp_model, comp_labels = comp_labels, transf_labels = transf_labels, type = type)

Expand Down Expand Up @@ -71,14 +58,12 @@ compare_all_transfers_side_by_side_three <-
granularity = granularity,
units = "hr/day",
comp_labels = comp_labels,
terms = terms,
plot_log = plot_log,
yllimit = yllimit,
yulimit = yulimit,
xllimit = xllimit,
xulimit = xulimit,
y_label = y_label,
fixed_values = fixed_values,
point_specification = ggplot2::geom_point(size = 1.5, colour = pc1),
error_bar_colour = ebc1
)
Expand All @@ -91,13 +76,11 @@ compare_all_transfers_side_by_side_three <-
granularity = granularity,
units = "hr/day",
comp_labels = comp_labels,
terms = terms,
plot_log = plot_log,
yllimit = yllimit,
yulimit = yulimit,
xllimit = xllimit,
xulimit = xulimit,
fixed_values = fixed_values,
y_label = " ",
point_specification = ggplot2::geom_point(size = 1.5, colour = pc2),
error_bar_colour = ebc2
Expand All @@ -111,14 +94,12 @@ compare_all_transfers_side_by_side_three <-
granularity = granularity,
units = "hr/day",
comp_labels = comp_labels,
terms = terms,
plot_log = plot_log,
yllimit = yllimit,
yulimit = yulimit,
xllimit = xllimit,
xulimit = xulimit,
fixed_values = fixed_values,
y_label = " ",
y_label = " ",
point_specification = ggplot2::geom_point(size = 1.5, colour = pc3),
error_bar_colour = ebc3
)
Expand Down
22 changes: 1 addition & 21 deletions epiAnalysis/useful_functions/compare_plot_linear.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,11 @@ compare_all_transfers_ism_side_by_side <-
ebc2 = "peachpuff",
pc1 = "blue",
pc2 = "darkred",
fixed_values = NULL,
transformation_type = "ilr",
comparison_part = NULL,
part_1 = NULL,
comp_labels,
yllimit = NULL,
yulimit = NULL,
plot_log = FALSE,
lower_quantile = 0.05,
upper_quantile = 0.95,
units = "unitless",
specified_units = NULL,
rounded_zeroes = TRUE,
det_limit = NULL,
terms = TRUE,
granularity = 10000,
point_specification = ggplot2::geom_point(size = 2),
theme = NULL,
plotstitle = NULL) {

Expand All @@ -34,13 +22,9 @@ compare_all_transfers_ism_side_by_side <-
type <- epicoda:::process_model_type(comp_model)

# Labels
if (!is.null(part_1)) {
comp_labels <- alter_order_comp_labels(comp_labels, part_1)
}
transf_labels <-
transf_labels(comp_labels,
transformation_type = "ilr",
part_1 = part_1)
transformation_type = "ilr")
# Datasets
dataset1 <- get_dataset_from_model(model = comp_model, comp_labels = comp_labels, transf_labels = transf_labels, type = type)

Expand Down Expand Up @@ -71,14 +55,12 @@ compare_all_transfers_ism_side_by_side <-
granularity = granularity,
units = "hr/day",
comp_labels = comp_labels,
terms = terms,
plot_log = plot_log,
yllimit = yllimit,
yulimit = yulimit,
xllimit = xllimit,
xulimit = xulimit,
y_label = y_label,
fixed_values = fixed_values,
point_specification = ggplot2::geom_point(size = 1.5, colour = pc1),
error_bar_colour = ebc1
)
Expand All @@ -93,13 +75,11 @@ compare_all_transfers_ism_side_by_side <-
granularity = granularity,
units = "hr/day",
comp_labels = comp_labels,
terms = terms,
plot_log = plot_log,
yllimit = yllimit,
yulimit = yulimit,
xllimit = xllimit,
xulimit = xulimit,
fixed_values = fixed_values,
y_label = " ",
point_specification = ggplot2::geom_point(size = 1.5, colour = pc2),
error_bar_colour = ebc2
Expand Down
4 changes: 2 additions & 2 deletions epiAnalysis/useful_functions/plot_transfers_ism.R
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ plot_transfers_ism <- function(from_part,
dataset = dataset_ready,
units = "hr/day",
comp_labels = comp_labels,
lower_quantile = 0.05,
upper_quantile = 0.95,
lower_quantile = lower_quantile,
upper_quantile = upper_quantile,
granularity = granularity
)
new_data <- epicoda:::normalise_comp(new_data, comp_labels)
Expand Down
Loading