mardi 9 janvier 2018

fastest way to find the mode of a random sample in R?

I was wondering if there is a faster or more accurate way to obtain the mode of a random sample in R than what I show below (using density):

   x <- rbeta(1e6, 5, 2)
   d <- density(x)
mode <- d$x[which.max(d$y)]




Aucun commentaire:

Enregistrer un commentaire