# Maximum Likelihood Estimation for Bivariate Poisson Lognormal Distribution

### Description

`bipoilogMLE`

fits the bivariate Poisson lognormal distribution to data

### Usage

1 2 3 4 |

### Arguments

`n1` |
a vector or a matrix with two columns of pairwise counts of observed individuals for each species |

`n2` |
if n1 is not given as a matrix, a vector of counts with same ordering of species as in argument n1 |

`startVals` |
starting values of parameters |

`nboot` |
number of parametric bootstraps, defaults to zero |

`zTrunc` |
logical; if TRUE (default) the zero-truncated distribution is fitted |

`file` |
text file to hold copies of bootstrap estimates |

`method` |
method to use during optimization, see details |

`control` |
a list of control parameters for the optimization routine, see details |

### Details

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 *ν1* and *ν2*,
the estimates of the means are *\code{mu1}+ \ln nu1* and *\code{mu2}+ \ln nu2*. Parameters
`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: *1-q(0;\code{mu1},\code{sig1})* and *1-q(0;\code{mu2},\code{sig2})*.

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`

).

### Value

`par ` |
Maximum likelihood estimates of the parameters |

`p ` |
Approximate fraction of species revealed by the samples for sample 1 and 2 respectively |

`logLval ` |
Log likelihood of the data given the estimated parameters |

`gof ` |
Godness of fit measure obtained by checking the rank of logLval against logLval's obtained
during the bootstrap procedure, ( |

`boot ` |
A data frame containing the bootstrap replicates of parameters and logLval |

### Author(s)

Vidar Grøtan vidar.grotan@bio.ntnu.no, Steinar Engen

### References

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.

### See Also

`optim`

, `dbipoilog`

, `rbipoilog`

### Examples

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
## 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)
``` |