M2C {CircMLE} | R Documentation |

## Model M2C MLE function

### Description

Run Maximum likelihood estimation for model M2C.

### Usage

```
M2C(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) and proportional size (lambda) of the first distribution (mu1 and 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

```
testdata = circular::rvonmises(100, mu = circular::circular(pi), kappa = 3)
M2C(testdata)
```

*CircMLE*version 0.3.0 Index]