Learn R Programming

modeest (version 1.09)

distribMode: Computing the Mode of Some Distributions

Description

These functions return the mode of the main probability distributions implemented in R.

Usage

## Continuous distributions
  betaMode(shape1, shape2, ncp = 0) # Beta
  cauchyMode(location = 0, ...) # Cauchy
  chisqMode(df, ncp = 0) # Chisquare
  expMode(...) # Exponentiel
  fMode(df1, df2) # F
  frechetMode(loc = 0, scale = 1, shape = 1, ...) # Frechet (package 'evd')
  gammaMode(shape, rate = 1, scale = 1/rate) # Gamma
  normMode(mean = 0, ...) # Normal (Gaussian)
  gevMode(loc = 0, scale = 1, shape = 0, ...) # Generalised Extreme Value (package 'evd')
  ghMode(alpha = 1, beta = 0, delta = 1, mu = 0, 
         lambda = 1, ...) # Generalised Hyperbolic (package 'fBasics')
  gpdMode(loc = 0, scale = 1, shape = 0, ...) # Generalised Pareto (package 'evd')
  gumbelMode(loc = 0, ...) # Gumbel (package 'evd')
  hypMode(alpha = 1, beta = 0, delta = 1, mu = 0, 
          pm = c(1, 2, 3, 4)) # Hyperbolic (package 'fBasics')
  logisMode(location = 0, ...) # Logistic
  lnormMode(meanlog = 0, sdlog = 1) # Lognormal
  nigMode(alpha = 1, beta = 0, delta = 1, 
          mu = 0, ...) # Normal Inverse Gaussian (package 'fBasics')
  stableMode(alpha, beta, gamma = 1, delta = 0, pm = 0, ...) # Stable (package 'fBasics')
  symstbMode(...) # Symmetric stable (package 'fBasics')
  rweibullMode(loc = 0, scale = 1, shape = 1, ...) # Negative Weibull (package 'evd')
  tMode(df, ncp = 0) # T (Student)
  unifMode(min = 0, max = 1) # Uniform
  weibullMode(shape, scale = 1, ...) # Weibull
  
  ## Discrete distributions
  bernMode(prob) # Bernoulli
  binomMode(size, prob) # Binomial
  geomMode(...) # Geometric
  hyperMode(m, n, k, ...) # Hypergeometric
  nbinomMode(size, prob, mu) # Negative Binomial
  poisMode(lambda) # Poisson

Arguments

shape1, shape2, ncp, location, df, df1, df2, loc, scale, shape,
rate, mean, alpha, beta, delta, mu, lambda, pm, meanlog, sdlog,
gamma, min, max, prob, size, m, n, k
The different arguments are those of the corresponding distribution functions.
...
Further arguments, which will be ignored.

Value

  • A numeric value is returned, the (true) mode of the distribution.

See Also

mlv for the estimation of the mode; the documentation of the related distributions Beta, GammaDist, etc.

Examples

Run this code
layout(mat = matrix(1:2,1,2))

## Beta distribution
curve(dbeta(x, shape1 = 2, shape2 = 3.1), xlim = c(0,1), ylab = "Beta density")
M <- betaMode(shape1 = 2, shape2 = 3.1)
abline(v = M, col = 2)
mlv("beta", shape1 = 2, shape2 = 3.1)
 
## Lognormal distribution          
curve(dlnorm(x, meanlog = 3, sdlog = 1.1), xlim = c(0, 10), ylab = "Lognormal density")
M <- lnormMode(meanlog = 3, sdlog = 1.1)
abline(v = M, col = 2)
mlv("lnorm", meanlog = 3, sdlog = 1.1) 

## Poisson distribution
poisMode(lambda = 6)
poisMode(lambda = 6.1)
mlv("poisson", lambda = 6.1)

layout(mat = matrix(1,1,1))

Run the code above in your browser using DataLab