Last data update: 2014.03.03

R: Maximum likelihood estimator for the MM
optimizerR Documentation

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.

Author(s)

Robin K. S. Hankin

See Also

Lindsey

Examples

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...

## End(Not run)

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(MM)
Loading required package: magic
Loading required package: abind
Loading required package: partitions
Loading required package: emulator
Loading required package: mvtnorm
Loading required package: Oarray
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/MM/optimizer.Rd_%03d_medium.png", width=480, height=480)
> ### Name: optimizer
> ### Title: Maximum likelihood estimator for the MM
> ### Aliases: optimizer optimizer_allsamesum optimizer_differsums
> 
> ### ** Examples
> 
> data(voting)
> p1 <- Lindsey(voting,voting_tally)
> p2 <- optimizer(voting,voting_tally,start=p1)
> 
> theta(p1) - theta(p2)   # Should be zero
    Lib Con Lab
Lib   0   0   0
Con   0   0   0
Lab   0   0   0
> 
> ## Not run: 
> ##D data(pollen)
> ##D p1 <- optimizer(pollen)
> ##D p2 <- Lindsey(pollen)
> ##D theta(p1) - theta(p2)   #  Isn't zero...numerical scruff...
> ## End(Not run)
> 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>