Description Usage Arguments Details Value Author(s) Examples
Plot (log) density of a 3D hyperdirichlet distribution
1 |
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 |
labels |
Length three character vector for corner labels with
default |
... |
Further arguments passed to |
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.
Labels will be printed at the appropriate corners; use
par(xpd=TRUE)
to suppress clipping.
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.
Robin K. S. Hankin
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | a <- dirichlet(1:3)
triplot(a,l=20)
old.par <- par(no.readonly=TRUE);par(xpd=TRUE) # (needed for labels)
pnames(a) <- letters[1:3]
triplot(a,l=33)
f <- function(p){1-p[1]+p[2]+8*p[2]^2*p[3]}
triplot(f,labels=LETTERS[1:3])
g <- function(p){dhyperdirichlet(p, a, log=FALSE)}
triplot(g,l=20)
par(old.par)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.