poilogMLE: maximum likelihood estimation for the Poisson lognormal

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/texmexseq.R

Description

Fit a set of OTU counts to the Poisson lognormal distribution.

Usage

1
2
  poilogMLE(n, start.mu, start.sig, trunc=TRUE, method='L-BFGS-B',
  control=list(fnscale=length(n)), ...)

Arguments

n

vector of observed counts

start.mu

initial estimate for the lognormal mean

start.sig

initial estimate for the lognormal standard deviation

trunc

remove weight from zero counts?

method

optimization method for optim

control

list of parameters for optim

...

further parameters to go to optim

Details

The function estimates parameters mean mu and standard deviation sig.

The parameters must be given starting values for the optimization procedure. The default values here worked well when fitting OTUs in the referenced paper.

The function uses the optimization procedures in optim to make the maximum likelihood estimate. The method and control arguments are passed to optim.

A zero-truncated distribution (see dpoilog) is assumed by default. Truncation should only be turned off if all the known OTUs of the sequenced community are known. In most cases, this is not applicable, since it is usually not possible to know if an OTU had zero counts because it is not present in the environment or if it is present but in low abundance.

Value

par

Maximum likelihood estimates of the parameters

p

Approximate fraction of OTUs revealed by the sample

logLval

Log likelihood of the data given the estimated parameters

Author(s)

Scott Olesen swo@mit.edu

See Also

dpoilog optim

Examples

1
2
3
4
5
6
7
8
# create some random data
x <- rpoilog(S=1000, mu=-2.0, sig=2.0, keep0=FALSE)

# fit that data
res <- poilogMLE(x, 2.0, -2.0)

# the results should be fairly robust to the starting parameters
res2 <- poilogMLE(x, 1.0, 0.5)

Example output

Loading required package: dplyr

Attaching package: 'dplyr'

The following objects are masked from 'package:stats':

    filter, lag

The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union

Loading required package: ggplot2

texmexseq documentation built on May 29, 2017, 11:25 p.m.