Description Usage Arguments Value Note Author(s) References See Also Examples
This is an adapted version of activeSetLogCon from the logcondens package for computing the MLE of a log-concave density with known location of mode.
Given a vector of observations x_n = (x_1, …, x_n) with potentially distinct or
nondistinct entries, activeSetLogCon.mode
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. The vector \bold{x}_m contains the
fixed location of the mode, mode
. Then,
activeSetLogCon.mode
computes a concave, piecewise
linear function \widehat φ_m^0 on
[x_1, x_m] with p knots only in {x_1, …, x_m} and with mode value, mode
, 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.
1 2 |
x |
Vector of independent and identically distributed numbers, not necessarily unique. |
xgrid |
Governs the generation of weights for observations. See
|
mode |
This is the constrained value for the location of the mode. |
print |
|
w |
Optional vector of weights. If weights are provided, i.e., if
|
prec |
Governs precision of various subfunctions, e.g., the Newton-Raphson procedure. |
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 \bold{x} always includes the mode
value |
w |
The vector of weights that had been used. Depends on the
chosen setting for |
L |
The value L(φ_m^0) of the log-likelihood-function L at the maximum \widehat φ_m^0. |
MI |
Numeric vector of length 2 giving the endpoints of the modal interval. |
IsKnot |
Vector with entries IsKnot_i = 1\{\widehat{φ}_m^0 has a kink at x_i}. |
IsMIC |
Analogous to IsKnot; stands for "Is Modally Inactive Constraint," i.e., denotes whether the modal constraints are active or inactive. It is a numeric vector of length 2, corresponding to whether the mode is a left-knot or a right-knot. Just as with IsKnot, a 1 denotes an inactive constraint and a 0 denotes an active one. Thus a 0 indicates that the constraint that the estimate be equal in value at the mode and the nearest knot to the left or to the right, respectively, is active. Note also that if max(IsMIC)==1 then the corresponding index in IsKnot is a 1 (i.e., IsKnot[dlcMode$idx] ==1 ). |
constr |
knots[constr] is equal to MI; that is, constr is a numeric (integral) vector of length two with values in 1, …, p indicating which of the p knots are the left and right of the modal interval. |
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^0(x_i) = e^{\widehat{φ}_m^0(x_i)}, i=1,…, m. |
Fhat |
A vector (\widehat F_{m,i}^0)_{i=1}^m of the same size as x with entries \widehat F_{m,i}^0 = \int_{x_1}^{x_i} \exp(\widehat φ_m^0(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) if x_i is
less than Note that in the unconstrained problems the derivatives in the directions \min(x_i - x, 0) and \min(x-x_i,0) are equal, but in the constrained problem these derivatives are not equal. |
H.m |
Vector (H.m_1, H.m_2)' where H.m_1 is the derivative of t \to L(φ + tΔ_i) at zero and Δ_1(x) = \min(x - a, 0) and Δ_2(x) = \min(a-x, 0), where a is the mode. |
n |
Number of initial observations, i.e., length of |
m1 |
Number of unique observations. This count excludes the mode
if the mode is not a data point (or if |
m |
Number of points used to compute the estimator, i.e., unique
observations as well as the mode, i.e., length of |
dlcMode |
A list, of class "dlc.mode", with components Note, when the mode is not an |
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,
|
fhat.f |
Is a function such that |
Fhat.f |
Is a function such that |
EL.f |
Note that this is not analogous to |
ER.f |
|
E.f |
Equals |
phiPL |
Numeric vector of length m with values (\widehat{φ}_m^0)'(x_i-) |
phiPR |
Numeric vector of length m with values (\widehat{φ}_m^0)'(x_i+) |
phiPL.f |
Is a function such that |
phiPR.f |
Is a function such that |
Adapted from
activeSetLogCon
in the
package logcondens
.
Kaspar Rufibach, kaspar.rufibach@gmail.com,
http://www.kasparrufibach.ch
Lutz Duembgen, duembgen@stat.unibe.ch,
http://www.staff.unibe.ch/duembgen
Charles R. Doss, cdoss@stat.washington.edu,
http://www.stat.washington.edu/people/cdoss/
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
Doss, C. R. (2013). Shape-Constrained Inference for Concave-Transformed Densities and their Modes. PhD thesis, Department of Statistics, University of Washington, in preparation.
Doss, C. R. and Wellner, J. A. (2013). Inference for the mode of a log-concave density. Technical Report, University of Washington, in preparation.
The following functions are used by activeSetLogCon.mode
:
J00
, J10
, J11
,
J20
,
Local_LL.mode
,
LocalLLall.mode
,
LocalCoarsen.mode
, LocalConvexity.mode
,
LocalExtend
, LocalF
,
LocalMLE.mode
,
LocalNormalize
,
MLE.mode
logConDens
(or activeSetLogCon
) can be used to estimate an unconstrained
log-concave density.
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 27 28 29 30 31 32 33 34 35 36 | ## estimate gamma density
set.seed(1977)
n <- 200
x <- rgamma(n, 2, 1)
TRUEMODE <- 1; ## (2-1)*1
res <- activeSetLogCon.mode(x, mode=TRUEMODE, w = rep(1 / n, n), print = FALSE)
## plot resulting functions
par(mfrow = c(2, 2), mar = c(3, 2, 1, 2))
plot(res$x, res$fhat, type = 'l'); rug(res$xn)
plot(res$x, res$phi, type = 'l'); rug(res$xn)
plot(res$x, res$Fhat, type = 'l'); rug(res$xn)
plot(res$x, res$H, type = 'l'); rug(res$xn)
## Or can use the ".f" functions
xpts <- seq(from=0, to=9, by=.01)
par(mfrow = c(2, 2), mar = c(3, 2, 1, 2))
plot(xpts, res$fhat.f(xpts), type = 'l'); rug(res$xn)
plot(xpts, res$phi.f(xpts), type = 'l'); rug(res$xn)
## these are not analogous to res$H.
plot(xpts, res$EL.f(upper=xpts), type = 'l'); rug(res$xn)
plot(xpts, res$ER.f(lower=xpts), type = 'l'); rug(res$xn)
## 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
alpha <- .1
q <- quantilesLogConDens(1-alpha, res)[2]
plot(res$x, res$Fhat, type = 'l'); rug(res$x)
abline(h = 1-alpha, lty = 3); abline(v = q, lty = 3)
|
Loading required package: logcondens
Attaching package: 'logcondens.mode'
The following objects are masked from 'package:logcondens':
activeSetLogCon, intF, logConDens
The following object is masked from 'package:base':
dir.exists
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.