Learn R Programming

meteR (version 1.0)

logLikZ: Compute log-likelihood z-score

Description

logLikZ.meteDist computes a log-likelihood z-score by simulation from a fitted METE distribution

Usage

logLikZ(x, ...)

## S3 method for class 'meteDist': logLikZ(x, nrep, return.sim = FALSE, ...)

Arguments

x
a meteDist object
...
arguments to be passed to methods
nrep
number of simulations from the fitted METE distribution
return.sim
logical; return the simulated liklihood values

Value

  • list with elements [object Object],[object Object],[object Object]

Details

logLikZ.meteDist simulates from a fitted METE distribution (e.g. a species abundance distribution or individual power distribution) and calculates the likelihood of these simulated data sets. The distribution of these values is compared against the likelihood of the data to obtain a z-score.

References

Harte, J. 2011. Maximum entropy and ecology: a theory of abundance, distribution, and energetics. Oxford University Press.

See Also

mseZ.meteDist

Examples

Run this code
data(arth)
## object holding ecosystem structure function
esf1 <- meteESF(spp=arth$spp,
                abund=arth$count,
                power=arth$mass^(.75),
                minE=min(arth$mass^(.75)))
## calculate individual power distribution
ipd1 <- ipd(esf1)
## calculate z-score, keeping all simulated log likelihoods for plotting
llz <- logLikZ(ipd1, nrep=100, return.sim=TRUE)

plot(density(llz$sim),xlim=range(c(llz$sim,llz$obs)),
     xlab='log(likelihood)',col='red')
abline(v=llz$obs,lty=2)
legend('top',legend=c('data','simulated'),col=c('black','red'),
      lty=c(1,1),bty='n')

Run the code above in your browser using DataLab