powered by
Calculates and plots highest density regions for a conditional density estimate. Uses output from cde().
cde()
hdr.cde(den, prob = c(0.5, 0.95, 0.99), plot = TRUE, nn = 1000, ...)
array (a,b,c) where where a specifies conditioning value, b gives the HDR endpoints and c gives the probability coverage.
estimated mode of each conditional density
The result is returned invisibly if plot=TRUE.
plot=TRUE
Conditional density in the same format as the output from cde().
Probability coverage level for HDRs
Should HDRs be plotted? If FALSE, results are returned.
Number of points to be sampled from each density when estimating the HDRs.
Other arguments passed to plot.hdrcde().
plot.hdrcde()
Rob J Hyndman
Hyndman, R.J., Bashtannyk, D.M. and Grunwald, G.K. (1996) "Estimating and visualizing conditional densities". Journal of Computational and Graphical Statistics, 5, 315-336.
plot.hdrcde(), cde(),
faithful.cde <- cde(faithful$waiting, faithful$eruptions) faithful.hdr <- hdr.cde(faithful.cde, prob = c(0.50, 0.95)) faithful.hdr plot(faithful.hdr, xlab = "Waiting time", ylab = "Duration time")
Run the code above in your browser using DataLab