triplot {hyperdirichlet}R Documentation

Plot density of a 3D hyperdirichlet distribution

Description

Plot (log) density of a 3D hyperdirichlet distribution

Usage

triplot(HD, l = 100, do_image=TRUE, do_contour=TRUE, discard = 0.05, ...)

Arguments

HD Either a function of a three-element vector, or a hyperdirichlet object
l Size of plot; larger values look much better but take longer
do_image,do_contour Boolean, indicating whether to plot the image and contour respectively
discard Numeric; default 0.05 means to disregard densities less than the fifth percentile (i.e. quantile 0.05). This makes the contour plot intervals prettier
... Further arguments passed to image() and contour()

Details

If argument HD is not a function it is interpreted as a hyperdirichlet object. If HD is a function, triplot() will pass it a three-element vector.

If argument HD is a hyperdirichlet object, then triplot() plots contours of the log of the density (ie support). If you want likelihood instead, see examples section for how to do this.

Value

The function returns (invisibly) an l-by-l matrix holding the support as a function of the two independent variables, with NA outside the domain.

Author(s)

Robin K. S. Hankin

Examples


a <- dirichlet(1:3)
triplot(a,l=20)

f <- function(p){1-p[1]+p[2]+8*p[2]^2*p[3]}
triplot(f)

g <- function(p){dhyperdirichlet(p, a, log=FALSE)}
triplot(g,l=20)


[Package hyperdirichlet version 1.1-7 Index]