evaluateLogConDens: Evaluates the Log-Density MLE and Smoothed Estimator at...

Description Usage Arguments Value Author(s) Examples

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

1
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)

Kaspar Rufibach, kaspar.rufibach@gmail.com,
http://www.kasparrufibach.ch

Lutz Duembgen, duembgen@stat.unibe.ch,
http://www.imsv.unibe.ch/about_us/staff/prof_dr_duembgen_lutz/index_eng.html

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## 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)

Example output

Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
          xs log-density   density       CDF smooth.density smooth.CDF
[1,] 1.68753   -1.116905 0.3272913 0.4868701      0.3213103  0.4801445
          xs log-density   density       CDF smooth.density smooth.CDF
[1,] 1.68753   -1.116905 0.3272913 0.4868701             NA         NA

logcondens documentation built on May 2, 2019, 6:11 a.m.