essHist-package: The Essential Histogram

Description Details Author(s) References Examples

Description

Provide an optimal histogram, in the sense of probability density estimation and features detection, by means of multiscale variational inference. For details see Li, Munk, Sieling and Walther (2016) <arXiv:1612.07216>.

Details

Package: essHist
Type: Package
Version: 1.0.1
Date: 2018-01-30
License: The GNU General Public License

Index:

1
2
3
4
5
6
7
8
essHistogram    Compute the essential histogram
msQuantile      Simulate the quantile of multiscale statistics
checkHistogram  Check any estimator by the multiscale confidence set

dmixnorm        Compute density function of Gaussian mixtures
pmixnorm        Compute distribution function of Gaussian mixtures
rmixnorm        Generate random number of Gaussian mixtures
paramExample    Output detailed parameters for some famous examples

Author(s)

Housen Li [aut, cre], Hannes Sieling [aut]

Maintainer: Housen Li <[email protected]>

References

Li, H., Munk, A., Sieling, H., and Walther, G. (2016). The essential histogram. arXiv:1612.07216

Examples

 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
# Simulate data
set.seed(123)
n = 300
y = rnorm(n)

# Compute the essential histogram
eh = essHistogram(y, plot = FALSE)

# Plot results
#     compute oracle density
x  = seq(min(y), max(y), length.out = n)
od = dnorm(x)
#     compare with orcle density
plot(x, od, type = "l", xlab = NA, ylab = NA, col = "red")
lines(eh)
legend("topright", c("Oracle density", "Essential histogram"), 
       lty = c(1,1), col = c("red", "black"))

###########################################################

# Evaluate other method e.g. R default histogram function
# Data: mixture of Gaussians 1/3 N(0,0.5) + 1/3 N(5,1) + 1/3 N(15,2)
set.seed(123)
n = 300
y = rmixnorm(n, mean = c(0, 5, 15), sd = c(0.5, 1, 2))

# Oracle density
sy = sort(y)
ho = dmixnorm(sy, mean = c(0, 5, 15), sd = c(0.5, 1, 2))

# R default histogram
h  = hist(y, plot = FALSE)

# Check R default histogram to local multiscale constriants
b = checkHistogram(h, y)
lines(sy, ho, col = "red")
legend("topright", c("R-Histogram", "Truth"), col = c("black", "red"), lty = c(1,1))

essHist documentation built on April 9, 2018, 5:04 p.m.