M3A: Model M3A MLE function

Description Usage Arguments Value Examples

View source: R/M3A.r

Description

Run Maximum likelihood estimation for model M3A.

Usage

1
M3A(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)
M3A(testdata)

CircMLE documentation built on Feb. 20, 2018, 5:03 p.m.