- x.amelia.full <- df[,.(N, m, Bxy, Bxy.est.true, Bxy.ci.lower.amelia.full, Bxy.ci.upper.amelia.full, Bxy.est.amelia.full)]
-
- x.amelia.full <- x.amelia.full[,':='(true.in.ci = (Bxy.est.true >= Bxy.ci.lower.amelia.full) & (Bxy.est.true <= Bxy.ci.upper.amelia.full),
- zero.in.ci = (0 >= Bxy.ci.lower.amelia.full) & (0 <= Bxy.ci.upper.amelia.full),
- bias = Bxy.est.true - Bxy.est.amelia.full,
- sign.correct = sign(Bxy.est.true) == sign(Bxy.est.amelia.full))]
-
- x.amelia.full.plot <- x.amelia.full[,.(p.true.in.ci = mean(as.integer(true.in.ci)),
- mean.bias = mean(bias),
- p.sign.correct = mean(as.integer(sign.correct & (! zero.in.ci))),
- mean.est = mean(Bxy.est.amelia.full),
- var.est = var(Bxy.est.amelia.full),
- N.sims = .N,
- variable='x',
- method='Multiple imputation'
- ),
- by=c('N','m')]
-
-
- g.amelia.full <- df[,.(N, m, Bgy.est.true, Bgy.est.amelia.full, Bgy.ci.lower.amelia.full, Bgy.ci.upper.amelia.full)]
- g.amelia.full <- g.amelia.full[,':='(true.in.ci = (Bgy.est.true >= Bgy.ci.lower.amelia.full) & (Bgy.est.true <= Bgy.ci.upper.amelia.full),
- zero.in.ci = (0 >= Bgy.ci.lower.amelia.full) & (0 <= Bgy.ci.upper.amelia.full),
- bias = Bgy.est.amelia.full - Bgy.est.true,
- sign.correct = sign(Bgy.est.true) == sign(Bgy.est.amelia.full))]
-
- g.amelia.full.plot <- g.amelia.full[,.(p.true.in.ci = mean(as.integer(true.in.ci)),
- mean.bias = mean(bias),
- p.sign.correct = mean(as.integer(sign.correct & (! zero.in.ci))),
- mean.est = mean(Bgy.est.amelia.full),
- var.est = var(Bgy.est.amelia.full),
- N.sims = .N,
- variable='g',
- method='Multiple imputation'
- ),
- by=c('N','m')]
-
- ## x.amelia.nok <- df[,.(N, m, Bxy.est.true, Bxy.est.amelia.nok, Bxy.ci.lower.amelia.nok, Bxy.ci.upper.amelia.nok)]
- ## x.amelia.nok <- x.amelia.nok[,':='(true.in.ci = (Bxy.est.true >= Bxy.ci.lower.amelia.nok) & (Bxy.est.true <= Bxy.ci.upper.amelia.nok),
- ## zero.in.ci = (0 >= Bxy.ci.lower.amelia.nok) & (0 <= Bxy.ci.upper.amelia.nok),
- ## bias = Bxy.est.amelia.nok - Bxy.est.true,
- ## sign.correct = sign(Bxy.est.true) == sign(Bxy.est.amelia.nok))]
-
- ## x.amelia.nok.plot <- x.amelia.nok[,.(p.true.in.ci = mean(as.integer(true.in.ci)),
- ## mean.bias = mean(bias),
- ## p.sign.correct = mean(as.integer(sign.correct & (! zero.in.ci))),
- ## mean.est = mean(Bxy.est.amelia.nok),
- ## var.est = var(Bxy.est.amelia.nok),
- ## N.sims = .N,
- ## variable='x',
- ## method='Multiple imputation (Classifier features unobserved)'
- ## ),
- ## by=c('N','m')]
-
- ## g.amelia.nok <- df[,.(N, m, Bgy.est.true, Bgy.est.amelia.nok, Bgy.ci.lower.amelia.nok, Bgy.ci.upper.amelia.nok)]
- ## g.amelia.nok <- g.amelia.nok[,':='(true.in.ci = (Bgy.est.true >= Bgy.ci.lower.amelia.nok) & (Bgy.est.true <= Bgy.ci.upper.amelia.nok),
- ## zero.in.ci = (0 >= Bgy.ci.lower.amelia.nok) & (0 <= Bgy.ci.upper.amelia.nok),
- ## bias = Bgy.est.amelia.nok - Bgy.est.true,
- ## sign.correct = sign(Bgy.est.true) == sign(Bgy.est.amelia.nok))]
-
- ## g.amelia.nok.plot <- g.amelia.nok[,.(p.true.in.ci = mean(as.integer(true.in.ci)),
- ## mean.bias = mean(bias),
- ## p.sign.correct = mean(as.integer(sign.correct & (! zero.in.ci))),
- ## mean.est = mean(Bgy.est.amelia.nok),
- ## var.est = var(Bgy.est.amelia.nok),
- ## N.sims = .N,
- ## variable='g',
- ## method="Multiple imputation (Classifier features unobserved)"
- ## ),
- ## by=c('N','m')]
-
-
- x.mecor <- df[,.(N,m,Bxy.est.true, Bxy.est.mecor,Bxy.lower.mecor, Bxy.upper.mecor)]
-
- x.mecor <- x.mecor[,':='(true.in.ci = (Bxy.est.true >= Bxy.lower.mecor) & (Bxy.est.true <= Bxy.upper.mecor),
- zero.in.ci = (0 >= Bxy.lower.mecor) & (0 <= Bxy.upper.mecor),
- bias = Bxy.est.mecor - Bxy.est.true,
- sign.correct = sign(Bxy.est.true) == sign(Bxy.est.mecor))]
-
- x.mecor.plot <- x.mecor[,.(p.true.in.ci = mean(as.integer(true.in.ci)),
- mean.bias = mean(bias),
- p.sign.correct = mean(as.integer(sign.correct & (! zero.in.ci))),
- mean.est = mean(Bxy.est.mecor),
- var.est = var(Bxy.est.mecor),
- N.sims = .N,
- variable='x',
- method='Regression Calibration'
- ),
- by=c('N','m')]
-
- g.mecor <- df[,.(N,m,Bgy.est.true, Bgy.est.mecor,Bgy.lower.mecor, Bgy.upper.mecor)]
-
- g.mecor <- g.mecor[,':='(true.in.ci = (Bgy.est.true >= Bgy.lower.mecor) & (Bgy.est.true <= Bgy.upper.mecor),
- zero.in.ci = (0 >= Bgy.lower.mecor) & (0 <= Bgy.upper.mecor),
- bias = Bgy.est.mecor - Bgy.est.true,
- sign.correct = sign(Bgy.est.true) == sign(Bgy.est.mecor))]
-
- g.mecor.plot <- g.mecor[,.(p.true.in.ci = mean(as.integer(true.in.ci)),
- mean.bias = mean(bias),
- p.sign.correct = mean(as.integer(sign.correct & (! zero.in.ci))),
- mean.est = mean(Bgy.est.mecor),
- var.est = var(Bgy.est.mecor),
- N.sims = .N,
- variable='g',
- method='Regression Calibration'
- ),
- by=c('N','m')]
-
- ## x.mecor <- df[,.(N,m,Bgy.est.true, Bgy.est.mecor,Bgy.ci.lower.mecor, Bgy.ci.upper.mecor)]
-
- ## x.mecor <- x.mecor[,':='(true.in.ci = (Bgy.est.true >= Bgy.ci.lower.mecor) & (Bgy.est.true <= Bgy.ci.upper.mecor),
- ## zero.in.ci = (0 >= Bgy.ci.lower.mecor) & (0 <= Bgy.ci.upper.mecor),
- ## bias = Bgy.est.mecor - Bgy.est.true,
- ## sign.correct = sign(Bgy.est.true) == sign(Bgy.est.mecor))]
-
- ## x.mecor.plot <- x.mecor[,.(p.true.in.ci = mean(as.integer(true.in.ci)),
- ## mean.bias = mean(bias),
- ## p.sign.correct = mean(as.integer(sign.correct & (! zero.in.ci))),
- ## variable='g',
- ## method='Regression Calibration'
- ## ),
- ## by=c('N','m')]
-
-
- x.gmm <- df[,.(N,m,Bxy.est.true, Bxy.est.gmm,Bxy.ci.lower.gmm, Bxy.ci.upper.gmm)]
- x.gmm <- x.gmm[,':='(true.in.ci = (Bxy.est.true >= Bxy.ci.lower.gmm) & (Bxy.est.true <= Bxy.ci.upper.gmm),
- zero.in.ci = (0 >= Bxy.ci.lower.gmm) & (0 <= Bxy.ci.upper.gmm),
- bias = Bxy.est.gmm - Bxy.est.true,
- sign.correct = sign(Bxy.est.true) == sign(Bxy.est.gmm))]
-
- x.gmm.plot <- x.gmm[,.(p.true.in.ci = mean(as.integer(true.in.ci)),
- mean.bias = mean(bias),
- p.sign.correct = mean(as.integer(sign.correct & (! zero.in.ci))),
- mean.est = mean(Bxy.est.gmm),
-
- var.est = var(Bxy.est.gmm),
- N.sims = .N,
- variable='x',
- method='2SLS+gmm'
- ),
- by=c('N','m')]
-
- g.gmm <- df[,.(N,m,Bgy.est.true, Bgy.est.gmm,Bgy.ci.lower.gmm, Bgy.ci.upper.gmm)]
- g.gmm <- g.gmm[,':='(true.in.ci = (Bgy.est.true >= Bgy.ci.lower.gmm) & (Bgy.est.true <= Bgy.ci.upper.gmm),
- zero.in.ci = (0 >= Bgy.ci.lower.gmm) & (0 <= Bgy.ci.upper.gmm),
- bias = Bgy.est.gmm - Bgy.est.true,
- sign.correct = sign(Bgy.est.true) == sign(Bgy.est.gmm))]
-
- g.gmm.plot <- g.gmm[,.(p.true.in.ci = mean(as.integer(true.in.ci)),
- mean.bias = mean(bias),
- p.sign.correct = mean(as.integer(sign.correct & (! zero.in.ci))),
- mean.est = mean(Bgy.est.gmm),
- var.est = var(Bgy.est.gmm),
- N.sims = .N,
- variable='g',
- method='2SLS+gmm'
- ),
- by=c('N','m')]