mlebgumbel: Bimodal Gumbel: Maximum Likelihood Estimation

Description Usage Arguments Value Examples

View source: R/mlebgumbel.R

Description

Bimodal Gumbel: Maximum Likelihood Estimation

Usage

1
mlebgumbel(data, theta, auto = TRUE)

Arguments

data

A numeric vector.

theta

Vector. Starting parameter values for the minimization. Default: theta = c(1, 1, 1)

auto

Logical. Automatic search for theta initial condition. Default: TRUE

Value

List.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# Let's generate some values

set.seed(123)
x <- rbgumbel(1000, mu = -2, sigma = 1, delta = -1)

# Look for these references in the figure:

hist(x, probability = TRUE)
lines(density(x), col = 'blue')
abline(v = c(-2.5, -.5), col = 'red')
text(x = c(c(-2.5, -.5)), y = c(.05, .05), c('mu\nnear here', 'delta\nnear here'))

# Time to fit!

# If argument auto = FALSE
fit <- mlebgumbel(
   data = x,
   # try some values near the region. Format: theta = c(mu, sigma, delta)
   theta = c(-3, 2, -2),
   auto = FALSE
)
print(fit)

# If argument auto = TRUE
fit <- mlebgumbel(
   data = x,
   auto = TRUE
)
print(fit)


# Kolmogorov-Smirnov Tests

mu.sigma.delta <- fit$estimate$estimate
ks.test(
  x,
  y = 'pbgumbel',
  mu = mu.sigma.delta[[1]],
  sigma = mu.sigma.delta[[2]],
  delta = mu.sigma.delta[[3]]
)

bgumbel documentation built on April 1, 2021, 1:06 a.m.