Simple Lab on studying bootstrap

require(ggplot2)
require(data.table)
require(reshape2)
require(foreach)
require(MASS)
require(stringr)
library(glmnet)

# let's consider a simple duration model
lambda = 0.01
n  = 10

rr = data.table(foreach (i = 1:500,.combine=rbind) %do% {
  D = rexp(n,lambda)
  res = data.frame(value=1/mean(D),value0=lambda)
  res$rep = i
  res$name = rownames(res)
  res
})

ggplot(rr,aes(x=value)) +  geom_density(fill="blue",alpha=0.2,color="blue") + geom_vline(xintercept=lambda,linetype=2,color="red") + geom_vline(xintercept=rr[,mean(value)],linetype=2,color="blue")+theme_bw()