| B {hyper2} | R Documentation |
Normalizing constant for the hyperdirichlet distribution
Description
Numerical techniques for calculating the normalizing constant for the hyperdirichlet distribution
Usage
B(H, disallowed=NULL, give=FALSE, ...)
probability(H, disallowed=NULL, ...)
mgf(H, powers, ...)
dhyper2(ip,H,...)
dhyper2_e(e,H,include.Jacobian=TRUE)
mean_hyper2(H, normalize=TRUE, ...)
Jacobian(e)
e_to_p(e)
p_to_e(p)
Arguments
H |
Object of class hyper2 |
powers |
Vector of length |
disallowed |
Function specifying a subset of the simplex
over which to integrate; default |
e, p |
A vector; see details |
ip |
A vector of probabilities corresponding to |
include.Jacobian |
Boolean, with default |
give |
Boolean, with default |
normalize |
Boolean, indicates whether return value of
|
... |
Further arguments passed to |
Details
Function
B()returns the normalizing constant of a hyperdirichlet likelihood function. Internally,pis converted toe(bye_to_p()) and the integral proceeds over a hypercube. This function can be very slow, especially ifdisallowedis used.Function
dhyper2(ip,H)is a probability density function on the independent components of a unit-sum vector, that is,ip=indep(p). This function callsB()each time so might be a performance bottleneck.Function
probability()gives the probability of an observation from a hyperdirichlet distribution satisfying!disallowed(p).Function
mgf()is the moment generating function, taking an argument that specifies the powers ofpneeded: the expectation of\prod_{i=1}^n {p_i}^{{\rm powers}[i]}is returned.Function
mean_hyper2()returns the mean value of the hyperdirichlet distribution. This is computationally slow (considermaxp()for a measure of central tendency). The function takes anormalizeargument, not passed toadaptIntegrate(): this is Boolean withFALSEmeaning to return the value found by integration directly, and defaultTRUEmeaning to normalize so the sum is exactly 1
Value
Function
B()returns a scalar: the normalization constantFunction
dhyper2()is a probability density function overindep(p)Function
mean()returns ak-tuple with unit sumFunction
mgf()returns a scalar equal to the expectation ofp^powerFunctions
is.proper()andvalidated()return a BooleanFunction
probability()returns a scalar, a (Bayesian) probability
Note
The adapt package is no longer available on CRAN; from 1.4-3, the
package uses adaptIntegrate of the cubature package.
Author(s)
Robin K. S. Hankin
See Also
Examples
# Two different measures of central tendency:
# mean_hyper2(chess,tol=0.1) # takes ~10s to run
maxp(chess) # faster
# Using the 'disallowed' argument typically results in slow run times;
# use high tol for speed:
# probability(chess,disallowed=function(p){p[1]>p[2]},tol=0.5)
# probability(chess,disallowed=function(p){p[1]<p[2]},tol=0.5)
# Above should sum to 1 [they are exclusive and exhaustive events]