# http://cran.r-project.org/ AND DOWNLOAD THE R LATEST RELEASE: R-2.x.y.
# http://www.staff.ul.ie/mackenzieg/Assess/R_Integration_Tools/r_integration_tools.html (Crash Course in R)

y <- c(0,0,0,4,4,5,5,5,6,6,6,6,6,6,6)
n <- 15
nb<-1000
boot<-matrix(NA,nb,3)
attributes(boot)

for (i in 1:nb)
{
bs<-sample(y,n,replace =T)
boot[i,1]<- median(bs)
boot[i,2]<- mean(bs)
}
hist(boot[,1])
hist(boot[,2])
quantile(boot[,1], probs=0.025)
quantile(boot[,1], probs=0.975)
quantile(boot[,2], probs=0.025)
quantile(boot[,2], probs=0.975)

> # http://cran.r-project.org/ AND DOWNLOAD THE R LATEST RELEASE: R-2.x.y.
> # http://www.staff.ul.ie/mackenzieg/Assess/R_Integration_Tools/r_integration_tools.html (Crash Course in R)
> 
> y <- c(0,0,0,4,4,5,5,5,6,6,6,6,6,6,6)
> n <- 15
> nb<-1000
> boot<-matrix(NA,nb,3)
> attributes(boot)
$dim
[1] 1000    3

> 
> for (i in 1:nb)
+ {
+ bs<-sample(y,n,replace =T)
+ boot[i,1]<- median(bs)
+ boot[i,2]<- mean(bs)
+ }
> hist(boot[,1])
> hist(boot[,2])
> quantile(boot[,1], probs=0.025)
2.5% 
   4 
> quantile(boot[,1], probs=0.975)
97.5% 
    6 
> quantile(boot[,2], probs=0.025)
    2.5% 
3.131667 
> quantile(boot[,2], probs=0.975)
97.5% 
  5.4 
> 