Description Usage Arguments Details Value Author(s) References Examples

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

1 2 |

`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 |

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).

`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. |

Yu Liu <liu.yu@auckland.ac.nz>, Yong Wang <yongwang@auckland.ac.nz>

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).

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ```
## 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)
``` |

```
Loading required package: lsei
$lcd
alpha C
3.75492 153.56006
theta pi
[1,] -1.9286042 2.2658763
[2,] -1.2328308 0.5549464
[3,] -1.0340054 0.2079097
[4,] -0.1139803 0.9132364
[5,] 0.3506575 0.4845780
[6,] 1.0244428 0.3266074
[7,] 1.5700141 1.3164345
lower upper
-2.542247 3.523972
$ll
[1] -1382.038
$num.iterations
[1] 10
$max.gradient
[1] 1.295533e-06
$convergence
[1] 0
[1] -1382.038
[1] -1382.038
[1] 0.000000000 0.000000000 0.049886882 0.226851846 0.422586356 0.255874747
[7] 0.053967875 0.005331968 0.000000000
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.