diff --git a/resources/robustness_check_plots.R b/resources/robustness_check_plots.R index b7c0ac6..5e810b7 100644 --- a/resources/robustness_check_plots.R +++ b/resources/robustness_check_plots.R @@ -88,7 +88,7 @@ plot.robustness.1.dv <- function(iv='z'){ grid.draw(p) } -plot.robustness.2.iv <- function(iv, n.annotations=100, n.classifications=5000){ +plot.robustness.2.iv <- function(iv, n.annotations=200, n.classifications=5000){ r <- readRDS("robustness_2.RDS") robust_df <- data.table(r[['robustness_2']]) @@ -101,7 +101,7 @@ plot.robustness.2.iv <- function(iv, n.annotations=100, n.classifications=5000){ p <- .plot.simulation(robust_df, iv=iv, levels=c("True","Naïve","MI", "GMM", "MLA", "PL", "Feasible")) p <- p + facet_wrap(prediction_accuracy~., ncol=4,as.table=F) - p <- p + scale_x_discrete(labels=label_wrap_gen(14)) + ylab("Estimate") + xlab("Method") + coord_flip() + p <- p + scale_x_discrete(labels=label_wrap_gen(14)) + ylab(bquote('Estimate of B'[.(toupper(iv))])) + xlab("Method") + coord_flip() p <- arrangeGrob(p, @@ -115,7 +115,7 @@ robust_2_df <- data.table(robust2[['robustness_2_dv']]) robust_2_min_acc <- min(robust_2_df[,prediction_accuracy]) robust_2_max_acc <- max(robust_2_df[,prediction_accuracy]) -plot.robustness.2.dv <- function(iv, n.annotations=100, n.classifications=5000){ +plot.robustness.2.dv <- function(iv, n.annotations=200, n.classifications=5000){ r <- readRDS("robustness_2_dv.RDS") robust_df <- data.table(r[['robustness_2_dv']]) @@ -128,7 +128,7 @@ plot.robustness.2.dv <- function(iv, n.annotations=100, n.classifications=5000){ p <- .plot.simulation(robust_df, iv=iv, levels=c("True","Naïve","MI", "GMM", "MLA", "PL", "Feasible")) p <- p + facet_wrap(prediction_accuracy~., ncol=4,as.table=F) - p <- p + scale_x_discrete(labels=label_wrap_gen(14)) + ylab("Estimate") + xlab("Method") + coord_flip() + p <- p + scale_x_discrete(labels=label_wrap_gen(14)) + ylab(bquote('Estimate of B'[.(toupper(iv))])) + xlab("Method") + coord_flip() p <- arrangeGrob(p, top=grid.text("Varying Accuracy of the AC",x=0.42,just='right')) @@ -153,7 +153,7 @@ plot.robustness.3.iv <- function(iv, n.annotations=200, n.classifications=5000){ p <- .plot.simulation(robust_df, iv=iv, levels=c("True","Naïve","MI", "GMM","MLA", "PL", "Feasible")) p <- p + facet_wrap(Px~., ncol=3,as.table=F) - p <- p + scale_x_discrete(labels=label_wrap_gen(14)) + ylab("Estimate") + xlab("Method") + coord_flip() + p <- p + scale_x_discrete(labels=label_wrap_gen(14)) + ylab(bquote('Estimate of B'[.(toupper(iv))])) + xlab("Method") + coord_flip() p <- arrangeGrob(p, top=grid.text("Imbalance in X",x=0.32,just='right')) @@ -175,7 +175,7 @@ plot.robustness.3.dv <- function(iv, n.annotations=100, n.classifications=1000){ robust_df <- robust_df[(method != "PL")] p <- p + facet_wrap(Py~., ncol=3,as.table=F,scales='free') - p <- p + scale_x_discrete(labels=label_wrap_gen(14)) + ylab("Estimate") + xlab("Method") + coord_flip() + p <- p + scale_x_discrete(labels=label_wrap_gen(14)) + ylab(bquote('Estimate of B'[.(toupper(iv))])) + xlab("Method") + coord_flip() p <- arrangeGrob(p, top=grid.text("Imbalance in Y",x=0.32,just='right')) @@ -199,7 +199,7 @@ plot.robustness.4.iv <- function(iv, n.annotations=200, n.classifications=5000){ p <- .plot.simulation(robust_df, iv=iv, levels=c("True","Naïve","MI", "GMM", "MLA", "PL", "Feasible")) p <- p + facet_wrap(y_bias~., ncol=3,as.table=T) - p <- p + scale_x_discrete(labels=label_wrap_gen(14)) + ylab("Estimate") + xlab("Method") + coord_flip() + p <- p + scale_x_discrete(labels=label_wrap_gen(14)) + ylab(bquote('Estimate of B'[.(toupper(iv))])) + xlab("Method") + coord_flip() p <- arrangeGrob(p, top=grid.text("Varying Degree of Misclassification in X",x=0.52,just='right')) @@ -224,7 +224,7 @@ plot.robustness.4.dv <- function(iv, n.annotations=100, n.classifications=1000){ robust_df <- robust_df[Bzx==1] p <- .plot.simulation(robust_df, iv=iv, levels=c("True","Naïve","MI", "GMM", "MLA", "PL", "Feasible")) p <- p + facet_wrap(z_bias~., ncol=3,as.table=F) - p <- p + scale_x_discrete(labels=label_wrap_gen(14)) + ylab("Estimate") + xlab("Method") + coord_flip() + p <- p + scale_x_discrete(labels=label_wrap_gen(14)) + ylab(bquote('Estimate of B'[.(toupper(iv))])) + xlab("Method") + coord_flip() p <- arrangeGrob(p, top=grid.text("Varying Degree of Misclassification in Y",x=0.52,just='right'))