MLE: A convenience function to carry out maximum likelihood...

Description Usage Arguments Value

Description

A convenience function to carry out maximum likelihood estimation using either optim or nlm.

Usage

1
2
3
MLE(dat, mle_fn, start, priors = NULL, gr_fn = NULL, method = NULL,
  control = list(), hessian = T, alpha = 0.9544997, emStop = 20,
  nRep = 1, parNames = NULL)

Arguments

dat

the data to be fitted; can be in a variety of forms as long as it is compatible with the mle_fn function that is passed in.

mle_fn

a function to compute the sum of the log-likelihoods for a vector of parameters prm, the data dat, and control parameters sum and priors.

start

either a vector of initial starting values for the parameters, or a function (which takes no parameters) used to generate a dispersed set of starting values.

gr_fn

an optional function to compute the gradients for the parameters being estimated. See optim.

method

the optimization algorithm to use. See optim. If NULL, a step-by-step approach is used, where viable estimates and standard errors are sought by first trying the 'BFGS' method, then the 'BFGS' method using initial estimates from a 'Nelder-Mead' approach, then the 'nlm' approach, and finally the 'Nelder-Mead' algorithm.

control

a named list where options controlling the optimization can be specified. See optim and nlm. The lower and upper limits for the 'Brent' method can also be specified in this list.

hessian

a logical value; if true, the hessian matrix is estimated, allowing the derivation of standard errors and confidence intervals.

alpha

the width of the interval for the confidence intervals around parameters. Defaults to +/- two standard deviations.

emStop

the number of iterations used when attempting to generate viable starting values.

nRep

the number of times to repeat estimation using dispersed starting values. Only applicable when a function to generate starting values is provided.

parNames

an optional character vector giving a set of labels for the parameters being estimated.

Value

Forthcoming.


rettopnivek/mle documentation built on May 5, 2019, 5:54 p.m.