Skip to content

Commit

Permalink
Snapshots and high-low now plot |AUC-0.5| on the y axis
Browse files Browse the repository at this point in the history
  • Loading branch information
tsbrett committed Feb 7, 2018
1 parent c608a72 commit 02d4fb1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 6 additions & 3 deletions tobyfigs/high-low-plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ hl_data <- res %>%
mutate(variable = as.factor(variable))

nrows <- nrow(hl_data)/2
hl_data$absAUC = abs(hl_data$AUC - 0.5)

hl_data <- hl_data %>%
mutate(err = lead(variable,nrows), AUC_err = lead(AUC,nrows)) %>%
Expand All @@ -55,12 +56,14 @@ levels(hl_data$neg_bin_k) <- c("High overdispersion", "Low overdispersion")
#Define plotting function
hl_plot <- function(hl_data){
ggplot(hl_data) +
geom_bar(aes(x=variable,y=AUC-0.5, fill = AUC, color = AUC),stat="identity" ) +
geom_bar(aes(x=variable,y=absAUC, fill = AUC, color = AUC),stat="identity" ) +
#labs(y = "|AUC - 0.5|") +
facet_grid(reporting_prob~neg_bin_k) +
geom_rangeframe(colour ="black") +
scale_fill_gradientn(limits = c(0,1),colours=AUC_colors) +
scale_color_gradientn(limits = c(0,1),colours=AUC_colors) +
scale_y_continuous(name = "AUC",labels=c("0.0","0.25","0.5","0.75","1.0"))
scale_color_gradientn(limits = c(0,1),colours=AUC_colors) +#+
scale_y_continuous(name = "|AUC-0.5|",labels=c("0.0","0.1","0.2","0.3",
"0.4","0.5"))
}


Expand Down
7 changes: 5 additions & 2 deletions tobyfigs/snapshots-auc-plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ auc_data$`Aggregation period` <- as.factor(auc_data$Aggregation.period)
levels(auc_data$`Aggregation period`) <- c("Monthly~snapshots","Weekly~snapshots")

auc_data$variable <- factor(auc_data$variable, levels = levels(auc_data$variable)[c(7,10,9,5,2,1,4,3,8,6)])
auc_data$absAUC = abs(auc_data$AUC - 0.5)



auc_plot <- function(df){
Expand All @@ -33,12 +35,13 @@ auc_plot <- function(df){

ggplot(df) +
# geom_pointrange(aes(x=variable,y=AUC, ymin=AUC-AUC_err, ymax= AUC+AUC_err, color=variable)) +
geom_bar(aes(x=variable,y=AUC-0.5, fill = AUC, color = AUC),stat="identity" ) + #, fill = "#088E7C") +
geom_bar(aes(x=variable,y=absAUC, fill = AUC, color = AUC),stat="identity" ) + #, fill = "#088E7C") +
facet_grid(`Infectious period`~`Aggregation period`,labeller = label_parsed)+
geom_rangeframe(colour ="black") +
scale_fill_gradientn(limits = c(0,1),colours=AUC_colors) +
scale_color_gradientn(limits = c(0,1),colours=AUC_colors) +
scale_y_continuous(name = "AUC",limits = c(-0.5,0.5),labels=c("0.0","0.25","0.5","0.75","1.0"))
scale_y_continuous(name = "|AUC-0.5|",labels=c("0.0","0.1","0.2","0.3",
"0.4","0.5"))
#scale_x_continuous(name = "")+#,labels=c("Variance","Variance convexity","Autocovariance",
# "Autocorrelation","Decay time", "Mean",
# "Index of Dispersion", "Coefficient of variation",
Expand Down

0 comments on commit 02d4fb1

Please sign in to comment.