Estimate theta of the Negative Binomial by Moments

DESCRIPTION:

Given the mean estimate, calculate the moment estimator of theta by equating
sum((y-mu)^2/(mu+mu^2/theta))to the residual degrees of freedom.

USAGE:

theta.mm(y, u, dfr, limit = 10, eps = sqrt(.Machine$single.eps))

REQUIRED ARGUMENTS:

y
Vector of observed values from the Negative Binomial.
u
Estimated mean vector.
dfr
Residual degrees of freedom (assuming theta known).

OPTIONAL ARGUMENTS:

limit
Limit on the number of iterations.
eps
Tolerance to determine convergence.

VALUE:

The required estimate of theta, as a scalar.

SEE ALSO:

, ,

EXAMPLES:

theta <- theta.mm(y, fitted(fm), dfr = 123)