Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

evaluateLogConDens

Evaluates the Log-Density MLE and Smoothed Estimator at Arbitrary Real Numbers xs


Description

Based on a "dlc" object generated by logConDens, this function computes the values of

\hat φ_m(t)

\hat f_m(t) = exp(\hat φ_m(t))

\hat F_m(t) = int_{x_1}^t exp(\hat φ_m(x)) dx

\hat f_m^*(t) = exp(\hat φ_m^*(t))

\hat F_m^*(t) = int_{x_1}^t \exp(\hat φ_m^*(x)) dx

at all real number t in xs. The exact formula for \hat F_m and t \in [x_j,x_{j+1}] is

\hat F_m(t) = \hat F_m(x_j) + (x_{j+1}-x_j) J(\hat φ_j, \hat φ_{j+1}, (t-x_j)/(x_{j+1}-x_j))

for the function J introduced in Jfunctions. Closed formulas can also be given for \hat f_m^*(t) and \hat F_m^*(t).

Usage

evaluateLogConDens(xs, res, which = 1:5, gam = NULL, print = FALSE)

Arguments

xs

Vector of real numbers where the functions should be evaluated at.

res

An object of class "dlc", usually a result of a call to logConDens.

which

A (sub-)vector of 1:5 specifying which of the above quantities should be computed.

gam

Only necessary if smoothed = TRUE. The standard deviation of the normal kernel. If equal to NULL, gam is chosen such that the variances of the original sample x_1, …, x_n and \hat f_n^* coincide. See logConDens for details.

print

Progress in computation of smooth estimates is shown.

Value

Matrix with rows (x_{0, i}, \hat φ_m(x_{0, i}), \hat f_m(x_{0, i}), \hat F_m(x_{0, i}), \hat f_m^*(x_{0, i}), \hat F_m^*(x_{0, i})) where x_{0,i} is the i-th entry of xs.

Author(s)

Examples

## estimate gamma density
set.seed(1977)
x <- rgamma(200, 2, 1)
res <- logConDens(x, smoothed = TRUE, print = FALSE)

## compute function values at an arbitrary point
xs <- (res$x[100] + res$x[101]) / 2
evaluateLogConDens(xs, res)

## only compute function values for non-smooth estimates
evaluateLogConDens(xs, res, which = 1:3)

logcondens

Estimate a Log-Concave Probability Density from Iid Observations

v2.1.5
GPL (>= 2)
Authors
Kaspar Rufibach <kaspar.rufibach@gmail.com> and Lutz Duembgen <duembgen@stat.unibe.ch>
Initial release
2016-07-11

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.