# activeSetLogCon: Computes a Log-Concave Probability Density Estimate via an... In logcondens.mode: Compute MLE of Log-Concave Density on R with Fixed Mode, and Perform Inference for the Mode.

## Description

Given a vector of observations x_n = (x_1, …, x_n) with not necessarily equal entries, activeSetLogCon first computes vectors x_m = (x_1, …, x_m) and w = (w_1, …, w_m) where w_i is the weight of each x_i s.t. ∑_{i=1}^m w_i = 1. Then, activeSetLogCon computes a concave, piecewise linear function \widehat φ_m on [x_1, x_m] with knots only in {x_1, …, x_m} such that

L(φ) = ∑_{i=1}^m w_i φ(x_i) - int_{-∞}^∞ exp(φ(t)) dt

is maximal. To accomplish this, an active set algorithm is used.

This function is as it is in the logcondens package except we've added the 'prec' variable as an argument and modified the the values returned as output, to be in line with the activeSetLogCon.mode function.

## Usage

 1 2 activeSetLogCon(x, xgrid = NULL, print = FALSE, w = NA, prec=10^-10) 

## Arguments

 x Vector of independent and identically distributed numbers, not necessarily unique. xgrid Governs the generation of weights for observations. See preProcess for details. print print = TRUE outputs the log-likelihood in every loop, print = FALSE does not. Make sure to tell R to output (press CTRL+W). w Optional vector of weights. If weights are provided, i.e., if w != NA, then xgrid is ignored. prec Governs precision of various subfunctions, e.g. the Newton-Raphson procedure.

## Value

 xn Vector with initial observations x_1, …, x_n. x Vector of observations x_1, …, x_m that was used to estimate the density, i.e.\ points that include all possible knots of the estimate. Note that this x is not identical to the x passed in (xn is identical). w The vector of weights that had been used. Depends on the chosen setting for xgrid. Of the same length as x. L The value L(φ_m) of the log-likelihood-function L at the maximum \widehat φ_m. IsKnot Vector with entries IsKnot_i = 1\{\widehat{φ}_m has a kink at x_i}.
 knots knots equals x[IsKnot>0], gives the values of the points that are knots. phi Vector with entries \widehat φ_m(x_i), i=1,…,m. Named "phi" not "phihat" for backwards compatibility. fhat Vector with entries \widehat{f}_m(x_i) = e^{\widehat{φ}_m(x_i)}, i=1,…, m. Fhat 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 φ_m(t)) dt. H Numeric vector (H_1, …, H_{m})' where H_i is the derivative of t \to L(φ + tΔ_i) at zero and Δ_i(x) = \min(x - x_i, 0) n Number of initial observations. m Number of points used to compute the estimator, either unique observations or output from preProcess. mode Mode of the estimated density \hat f_m. This is redundant with dlcMode, but is included for backwards compatibility with the logcondens package. dlcMode A list, of class "dlc.mode", with components $val, $idx, and $isx. dlcMode$val gives the mode estimate value, dlcMode$idx gives the corresponding index in x. dlcMode$isx is always TRUE. (dlMode$isx is sometimes FALSE when a dlc.mode object is output from activeSetLogCon.mode.) sig The standard deviation of the initial sample x_1, …, x_n. phi.f All outputs named "name.f" are functions corresponding to name. So, phi.f(x) equals \widehat{φ}_m(x). fhat.f Is a function such that fhat.f(x) equals \widehat{f}_m(x). Fhat.f Is a function such that Fhat.f(x) equals \widehat{F}_m(x). E.f E.f(l,u) = \int_{l}^{u} \widehat{F}_m(t) dt phiPL Numeric vector of length m with values \widehat{φ}_m'(x_i-) phiPR Numeric vector of length m with values \widehat{φ}_m'(x_i+) phiPL.f Is a function such that phiPL.f(x) equals \widehat{φ}_m'(x-) . phiPR.f Is a function such that phiPR.f(x) equals \widehat{φ}_m'(x+) . ## Author(s) Kaspar Rufibach, kaspar.rufibach@gmail.com, http://www.kasparrufibach.ch Lutz Duembgen, duembgen@stat.unibe.ch, http://www.staff.unibe.ch/duembgen ## References Duembgen, L, Huesler, A. and Rufibach, K. (2010) 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. Duembgen, L. and Rufibach, K. (2011) logcondens: Computations Related to Univariate Log-Concave Density Estimation. Journal of Statistical Software, 39(6), 1–28. http://www.jstatsoft.org/v39/i06 ## See Also activeSetLogCon can be used to estimate a log-concave density. However, to generate an object of class dlc that allows application of summary and plot we recommend to use logConDens. 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   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 ## estimate gamma density set.seed(1977) n <- 200 x <- rgamma(n, 2, 1) res <- activeSetLogCon(x, w = rep(1 / n, n), print = FALSE) ## plot resulting functions par(mfrow = c(2, 2), mar = c(3, 2, 1, 2)) plot(res$x, exp(res$phi), type = 'l'); rug(x) plot(res$x, res$phi, type = 'l'); rug(x) plot(res$x, res$Fhat, type = 'l'); rug(x) plot(res$x, res$H, type = 'l'); rug(x) ## compute and plot function values at an arbitrary point x0 <- (res$x + res$x) / 2 Fx0 <- evaluateLogConDens(x0, res, which = 3)[, "CDF"] plot(res$x, res$Fhat, type = 'l'); rug(res$x) abline(v = x0, lty = 3); abline(h = Fx0, lty = 3) ## compute and plot 0.9-quantile of Fhat q <- quantilesLogConDens(0.9, res) plot(res$x, res$Fhat, type = 'l'); rug(res\$x) abline(h = 0.9, lty = 3); abline(v = q, lty = 3) 

logcondens.mode documentation built on May 2, 2019, 8:26 a.m.