Learn R Programming

cnmlcd (version 1.2-0)

cnmlcd: Maximum Likelihood Estimation of a Log-concave Density Function

Description

The function computes the nonparametric maximum likelihood estimate (NPMLE) of a log-concave density from univariate observations.

Usage

cnmlcd(x, lcd, maxit = 100, tol = 1e-06,
       plot=c("null","density","logdensity","gradient"))

Arguments

x

a vector storing univariate observations.

lcd

an initial log-concave density function, which is an object of class "lcd".

maxit

maximum number of iterations.

tol

tolerance level for stopping the algorithm. Internally, it is used as the threshold on the increase of the log-likelihood after each iteration.

plot

type of a plot to be created in each iteration of the algorithm. If "null", no plot is produced. The argument is mainly for monitoring purposes.

Value

lcd

the NPMLE when the algorithm successfully converges, stored as an object of class "lcd".

ll

the log-likelihood value, evaluated at the NPMLE.

num.iterations

number of iterations used.

max.gradient

maximum gradient value at convergence.

convergence

= 0, a successful convergence;

= 1, failure of convergence, likely because the number of iterations is reached.

Details

The algorithm used to compute the NPMLE is an extension of the constrained Newton method of Wang (2007) for nonparametric mixture estimation. It guarantees to find the unique NPMLE.

The algorithm is described in Liu and Wang (2018).

References

Wang, Y. (2007). On the fast computation of the nonparametric maximum likelihood estimate of a mixing distribution. Journal of the Royal Statistical Society, Series B, 69, 185-198.

Liu, Y. and Wang, Y. (2018). A Fast Algorithm for Univariate Log-concave Density Estimation. Australia & New Zealand Journal of Statistics (To appear).

Examples

Run this code
# NOT RUN {
## Normal density
x = rnorm(1000)
(r = cnmlcd(x))

## Log-likelihood values at the NPMLE
r$ll
logLik(r$lcd, x)

## Density or log density plot
plot(r$lcd)
plot(r$lcd, x)
plot(r$lcd, x, log = TRUE)

## Density function of the Log-concave distribution
dlcd(-4:4, r$lcd)

## Estimation from log-return data
data(logreturn)
r = cnmlcd(logreturn)
plot(r$lcd, logreturn)
plot(r$lcd, logreturn, log = TRUE)

## Estimation for log-volatility data
data(logvolatility)
r = cnmlcd(logvolatility)
plot(r$lcd, logvolatility)
# }

Run the code above in your browser using DataLab