R/circexp.mle.R

Defines functions circexp.mle

Documented in circexp.mle

circexp.mle <- function(x, rads = FALSE, tol = 1e-06) {
  if ( !rads )   x <- x * pi/180
  n <- length(x)
  sx <- sum(x)
  fun <- function(lam, n, sx)  n * log(lam) - lam * sx - sum( log( 1 - exp(-2 * pi * lam) ) )
  mod <- optimise(fun, c(0.00001, 1000), n = n, sx = sx, tol = tol)
  list(loglik = mod$objective, lambda = mod$maximum)
}

Try the Directional package in your browser

Any scripts or data that you put into this service are public.

Directional documentation built on Oct. 12, 2023, 1:07 a.m.