MM (version 1.6-5)

optimizer: Maximum likelihood estimator for the MM

Description

Maximum likelihood estimator for the MM

Usage

optimizer(y, n = NULL, start = NULL, method = "nlm",
            printing = FALSE, give_fit=FALSE, ...)
optimizer_allsamesum(y, n = NULL, start = NULL, method = "nlm",
            printing = FALSE, give_fit=FALSE, ...)
optimizer_differsums(y, n = NULL, start = NULL, method = "nlm",
            printing = FALSE, give_fit=FALSE, ...)

Arguments

y

Matrix with each row being a possible observation

n

Counts of observations corresponding to rows of y

start

Start value for optimization routine, taken to be an object of class paras. Default value of NULL means to start with Lindsey(y,n), which theoretically should be the maximum likelihood estimate

method

String giving which optimization method to use. Default of Nelder means to use optim() with the Nelder-Mead method; the other supported option is nlm

printing

Boolean, with TRUE meaning to print information as the optimization progresses and default FALSE meaning to print nothing

give_fit

Boolean, with default FALSE meaning to return the maximum likelihood estimate in the form of a paras object, and TRUE meaning to return a two-element list, the first being the output of nlm() or optim() and the second being the MLE

Further arguments passed to the optimization routine. In particular, note that hessian=TRUE is useful in conjunction with give_fit=TRUE

Details

Function optimizer() is the user-friendly version: it is a wrapper for optimizer_samesum() and optimizer_differsums(); it dispatches according to whether the rowsums are identical or not.

These functions are slow because they need to evaluate NormC() repeatedly, which is expensive.

Function optimizer_samesum() nominally produces the same output as Lindsey(), but is more computationally intensive.

See Also

Lindsey

Examples

Run this code
# NOT RUN {
data(voting)
p1 <- Lindsey(voting,voting_tally)
p2 <- optimizer(voting,voting_tally,start=p1)

theta(p1) - theta(p2)   # Should be zero

# }
# NOT RUN {
data(pollen)
p1 <- optimizer(pollen)
p2 <- Lindsey(pollen)
theta(p1) - theta(p2)   #  Isn't zero...numerical scruff...
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab