bipoilogMLE
fits the bivariate Poisson lognormal distribution to data
bipoilogMLE(n1, n2 = NULL,
startVals = c(mu1=1, mu2=1, sig1=2, sig2=2, rho=0.5),
nboot = 0, zTrunc = TRUE, file = NULL,
method = "BFGS", control = list(maxit=1000))
a vector or a matrix with two columns of pairwise counts of observed individuals for each species
if n1 is not given as a matrix, a vector of counts with same ordering of species as in argument n1
starting values of parameters
number of parametric bootstraps, defaults to zero
logical; if TRUE (default) the zero-truncated distribution is fitted
text file to hold copies of bootstrap estimates
method to use during optimization, see details
a list of control parameters for the optimization routine, see details
Maximum likelihood estimates of the parameters
Approximate fraction of species revealed by the samples for sample 1 and 2 respectively
Log likelihood of the data given the estimated parameters
Godness of fit measure obtained by checking the rank of logLval against logLval's obtained
during the bootstrap procedure, (gof
< 0.05) or (gof
> 0.95) indicates lack of fit
A data frame containing the bootstrap replicates of parameters and logLval
The function estimates the parameters mu1
, sig1
, mu2
, sig2
and rho
.
In cases of incomplete sampling the estimates of mu1
and mu2
will be confounded with the sampling
intensities (see rbipoilog
). Assuming sampling intensities sig1
, sig2
and rho
can be estimated without any knowledge of sampling intensities.
The parameters must be given starting values for the optimization procedure (default starting values are
used if starting values are not specified in the function call).
A zero-truncated distribution (see dbipoilog
) is assumed by default (zTrunc = TRUE
).
In cases where the number of zeros is known the zTrunc
argument should be set to FALSE
.
The function uses the optimization procedures in optim
to obtain the maximum likelihood estimate.
The method
and control
arguments are passed to optim
, see the help page for this
function for additional methods and control parameters.
The approximate fraction of species revealed by each sample is estimated as 1 minus the zero term of the
univariate Poisson lognormal distribution:
Parametric bootstrapping could be time consuming for large data sets. If argument file
is specified, e.g.
file =
‘C:\\myboots.txt
’, the matrix with bootstrap estimates are copied into a tab-seperated text-file
providing extra backup. Bootstrapping is done by simulating new sets of observations conditioned on the observed number of
species (see rbipoilog
).
Engen, S., R. Lande, T. Walla and P. J. DeVries. 2002. Analyzing spatial structure of communities using the two-dimensional Poisson lognormal species abundance model. American Naturalist 160, 60-73.
optim
, dbipoilog
, rbipoilog
## simulate observations
xy <- rbipoilog(S=30,mu1=1,mu2=1,sig1=2,sig2=2,rho=0.5)
## obtain estimates of parameters
est <- bipoilogMLE(xy)
## similar, but now with bootstrapping
## Not run: est <- bipoilogMLE(xy,nboot=10)
## change start values and request tracing information
## from optimization procedure
est <- bipoilogMLE(xy,startVals=c(2,2,4,4,0.3),
control=list(maxit=1000,trace=1, REPORT=1))
## effect of sampling intensity
xy <- rbipoilog(S=100,mu1=1,mu2=1,sig1=2,sig2=2,rho=0.5,nu1=0.5,nu2=0.5)
est <- bipoilogMLE(xy)
## the expected estimates of mu1 and mu2 are now 1-log(0.5) = 0.3 (approximately)
Run the code above in your browser using DataLab