X-Git-Url: https://code.communitydata.science/ml_measurement_error_public.git/blobdiff_plain/d0c5766bdf867a81a2477d2cac1d40812110af90..refs/heads/synced/master:/simulations/plot_example.R diff --git a/simulations/plot_example.R b/simulations/plot_example.R index 8e6c477..09d6bf3 100644 --- a/simulations/plot_example.R +++ b/simulations/plot_example.R @@ -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)))]