diff --git a/resources/robustness_check_plots.R b/resources/robustness_check_plots.R index 83cd6ca..b7c0ac6 100644 --- a/resources/robustness_check_plots.R +++ b/resources/robustness_check_plots.R @@ -1,4 +1,4 @@ -x1library(data.table) +library(data.table) library(ggplot2) source('resources/functions.R') @@ -98,7 +98,6 @@ plot.robustness.2.iv <- function(iv, n.annotations=100, n.classifications=5000){ new.levels <- c("true"="True","naive"="Naïve","amelia.full"="MI", "mecor"="mecor","gmm"="GMM", "mle"="MLA", "zhang"="PL","feasible"="Feasible") robust_df <- robust_df[,method := new.levels[method]] - robust_df <- robust_df[method != "Feasible"] 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) @@ -121,13 +120,11 @@ plot.robustness.2.dv <- function(iv, n.annotations=100, n.classifications=5000){ r <- readRDS("robustness_2_dv.RDS") robust_df <- data.table(r[['robustness_2_dv']]) - robust_df <- robust_df[(m==n.annotations) & (N==n.classifications)] new.levels <- c("true"="True","naive"="Naïve","amelia.full"="MI", "mecor"="mecor","gmm"="GMM", "mle"="MLA", "zhang"="PL","feasible"="Feasible") robust_df <- robust_df[,method := new.levels[method]] - 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) @@ -150,7 +147,7 @@ plot.robustness.3.iv <- function(iv, n.annotations=200, n.classifications=5000){ robust_df <- robust_df[(m==n.annotations) & (N==n.classifications)] robust_df <- robust_df[,method := new.levels[method]] - robust_df <- robust_df[(method != "Feasible") & (Bzx==0.3)] + robust_df <- robust_df[(Bzx==0.3)] robust_df <- robust_df[(method != "PL")] p <- .plot.simulation(robust_df, iv=iv, levels=c("True","Naïve","MI", "GMM","MLA", "PL", "Feasible")) @@ -173,7 +170,6 @@ plot.robustness.3.dv <- function(iv, n.annotations=100, n.classifications=1000){ robust_df <- robust_df[(m==n.annotations) & (N==n.classifications)] robust_df <- robust_df[,method := new.levels[method]] - robust_df <- robust_df[method != "Feasible"] robust_df <- robust_df[,Py := round(plogis(B0),2)] p <- .plot.simulation(robust_df, iv=iv, levels=c("True","Naïve","MI", "GMM", "MLA", "PL", "Feasible")) robust_df <- robust_df[(method != "PL")] @@ -195,6 +191,7 @@ plot.robustness.4.iv <- function(iv, n.annotations=200, n.classifications=5000){ robust_df <- robust_df[(m==n.annotations) & (N==n.classifications)] robust_df <- robust_df[,method := new.levels[method]] + robust_df <- robust_df[method != "Feasible"] robust_df <- robust_df[,y_bias:=factor(robust_df$y_bias,levels=sort(unique(robust_df$y_bias),decreasing=TRUE))] robust_df <- robust_df[Bzx==1]