Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
library(hextri)
library(tidyr)
noco = readRDS("/cloud/project/postpi/noco.rds")
truth = readRDS("/cloud/project/postpi/truth.rds")
par = readRDS("/cloud/project/postpi/par_postpi.rds")
nonpar = readRDS("/cloud/project/postpi/nonpar_postpi.rds")
nbins = 20
cols = c("pink","skyblue","darkblue")
## Estimate
df = tibble(noco = noco$estimate,truth=truth$estimate,
par = par$estimate,nonpar=nonpar$estimate)
df_long = pivot_longer(df,-truth)
hextri(df_long$truth,df_long$value,class=df_long$name,
colours=cols, style="size",
xlab="Est with true outcome", ylab="Est with correction",nbins=nbins)
abline(c(0,1))
legend(x=-0.6, y=1, legend = c("No correction",
"Parametric Bootstrap postpi",
"Non-Parametric Bootstrap postpi"),fill=cols)
## Standard error
df = tibble(noco = noco$std.error,truth=truth$std.error,
par = par$std.error,nonpar=nonpar$std.error)
df_long = pivot_longer(df,-truth)
hextri(df_long$truth,df_long$value,class=df_long$name,
colours=cols, style="size",
xlab="SD with true outcome", ylab="SD with correction",nbins=20)
abline(c(0,1))
## T-statistic
df = tibble(noco = noco$statistic,truth=truth$statistic,
par = par$statistic,nonpar=nonpar$statistic)
df_long = pivot_longer(df,-truth)
hextri(df_long$truth,df_long$value,class=df_long$name,
colours=cols, style="size",
xlab="SD with true outcome", ylab="SD with correction",nbins=nbins)
abline(c(0,1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment