Last data update: 2014.03.03

R: Find maximum likelihood estimate (MLE) of 5 parameters given...
mix.mleR Documentation

Find maximum likelihood estimate (MLE) of 5 parameters given input vector of observations, initial parameter values, and a method specifying distributions.

Description

Algorithm computes maximum likelihood estimates of the parameters of either the normal mixtuture distribution or the facing gamma distribution model for a dimorphic trait.

Usage

mix.mle(input, method = "normal", mix.prob = NULL, 
    dist1.par1 = NULL, dist1.par2 = NULL, 
    dist2.par1 = NULL, dist2.par2 = NULL, 
    lower = NULL, upper = NULL, distlist = NULL,
    optim.lower = rep(0, 5), optim.upper = c(1, rep(NA, 4)), ...)

Arguments

input

Vector of (numeric) trait observations. Observations should be strictly positive.

method

Either "normal" or "facing.gamma".

Initial parameter estimation is implemented for "normal", but is only appropriate when mix.prob is close to 0.5.
User supplies initial parameter estimates for the facing gamma mixture distribution.

mix.prob

The initial probability of mixture distributions, specifying the proportion of the upper distribution.

dist1.par1

First parameter of the lower distribution. This specifies the mean for method="normal", and the shape for method="facing.gamma".

dist1.par2

Second parameter of the lower distribution. This specifies the standard deviation for method="normal", and the scale for method="facing.gamma".

dist2.par1

First parameter of the upper distribution, specifying parameters as in dist1.par1.

dist2.par2

Second parameter of the upper distribution, specifying parameters as in dist1.par2.

distlist

Optionally, the user can specify their own list containing a lower and upper distribution (PDF) function.
Each density function must take observations and 2 positional parameters, as per dnorm.
Distributions taking >2 parameters may be used, but the remaining parameters must be encapsulated as fixed values within the functions.
If distlist is specified, then method is set to "user".

lower

For method="facing.gamma", the lower bound may be set to minimum trait size minus 0.5%, 1%, or more of the range of trait sizes.
Otherwise ignored.

upper

For method="facing.gamma"; the upper bound may be set to maximum trait size plus 0.5%, 1%, or more of the range of trait sizes.
Otherwise ignored.

optim.lower, optim.upper

Numeric vector. lower and upper bounds used by optim,
specifying: c(mix.prob, dist1.par1, dist1.par2, dist2.par1, dist2.par2).
By default, mix.prob is bounded between 0 and 1, and distribution parameters are bounded from below by 0.
optim calls these by position; thus order is significant and names are not needed.

...

Additional arguments are passed to optim. In particular, control=list(trace=5, REPORT=1) displays information about the
optimization process.

Details

Computes maximum likelihood estimates of the parameters of either the normal mixture distribution or the facing gamma distribution model for a dimorphic trait.

Value

An object of class discrimARTs, which is a list containing the original input data and parameter values, as well as output from optim.

neglogLik

Numeric. Negative 2 x log likelihood of final optimized parameters.

MLE.est

Named vector containing the final optimized parameter values.

Note

In general, method="normal" is converges well for a range of initial values. method="facing.gamma" requires more care.

References

Rowland JM, Qualls CR. 2005. Likelihood models for discriminating alternative phenotypes in morphologically dimorphic species.
Evolutionary Ecology Research 7: 421-434.

See Also

mix.loglik, optim, x_gideon, o_taurus, mix.synthetic

Examples

data(x_gideon)

## Assuming normal, estimate initial conditions from data
fit.default.gideon <- mix.mle(x_gideon$horn)

## Estimation of mixture of normals, explicitly specifying method and parameters
fit.gideon <- mix.mle(x_gideon$horn, method='normal', 
    mix.prob=0.5, dist1.par1=100, dist1.par2=10, dist2.par1=300, dist2.par2=10)

## Default printing and plotting methods
print(fit.gideon)

## Compare results
layout(1:2)
plot(fit.gideon)
plot(fit.default.gideon)

Results