Learn R Programming

CircMLE (version 0.3.0)

M4B: Model M4B MLE function

Description

Run Maximum likelihood estimation for model M4B.

Usage

M4B(data, BadStart, nchains, method, niter, lambda.min)

Arguments

data

A vector of class 'circular'

BadStart

An integer to replace the log likelihood when starting parameters of the optimizer fall outside the preset bounds. This is usually set to a large number. Can also be set to Inf, but will result in an error if a method other than "Nelder-Mead" is chosen. (default = 10^9)

nchains

A positive integer indicating the number of chains to run. Only the chain with the lowest log likelihood is returned (default = 5)

method

A character string indicating the optimizing algorithm to use. Either "BFGS" or "Nelder-Mead" are recommended. See ?optim for more details. (default = "BFGS")

niter

The maximum number of iterations for the optimizing algorithm. Equivalent to the 'maxit' control parameter of the optim() function. See ?optim for more details. (default = 5000)

lambda.min

The minimum proportional size of the first distribution. Must be between 0 and 1. (default = 0.25)

Value

A list with elements (same as for function optim()):

$par: Vector with the optimized mean angle (mu1), concentration parameter (kappa1), concentration parameter (kappa2), and proportional size (lambda) of the first distribution.

$lik: The negative log likelihood

$counts: A two-element integer vector giving the number of calls to <U+2018>fn<U+2019> and <U+2018>gr<U+2019> respectively. See ?optim() for details.

$convergence: An integer code. <U+2018>0<U+2019> indicates successful completion (which is always the case for <U+2018>"SANN"<U+2019> and <U+2018>"Brent"<U+2019>). Possible error codes are:

<U+2018>1<U+2019> indicates that the iteration limit <U+2018>maxit<U+2019> had been reached.

<U+2018>10<U+2019> indicates degeneracy of the Nelder-Mead simplex.

<U+2018>51<U+2019> indicates a warning from the <U+2018>"L-BFGS-B"<U+2019> method; see component <U+2018>message<U+2019> for further details.

<U+2018>52<U+2019> indicates an error from the <U+2018>"L-BFGS-B"<U+2019> method; see component <U+2018>message<U+2019> for further details.

$message: A character string giving any additional information returned by the optimizer, or <U+2018>NULL<U+2019>.

Examples

Run this code
# NOT RUN {
testdata = circular::rvonmises(100, mu = circular::circular(pi), kappa = 3)
M4B(testdata)
# }

Run the code above in your browser using DataLab