Skip to content

Instantly share code, notes, and snippets.

@tdunning
Created June 18, 2021 22:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdunning/78a4a8ee17b48d35cd7ec496b2f0d817 to your computer and use it in GitHub Desktop.
Save tdunning/78a4a8ee17b48d35cd7ec496b2f0d817 to your computer and use it in GitHub Desktop.
library (dplyr)
data = read.csv('median-error.csv')
png("max-error-uniform.png", width=1200, height=1000, pointsize=25)
i = -3.8
boxplot(abs(error) ~ delta, (data %>% filter(n0==20)), ylim=c(0, 0.05), xlim=c(0.6,4.4), boxwex=0.1, at=(1:4)+i/11, xaxt='n', xlab=expression(delta), cex.lab=1.4)
axis(side=1, at=1:4, labels=c(50,100,200,500))
for (nx in c(20, 50, 100, 1000, 10000, 100000)) {
boxplot(abs(error) ~ delta, (data %>% filter(n0==nx)), ylim=c(0, 0.05), add=T, boxwex=0.1, at=(1:4)+i/11, xaxt='n', yaxt='n')
i = i+1.5
}
text(0.9 + c(0,0,.2), 0.05 - (1:3)*0.003, c("Absolute error of quantile(x) for uniform distribution", "with [20, 50, 100, 1000, 10000, 100000] samples", "and x in [0.0001, 0.001, 0.01, 0.1, 0.5]"), adj=c(0,0,-0.5), cex=1.3)
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment