# Unimodal distribution
x <- rbeta(1000,23,4)
## True mode
betaMode(23, 4)
## Lientz object
f <- lientz(x, 0.2)
print(f)
plot(f, zoom = FALSE)
## Estimate of the mode
mlv(f) # optim(mlv.shorth(x), fn = f)
mlv(f, biau = TRUE) # x[which.min(f(x))]
M <- mlv(x, method = "lientz", bw = 0.2)
print(M)
plot(M)
# Bimodal distribution
x <- c(rnorm(1000,5,1), rnorm(1500, 22, 3))
f <- lientz(x, 0.1)
plot(f)
Run the code above in your browser using DataLab