[R] How to find maximum values on the density function of a random variable

guox at ucalgary.ca guox at ucalgary.ca
Thu Mar 12 22:28:41 CET 2009


I would like to find the maximum values on the density function of a
random variable. For example, I have a random variable

rv <- rbinom(10000,1,0.1) + rnorm(10000)

Its density function is given by density(rv) and can be displayed by
plot(density(rv)). How to calculate its maximum values?
A density function may have a few (global and local) maximum values.
Please help. Thanks,
-james




More information about the R-help mailing list