Description Usage Arguments Details Value Author(s) References See Also Examples
View source: R/logLik.meteDist.R
logLikZ.meteDist
computes a log-likelihood z-score by simulation from a
fitted METE distribution
1 2 3 4 |
x |
a |
... |
arguments to be passed to methods |
nrep |
number of simulations from the fitted METE distribution |
return.sim |
logical; return the simulated liklihood values |
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, specifically
z = ((logLik_obs - mean(logLik_sim)) / sd(logLik_sim))^2.
This value is squared so that it will be approximately Chi-squared distributed and a
goodness of fit test naturally arrises as 1 - pchisq(z, df=1)
.
list with elements
The z-score
nrep
Simulated values (scaled by mean and sd as is the z-score) if return.sim=TRUE, NULL otherwise
Andy Rominger <ajrominger@gmail.com>, Cory Merow
Harte, J. 2011. Maximum entropy and ecology: a theory of abundance, distribution, and energetics. Oxford University Press.
mseZ.meteDist
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 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='scaled log(likelihood)^2',col='red')
abline(v=llz$z,lty=2)
legend('top',legend=c('data','simulated'),col=c('black','red'),
lty=c(1,1),bty='n')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.