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):
R
density
x <- rbeta(1e6, 5, 2) d <- density(x) mode <- d$x[which.max(d$y)]
Aucun commentaire:
Enregistrer un commentaire