theta.prob {untb}R Documentation

Posterior probabilities for theta

Description

Determines the posterior probability and likelihood for theta, given a count object

Usage

theta.prob(theta, x=NULL, give.log=TRUE)
theta.likelihood(theta, x=NULL, S=NULL, J=NULL, give.log=TRUE)

Arguments

theta

biodiversity parameter

x

object of class count or census

give.log

Boolean, with FALSE meaning to return the value, and default TRUE meaning to return the (natural) logarithm of the value

S, J

In function theta.likelihood(), the number of individuals (J) and number of species (S) in the ecosystem, if x is not supplied. These arguments are provided so that x need not be specified if S and J are known.

Details

The formula was originally given by Ewens (1972) and is shown on page 122 of Hubbell (2001):

J!θS1ϕ12ϕ2JϕJϕ1!ϕ2!ϕJ!k=1J(θ+k1).\frac{J!\theta^S}{ 1^{\phi_1}2^{\phi_2}\ldots J^{\phi_J} \phi_1!\phi_2!\ldots \phi_J! \prod_{k=1}^J\left(\theta+k-1\right)}.

The likelihood is thus given by

θSk=1J(θ+k1).\frac{\theta^S}{\prod_{k=1}^J\left(\theta+k-1\right)}.

Etienne observes that the denominator is equivalent to a Pochhammer symbol (θ)J(\theta)_J, so is thus readily evaluated as Γ(θ+J)/Γ(θ)\Gamma(\theta+J)/\Gamma(\theta) (Abramowitz and Stegun 1965, equation 6.1.22).

Note

If estimating theta, use theta.likelihood() rather than theta.probability() because the former function generally executes much faster: the latter calculates a factor that is independent of theta.

The likelihood function L(θ)L(\theta) is any function of θ\theta proportional, for fixed observation zz, to the probability density f(z,θ)f(z,\theta). There is thus a slight notational inaccuracy in speaking of “the” likelihood function which is defined only up to a multiplicative constant. Note also that the “support” function is usually defined as a likelihood function with maximum value 11 (at the maximum likelihood estimator for θ\theta). This is not easy to determine analytically for J>5J>5.

Note that SS is a sufficient statistic for θ\theta.

Function theta.prob() does not give a PDF for θ\theta (so, for example, integrating over the real line does not give unity). The PDF is over partitions of JJ; an example is given below.

Function theta.prob() requires a count object (as opposed to theta.likelihood(), for which JJ and SS are sufficient) because it needs to call phi().

Author(s)

Robin K. S. Hankin

References

See Also

phi, optimal.prob

Examples


theta.prob(1,rand.neutral(15,theta=2))

gg <- as.count(c(rep("a",10),rep("b",3),letters[5:9]))
theta.likelihood(theta=2,gg)

optimize(f=theta.likelihood,interval=c(0,100),maximum=TRUE,x=gg)


## An example showing that theta.prob() is indeed a PMF:

a <- count(c(dogs=3,pigs=3,hogs=2,crabs=1,bugs=1,bats=1))
x <- partitions::parts(no.of.ind(a))
f <- function(x){theta.prob(theta=1.123,extant(count(x)),give.log=FALSE)}
sum(apply(x,2,f))  ## should be one exactly.

[Package untb version 1.7-7 Index]