activeSetLogCon {logcondens}R Documentation

Computes a Log-Concave Probability Density Estimate via an Active Set Algorithm

Description

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, activeSetLogCon computes 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. To accomplish this, an active set algorithm is used.

Usage

activeSetLogCon(x, w = NA, print = FALSE)

Arguments

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.
print print = TRUE outputs log-likelihood in every loop, print = FALSE does not. Make sure to tell R to output (press CTRL+W).

Value

x Column vector with observations x_1, ..., x_m.
phi Column vector with entries widehat varphi_m(x_i).
IsKnot Column vector with entries
IsKnot_i = 1{widehat varphi_m has a kink at x_i}.
L The value L(widehat {varphi}_m) of the log-likelihood-function L at the maximum widehat {varphi}_m.
F A vector (widehat F_{m,i})_{i=1}^m of the same size as {x} with entries

widehat F_{m,i} = int_{x_1}^{x_i} exp(widehat varphi_m(t)) dt.

H Column vector (H_1, ..., H_m)' where H_i is the derivative of

t to L(varphi + tDelta_i)


at zero and Delta_i(x) = min(x - x_i, 0).

Author(s)

Kaspar Rufibach, kaspar.rufibach@gmail.com

Lutz Duembgen, duembgen@stat.unibe.ch,
http://www.staff.unibe.ch/duembgen

References

Duembgen, L, Huesler, A. and Rufibach, K. (2007) Active set and EM algorithms for log-concave densities based on complete and censored data. Technical report 61, IMSV, Univ. of Bern, available at http://arxiv.org/abs/0707.4643.

Duembgen, L. and Rufibach, K. (2009) Maximum likelihood estimation of a log–concave density and its distribution function: basic properties and uniform consistency. Bernoulli, 15(1), 40–68.

See Also

The following functions are used by activeSetLogCon:

J00, J10, J11, J20, Local_LL, Local_LL_all, LocalCoarsen, LocalConvexity, LocalExtend, LocalF, LocalMLE, LocalNormalize, MLE

Log concave density estimation via an iterative convex minorant algorithm can be performed using icmaLogCon.

Examples

## estimate gamma density
set.seed(1977)
x <- sort(rgamma(200, 2, 1))
res <- activeSetLogCon(x, w = NA, print = FALSE)

## plot resulting functions
par(mfrow = c(2, 2), mar = c(3, 2, 1, 2))
plot(x, exp(res$phi), type = 'l'); rug(x)
plot(x, res$phi, type = 'l'); rug(x)
plot(x, res$Fhat, type = 'l'); rug(x)
plot(x, res$H, type = 'l'); rug(x)

## compute and plot function values at an arbitrary point
x0 <- (x[100] + x[101]) / 2
Fx0 <- evaluateLogConDens(x0, x, res$phi, res$Fhat, res$IsKnot)[3]
plot(x, res$Fhat, type = 'l'); rug(x)
abline(v = x0, lty = 3); abline(h = Fx0, lty = 3)

## compute and plot 0.9-quantile of Fhat
q <- quantilesLogConDens(0.9, x, res$phi, res$Fhat)
plot(x, res$Fhat, type = 'l'); rug(x)
abline(h = 0.9, lty = 3); abline(v = q, lty = 3)

[Package logcondens version 1.3.3 Index]