vendredi 11 septembre 2015

data frame or matrix of quantiles

I used following code to get the quantiles (25 %, 50 %,75 % and 99 %) of x and replicate 100 times.

x<-c(1,2,3,5,4,5,6,7,8,5,4,3,2)
sample.boot=numeric()

for (i in 1:100){
       sample.boot[i]<-quantile(sample(x,replace = T),c(0.25,0.50,0.75,0.99))
}
sample.boot

This is not giving desired output. I want all four quantiles replicated 100 times and stored as data frame or in a matrix as below.

4 5 5 7
2 4 6 7
.......
.......
3 5 5 6



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire