theta.prob {untb}R Documentation

Posterior probabilities for theta

Description

Determines the posterior probability and likelihood for theta, given an ecosystem.

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 probability is given on page 122 of Hubbell (2001):

J!.theta^S / (1^{phi_1}*2^{phi_2}*...*J^{phi_J}* phi_1!*phi_2!*...*phi_J!* (theta)*(theta+1)*...*(theta+J))

The likelihood is thus given by

theta^S/((theta)*(theta+1)*...*(theta+J)).

Etienne observes that the denominator is equivalent to a Pochhammer symbol (theta)_J, so is thus readily evaluated as 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(theta) is any function of theta proportional, for fixed observation z, to the probability density 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 1 (at the maximum likelihood estimator for theta). This is not easy to determine analytically for J>5.

Note that S 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 J; an example is given below.

Function theta.prob() requires a count object (as opposed to theta.likelihood(), for which J and S 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)

a <- untb(start=rep(1,1000),gens=1000,prob=1e-3)


## Not run: 

## First, an example showing that theta.prob() is a PDF:
library(untb)
a <- count(c(dogs=3,pigs=3,hogs=2,crabs=1,bugs=1,bats=1))
x <- parts(no.of.ind(a))
f <- function(x){theta.prob(theta=1.123,extant(count(x)))}
sum(apply(x,2,f))  ## should be one exactly.
## End(Not run)

[Package untb version 1.4-2 Index]