lcd
Class lcd
is used to store a log-concave density
function (f), where the log-density is given by a piecewise linear function.
A list consisting of:
the slope of the log-density before the first interior knot.
the normalizing constant.
vector of interior knots.
vector of changes of slope at the interior knots.
lower-boundary knot (L). This should be the smallest observed value.
upper-boundary knot (U). This should be the largest observed value.
a numeric matrix with two rows, with rows 1 and 2 storing, respectively, the intercepts and slopes of the log-density between knots.
density values at the lower boundary (lower
) and the
interior knots (theta
).
integral of x^o f(x) over each interval between knots for o = 0, 1, 2.
integral of x^o f(x) over each interval between the lower boundary and each knot.
Given an lcd
object, the density function is defined by $$f(x; \alpha, \boldsymbol{\theta}, \boldsymbol{p}, L, U) = \frac{1}{C} e^{\alpha (x-L) - \sum_{j=1}^m p_j(x-\theta_j)_+},\ \ \ \mathrm{for\ } x \in [L, U],$$ where \(C\) is the normalizing constant given by $$C = \int_L^U e^{\alpha (x - L) - \sum_{j=1}^m p_j (x-\theta_j)_+}\;dx$$
coef
, fk
, dpk
and cpk
can all worked out
from the given parameters. They are computed when a new lcd
object is created by function new.lcd()
to facilitate
computation when the object is used later.