M2B: Model M2B MLE function

Description Usage Arguments Value Examples

View source: R/M2B.r

Description

Run Maximum likelihood estimation for model M2B.

Usage

1
M2B(data, BadStart, nchains, method, niter)

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)

Value

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

$par: Vector with the optimized mean angle (mu1) and concentration parameter (kappa1)

$lik: The negative log likelihood

$counts: A two-element integer vector giving the number of calls to ‘fn’ and ‘gr’ respectively. See ?optim() for details.

$convergence: An integer code. ‘0’ indicates successful completion (which is always the case for ‘"SANN"’ and ‘"Brent"’). Possible error codes are:

‘1’ indicates that the iteration limit ‘maxit’ had been reached.

‘10’ indicates degeneracy of the Nelder-Mead simplex.

‘51’ indicates a warning from the ‘"L-BFGS-B"’ method; see component ‘message’ for further details.

‘52’ indicates an error from the ‘"L-BFGS-B"’ method; see component ‘message’ for further details.

$message: A character string giving any additional information returned by the optimizer, or ‘NULL’.

Examples

1
2
testdata = circular::rvonmises(100, mu = circular::circular(pi), kappa = 3)
M2B(testdata)

Example output

$par
[1] 3.171970 4.957827

$lik
[1] 123.1067

$counts
function gradient 
      27       10 

$convergence
[1] 0

$message
NULL

CircMLE documentation built on Sept. 2, 2020, 1:07 a.m.