theta.prob {untb}R Documentation

Posterior probabilities for theta

Description

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

Usage

theta.prob(theta,x=NULL,S=no.of.spp(x),J=no.of.ind(x),give.log=FALSE)
theta.likelihood(theta,x=NULL,S=no.of.spp(x),J=no.of.ind(x),give.log=FALSE)

Arguments

theta Biodiversity parameter
x object of class count or census
give.log Boolean, with default FALSE meaning to return the probability or likelihood, and TRUE meaning to return the logarithm of the probability, or the log-likelihood
S If x is not supplied, the number of species in the ecosystem.
J If x is not supplied, the number of individuals in the ecosystem. Arguments S and J are provided so that x need not be supplied if S and J are known.

Note

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

Author(s)

Robin K. S. Hankin

References

S. P. Hubbell. The Unified Neutral Theory of Biodiversity. Princeton University Press, 2001.

http://en.wikipedia.org/wiki/Untb

See Also

phi, optimal.prob

Examples


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: 
optimize(f=theta.likelihood,interval=c(0,100),maximum=TRUE,x=a)
## End(Not run)
## Fails due to numerical overshoot

optimize(f=theta.likelihood,interval=c(0,100),maximum=TRUE,x=a,give.log=TRUE)
## Compare the true value of 2 (=2*1e-3*1000).  Not bad.

[Package untb version 1.0-20 Index]