1 source("RemembR/R/RemembeR.R")
8 parser <- arg_parser("Simulate data and fit corrected models.")
9 parser <- add_argument(parser, "--infile", default="", help="name of the file to read.")
10 parser <- add_argument(parser, "--name", default="", help="The name to safe the data to in the remember file.")
11 args <- parse_args(parser)
12 source("summarize_estimator.R")
14 build_plot_dataset <- function(df){
16 x.true <- summarize.estimator(df, 'true','x')
18 z.true <- summarize.estimator(df, 'true','z')
20 x.loa0.feasible <- summarize.estimator(df, 'loa0.feasible','x')
22 z.loa0.feasible <- summarize.estimator(df,'loa0.feasible','z')
24 x.loa0.mle <- summarize.estimator(df, 'loa0.mle', 'x')
26 z.loa0.mle <- summarize.estimator(df, 'loa0.mle', 'z')
28 x.loco.feasible <- summarize.estimator(df, 'loco.feasible', 'x')
30 z.loco.feasible <- summarize.estimator(df, 'loco.feasible', 'z')
32 x.loco.mle <- summarize.estimator(df, 'loco.mle', 'x')
34 z.loco.mle <- summarize.estimator(df, 'loco.mle', 'z')
37 accuracy <- df[,mean(accuracy)]
38 plot.df <- rbindlist(list(x.true,z.true,x.loa0.feasible,z.loa0.feasible,x.loa0.mle,z.loa0.mle,x.loco.feasible, z.loco.feasible, z.loco.mle, x.loco.mle),use.names=T)
39 plot.df[,accuracy := accuracy]
40 plot.df <- plot.df[,":="(sd.est=sqrt(var.est)/N.sims)]
45 plot.df <- read_feather(args$infile)
46 print(unique(plot.df$N))
48 # df <- df[apply(df,1,function(x) !any(is.na(x)))]
50 if(!('Bzx' %in% names(plot.df)))
53 if(!('accuracy_imbalance_difference' %in% names(plot.df)))
54 plot.df[,accuracy_imbalance_difference:=NA]
56 unique(plot.df[,'accuracy_imbalance_difference'])
58 #plot.df <- build_plot_dataset(df[accuracy_imbalance_difference==0.1][N==700])
59 plot.df <- build_plot_dataset(plot.df)
61 change.remember.file("remember_irr.RDS",clear=TRUE)
63 remember(plot.df,args$name)