activeSetLogCon {logcondens} | R Documentation |
Computes a Log-Concave Probability Density Estimate via an Active Set Algorithm
Description
Given a vector of observations {\bold{x}_n} = (x_1, \ldots, x_n)
with not necessarily equal entries,
activeSetLogCon
first computes vectors {\bold{x}_m} = (x_1, \ldots, x_m)
and {\bold{w}} = (w_1, \ldots, w_m)
where w_i
is the weight of each x_i
s.t.
\sum_{i=1}^m w_i = 1
.
Then, activeSetLogCon
computes a concave, piecewise
linear function \widehat \phi_m
on [x_1, x_m]
with knots only in \{x_1, \ldots, x_m\}
such that
L(\phi) = \sum_{i=1}^m w_i \phi(x_i) - \int_{-\infty}^\infty \exp(\phi(t)) dt
is maximal. To accomplish this, an active set algorithm is used.
Usage
activeSetLogCon(x, xgrid = NULL, print = FALSE, w = NA)
Arguments
x |
Vector of independent and identically distributed numbers, not necessarily unique. |
xgrid |
Governs the generation of weights for observations. See |
print |
|
w |
Optional vector of weights. If weights are provided, i.e. if |
Value
xn |
Vector with initial observations |
x |
Vector of observations |
w |
The vector of weights that had been used. Depends on the chosen setting for |
phi |
Vector with entries |
IsKnot |
Vector with entries IsKnot |
L |
The value |
Fhat |
A vector
|
H |
Vector
at zero and |
n |
Number of initial observations. |
m |
Number of unique observations. |
knots |
Observations that correspond to the knots. |
mode |
Mode of the estimated density |
sig |
The standard deviation of the initial sample |
Author(s)
Kaspar Rufibach, kaspar.rufibach@gmail.com,
http://www.kasparrufibach.ch
Lutz Duembgen, duembgen@stat.unibe.ch,
https://www.imsv.unibe.ch/about_us/staff/prof_dr_duembgen_lutz/index_eng.html
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 https://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. doi:10.18637/jss.v039.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
## 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[100] + res$x[101]) / 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)[2]
plot(res$x, res$Fhat, type = 'l'); rug(res$x)
abline(h = 0.9, lty = 3); abline(v = q, lty = 3)