+library(ggdist)
-summarize.estimator <- function(df, suffix='naive', coefname='x'){
+summarize.estimator <- function(sims.df, suffix='naive', coefname='x'){
reported_vars <- c(
'Bxy',
grouping_vars <- grouping_vars[grouping_vars %in% names(df)]
- part <- df[,
- c(reported_vars,
- grouping_vars),
- with=FALSE]
+ part <- sims.df[,
+ unique(c(reported_vars,
+ grouping_vars)),
+ with=FALSE]
true.in.ci <- as.integer((part$Bxy >= part[[paste0('B',coefname,'y.ci.lower.',suffix)]]) & (part$Bxy <= part[[paste0('B',coefname,'y.ci.upper.',suffix)]]))
bias=bias,
sign.correct =sign.correct)]
+
part.plot <- part[, .(p.true.in.ci = mean(true.in.ci),
mean.bias = mean(bias),
mean.est = mean(.SD[[paste0('B',coefname,'y.est.',suffix)]],na.rm=T),