icmaLogCon {logcondens} | R Documentation |
Given a vector of observations {x} = (x_1, ..., x_m) with pairwise distinct entries and
a vector of weights {w}=(w_1, ..., w_m) s.t. sum_{i=1}^m w_i = 1, icmaLogCon
computes iteratively a concave, piecewise linear function widehat varphi_m on [x_1, x_m] with knots only in
{x_1, ..., x_m} such that
L(varphi) = sum_{i=1}^m w_i varphi(x_i) - int_{-infty}^infty exp(varphi(t)) dt
is maximal. In order to be able to apply the pool - adjacent - violaters algorithm, computations are performed in the parametrization
{eta}({varphi}) = Bigl(varphi_1, Bigl(eta_1 + sum_{j=2}^i (x_i-x_{i-1})eta_iBigr)_{i=2}^m Bigr).
To find the maximum of L, a variant of the iterative convex minorant using the pool - adjacent - violaters algorithm is used.
icmaLogCon(x, w = NA, eps = 10^-8, T1 = 2000, robustif = TRUE, print = FALSE)
x |
Vector of independent and identically distributed numbers, with strictly increasing entries. |
w |
Optional vector of nonnegative weights corresponding to {x}, where w_1 > 0 and w_m > 0. These raw weights are normalized in order to sum to one. Default: w_i = 1 / m. |
eps |
An arbitrary real number, typically small. Iterations are halted if the directional derivative of {eta} to L({eta}) in the direction of the new candidate is <= varepsilon. |
T1 |
Maximal number of iterations to perform. |
robustif |
robustif = TRUE performs the robustification and Hermite interpolation procedure detailed in Rufibach (2006, 2007), robustif = FALSE does not. In the latter case, convergence of the algorithm is no longer guaranteed. |
print |
print = TRUE outputs log-likelihood in every loop, print = FALSE does not. Make sure to tell R to output (press CTRL+W). |
x |
Column vector with observations x_1, ..., x_m. |
f |
Column vector with entries widehat f_m(x_i). |
Loglik |
The value L(widehat varphi_m) of the log-likelihood-function L at the maximum widehat varphi_m. |
Iterations |
Number of iterations performed. |
Kaspar Rufibach, kaspar.rufibach@gmail.com
Lutz Duembgen, duembgen@stat.unibe.ch,
http://www.staff.unibe.ch/duembgen
Rufibach K. (2006) Log-concave Density Estimation and Bump Hunting for i.i.d. Observations.
PhD Thesis, University of Bern, Switzerland and Georg-August University of Goettingen, Germany, 2006.
Available at http://www.stub.unibe.ch/download/eldiss/06rufibach_k.pdf.
Rufibach, K. (2007) Computing maximum likelihood estimators of a log-concave density function. J. Stat. Comput. Simul. 77, 561–574.
The following functions are used by icmaLogCon
:
phieta
, etaphi
, Lhat_eta
, quadDeriv
,
robust
, isoMean
Log concave density estimation via an Active Set Algorithm can be performed using
activeSetLogCon
.
set.seed(1977) x <- sort(rgamma(200, 2, 1)) res <- icmaLogCon(x, w = NA, T1 = 2000, robustif = TRUE, print = TRUE) ## plot resulting functions par(mfrow = c(2, 1), mar = c(3, 2, 1, 2)) plot(x, res$f, type = 'l'); rug(x) plot(x, log(res$f), type = 'l'); rug(x)