Description Usage Arguments Details Value Author(s) See Also Examples
Create, coerce to, or test for an object of class hyperdirichlet
| 1 2 3 | hyperdirichlet(x, NC, pnames = character(), validated=FALSE)
is.hyperdirichlet(x)
as.hyperdirichlet(x, calculate_NC = FALSE , ...)
 | 
| x | Object to be coerced or tested for | 
| NC | Normalizing constant | 
| pnames | names of the columns with length-0 default  resulting in
the print method using column names  | 
| validated | Boolean.  Setting to  Default  Setting to  | 
| calculate_NC | Boolean, with default  | 
| ... | Further arguments passed to  | 
To determine the normalization constant, use something like a <-
  as.hyperdirichlet(a,calculate_NC= TRUE).
Matrices may be coerced to a hyperdichlet object using
as.hyperdirichlet(): the call is dispatched to
matrix_to_HD() (qv).
If x is a matrix, be sure to specify the bernoulli
argument, which is passed on to matrix_to_HD()
Functions hyperdirichlet() and as.hyperdirichlet()
return a hyperdirichlet object; function is.hyperdirichlet()
returns a Boolean.
Robin K. S. Hankin
| 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 | (a <- uniform(3))
a[c(TRUE,TRUE,FALSE)] <- 0.3
## Not run: 
(a <- as.hyperdirichlet(a, calculate_NC = TRUE))  # recommended way to calculate NC
## End(Not run)
(b <- dirichlet(1:3))
as.hyperdirichlet(b)          # "forgets" the normalizing constant
## Not run: 
as.hyperdirichlet(b, TRUE)    # recalculates NC; accuracy tolerable
                              # (analytic answer = 1/60)
## End(Not run)
## Not run:   # takes a long time
op <- options()
options(warn = -1)
x <- dirichlet(rep(2,4)) + justpairs(matrix(1,4,4))
f <- function(p){p[1]>p[2]}
probability(x,f) # should be 0.5: distribution is symmetric
## End(Not run)
# following example reveals a bug in versions <= 1.3:
d <- dirichlet(1:3)
colMeans(rhyperdirichlet(1e3,d))
# result should be (1:3)/6
# implementation >= 1.4 includes a bugfix sent by Simon Byrne
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.