lientz {modeest} | R Documentation |
The Lientz mode estimator is nothing but the value minimizing the empirical
Lientz function.
A 'plot' and a 'print' methods are provided.
lientz(x, bw = NULL) ## S3 method for class 'lientz': mlv(x, bw = NULL, biau = FALSE, par = shorth(x), optim.method = "BFGS", ...) ## S3 method for class 'lientz': plot(x, zoom = FALSE, ...) ## S3 method for class 'lientz': print(x, digits = NULL, ...)
x |
numeric (vector of observations) or an object of class "lientz" . |
bw |
numeric. The smoothing bandwidth to be used. Should belong to (0, 1). Parameter 'beta' in Lientz (1970) function. |
biau |
logical. If FALSE (the default), the Lientz empirical function
is minimised using optim . |
par |
numeric. The initial value used in optim . |
optim.method |
character. If biau = FALSE , the method used in optim . |
zoom |
logical. If TRUE , one can zoom on the graph created. |
digits |
numeric. Number of digits to be printed. |
... |
if biau = FALSE , further arguments to be passed to optim , or further arguments to be passed to plot.default . |
Lientz function is the smallest non-negative quantity S(x,b),
where b = bw
, such that
F(x+S(x,b)) - F(x-S(x,b)) >= b.
Lientz (1970) provided a way to estimate S(x,b); this estimate is what we call the empirical Lientz function.
lientz
returns an object of class c("lientz", "function")
; this is a
function with additional attributes:
x |
the x argument |
bw |
the bw argument |
call |
the call which produced the result |
mlv.lientz
returns a numeric value, the mode estimate. If biau = TRUE
,
the x
value minimizing Lientz empirical function is returned. Otherwise,
the optim
method is used to perform minimization, and the
attributes: 'value', 'counts', 'convergence' and 'message', coming from
the optim
method, are added to the result.
The user should preferentially call mlv.lientz
through
mlv(x, method = "lientz", ...)
.
This returns an object of class mlv
.
Paul Poncet paulponcet@yahoo.fr
mlv
for general mode estimation;
shorth
for the shorth estimate of the mode
# 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)