]> code.communitydata.science - ml_measurement_error_public.git/blobdiff - simulations/plot_example.R
git-annex in nathante@n3246:/gscratch/comdata/users/nathante/ml_measurement_error_public
[ml_measurement_error_public.git] / simulations / plot_example.R
index 8e6c4772f58edfbee00093d0dc70f5c7b341af7d..09d6bf3e7394c95439133896a2404c89e080f671 100644 (file)
@@ -9,7 +9,7 @@ source("summarize_estimator.R")
 
 
 parser <- arg_parser("Simulate data and fit corrected models.")
-parser <- add_argument(parser, "--infile", default="", help="name of the file to read.")
+parser <- add_argument(parser, "--infile", default="example_2.feather", help="name of the file to read.")
 parser <- add_argument(parser, "--remember-file", default="remembr.RDS", help="name of the remember file.")
 parser <- add_argument(parser, "--name", default="", help="The name to safe the data to in the remember file.")
 args <- parse_args(parser)
@@ -76,13 +76,13 @@ build_plot_dataset <- function(df){
 
     z.amelia.full <- summarize.estimator(df, 'amelia.full', 'z')
     
-    x.mecor <- summarize.estimator(df, 'mecor', 'x')
+    ## x.mecor <- summarize.estimator(df, 'mecor', 'x')
 
-    z.mecor <- summarize.estimator(df, 'mecor', 'z')
+    ## z.mecor <- summarize.estimator(df, 'mecor', 'z')
 
-    x.mecor <- summarize.estimator(df, 'mecor', 'x')
+    ## x.mecor <- summarize.estimator(df, 'mecor', 'x')
 
-    z.mecor <- summarize.estimator(df, 'mecor', 'z')
+    ## z.mecor <- summarize.estimator(df, 'mecor', 'z')
 
     x.mle <- summarize.estimator(df, 'mle', 'x')
 
@@ -97,7 +97,7 @@ build_plot_dataset <- function(df){
     z.gmm <- summarize.estimator(df, 'gmm', 'z')
 
     accuracy <- df[,mean(accuracy)]
-    plot.df <- rbindlist(list(x.true,z.true,x.naive,z.naive,x.amelia.full,z.amelia.full,x.mecor, z.mecor, x.gmm, z.gmm, x.feasible, z.feasible,z.mle, x.mle, x.zhang, z.zhang, x.gmm, z.gmm),use.names=T)
+    plot.df <- rbindlist(list(x.true,z.true,x.naive,z.naive,x.amelia.full,z.amelia.full,x.gmm, z.gmm, x.feasible, z.feasible,z.mle, x.mle, x.zhang, z.zhang, x.gmm, z.gmm),use.names=T)
     plot.df[,accuracy := accuracy]
     plot.df <- plot.df[,":="(sd.est=sqrt(var.est)/N.sims)]
     return(plot.df)
@@ -105,6 +105,7 @@ build_plot_dataset <- function(df){
 
 
 sims.df <- read_feather(args$infile)
+unique(sims.df[,.N,by=.(N,m)])
 print(unique(sims.df$N))
 
 # df <- df[apply(df,1,function(x) !any(is.na(x)))]

Community Data Science Collective || Want to submit a patch?