custom: Highest density region (HDR) for an arbitrary distributions

Description Usage Arguments Value See Also Examples

Description

Highest density region (HDR) for an arbitrary distributions

Usage

 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
37
38
39
40
41
42
43
44
HDR.monotone(
  cover.prob,
  Q,
  decreasing = TRUE,
  distribution = UNSPECIFIED_LABEL,
  ...
)

HDR.unimodal(
  cover.prob,
  Q,
  f = NULL,
  u = NULL,
  distribution = UNSPECIFIED_LABEL,
  ...,
  gradtol = 1e-10,
  steptol = 1e-10,
  iterlim = 100
)

HDR.bimodal(
  cover.prob,
  Q,
  f = NULL,
  u = NULL,
  distribution = UNSPECIFIED_LABEL,
  ...,
  gradtol = 1e-10,
  steptol = 1e-10,
  iterlim = 100
)

HDR.discrete.unimodal(
  cover.prob,
  Q,
  F,
  f = NULL,
  u = NULL,
  distribution = UNSPECIFIED_LABEL,
  ...,
  gradtol = 1e-10,
  steptol = 1e-10,
  iterlim = 100
)

Arguments

cover.prob

The probability coverage for the HDR (scalar between zero and one). The significance level for the HDR i is 1-cover.prob.

Q

an inverse CDF of a distribution

decreasing

Direction of monotone distribution

distribution

a label

...

Arguments for Q, f and u

f

a PDF of a distribution

u

a log-derivative of f

gradtol

Parameter for the nlm optimisation - a positive scalar giving the tolerance at which the scaled gradient is considered close enough to zero to terminate the algorithm (see [nlm doccumentation](https://stat.ethz.ch/R-manual/R-patched/library/stats/html/nlm.html)).

steptol

Parameter for the nlm optimisation - a positive scalar providing the minimum allowable relative step length (see [nlm doccumentation](https://stat.ethz.ch/R-manual/R-patched/library/stats/html/nlm.html)).

iterlim

Parameter for the nlm optimisation - a positive integer specifying the maximum number of iterations to be performed before the program is terminated (see [nlm doccumentation](https://stat.ethz.ch/R-manual/R-patched/library/stats/html/nlm.html)).

F

a CDF of a distribution

Value

An interval object with classes hdr and interval containing the highest density region and related information.

See Also

HDR.discrete

Examples

1
2
3
4
5
6
7
HDR.monotone(.95, Q=qexp)

HDR.unimodal(.95, Q=qnorm)

HDR.bimodal(.95, Q=qbeta, shape1=1/2, shape2=1/2)

HDR.discrete.unimodal(.95, Q=qpois, F=ppois, lambda=1)

stat.extend documentation built on Nov. 23, 2021, 5:06 p.m.