preseqR.ztnb.em: Fitting a zero-truncated negative binomial distribution

Description Usage Arguments Details Value Author(s) Examples

View source: R/ztnb.R

Description

preseqR.ztnb.em fits a zero-truncated negative binomial (ZTNB) distribution to the initial sample. Since the species with zero observations are missed in the sample, an EM algorithm is used to estimate the parameters assuming the number of individuals for each species follows a Negative Binomial distribution with the zero counts as a missing latent data.

Usage

1
preseqR.ztnb.em(n, size = SIZE.INIT, mu = MU.INIT)

Arguments

n

A two-column matrix. The first column is the frequency j = 1,2,…; and the second column is N_j, the number of species with each species represented exactly j times in the initial sample. The first column must be sorted in an ascending order.

size

A positive double setting the initial value of the parameter size in a negative binomial distribution for the EM algorithm. Default value is 1.

mu

A positive double setting the initial value of the parameter mu in a negative binomial distribution for the EM algorithm. Default value is 0.5.

Details

See the supplement of Daley and Smith (2013).

Value

size

The estimate of the parameter size in the negative binomial.

mu

The estimate of the parameter mu in the negative binomial.

loglik

Log-likelihood under estimated ZTNB.

Author(s)

Chao Deng

Examples

1
2
3
4
5
6
7
8
## load library
library(preseqR)

## import data
data(FisherButterfly)

## print the parameters of a fitting negative binomial distribution
preseqR.ztnb.em(FisherButterfly)

Example output

$size
          [,1]
[1,] 0.5255459

$mu
        [,1]
[1,] 7.75146

$loglik
          [,1]
[1,] -2006.948

There were 50 or more warnings (use warnings() to see the first 50)

preseqR documentation built on May 2, 2019, 6:39 a.m.