misc/report_sim.R

setwd("P:/git/CatchAll/misc")
library(dplyr)

geom_grid <- data.frame(C = rep(1:10 * 100, each = 100),
                        C_hat = NA,
                        OBS = NA,
                        correct_model = NA)

for(CC in (1:10 * 100)) {
  load(paste("./output/geom_C_", CC, ".RData", sep = ""))

  models <- sapply(1:100, function(ii) geom_results[1,][[ii]])
  obs <- sapply(1:100, function(ii) geom_results[2,][[ii]])
  ests <- sapply(1:100, function(ii) geom_results[3,][[ii]])

  geom_grid$C_hat[geom_grid$C == CC] <- ests
  geom_grid$OBS[geom_grid$C == CC] <- obs
  geom_grid$correct_model[geom_grid$C == CC] <- models == "Geometric"
}

boxplot(C_hat ~ C, data = geom_grid)
points(x = 1:10 * 100, y = 1:10 * 100, col = "red")


mean_C_hat <- geom_grid %>%
  group_by(C) %>%
  summarise(C_AVE = mean(C_hat))

save(mean_C_hat, file = "mean_C_geom.RData")
KenLi93/CatchAll documentation built on May 7, 2019, 3:59 a.m.