Learn R Programming

modeest (version 2.0)

distribMode: Computing the Mode of Some Distributions

Description

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

Usage

## Continuous distributions
  
  # Beta
  betaMode(shape1, shape2, ncp = 0) 
  
  # Cauchy
  cauchyMode(location = 0, ...) 
  
  # Chisquare
  chisqMode(df, ncp = 0) 
  
  # Exponentiel
  expMode(...) 
  
  # F
  fMode(df1, df2) 
  
  # Fisk (package 'VGAM')
  fiskMode(shape1.a, scale = 1)
  
  # Frechet (package 'evd')
  frechetMode(loc = 0, scale = 1, shape = 1, ...) 
  
  # Gamma
  gammaMode(shape, rate = 1, scale = 1/rate) 
  
  # Normal (Gaussian)
  normMode(mean = 0, ...) 
  
  # Generalised Extreme Value (package 'evd')
  gevMode(loc = 0, scale = 1, shape = 0, ...) 
  
  # Generalised Hyperbolic (package 'fBasics')
  ghMode(alpha = 1, beta = 0, delta = 1, mu = 0, 
         lambda = 1, ...) 

  # Gompertz (package 'VGAM')
  gompertzMode(shape, scale = 1)
  
  # Generalised Pareto (package 'evd')
  gpdMode(loc = 0, scale = 1, shape = 0, ...) 
  
  # Gumbel (package 'evd')
  gumbelMode(loc = 0, ...) 
  
  # Hyperbolic (package 'fBasics')
  hypMode(alpha = 1, beta = 0, delta = 1, mu = 0, 
          pm = c(1, 2, 3, 4)) 
  
  # Koenker (package 'VGAM')
  koenkerMode(location = 0, ...)

  # Kumaraswamy (package 'VGAM')
  kumarMode(shape1, shape2)
  
  # Laplace (package 'VGAM')
  laplaceMode(location = 0, ...)
  
  # Logistic
  logisMode(location = 0, ...) 
  
  # Lognormal
  lnormMode(meanlog = 0, sdlog = 1) 
  
  # Normal Inverse Gaussian (package 'fBasics')
  nigMode(alpha = 1, beta = 0, delta = 1, mu = 0, ...) 
  
  # Stable (package 'fBasics')
  stableMode(alpha, beta, gamma = 1, delta = 0, pm = 0, ...) 
  
  # Negative Weibull (package 'evd')
  rweibullMode(loc = 0, scale = 1, shape = 1, ...) 
  
  # T (Student)
  tMode(df, ncp = 0) 
  
  # Uniform
  unifMode(min = 0, max = 1)

  # Weibull
  weibullMode(shape, scale = 1, ...)
  
  ## Discrete distributions
  
  # Bernoulli
  bernMode(prob) 
  
  # Binomial
  binomMode(size, prob) 
  
  # Geometric
  geomMode(...) 
  
  # Hypergeometric
  hyperMode(m, n, k, ...) 
  
  # Negative Binomial
  nbinomMode(size, prob, mu) 
  
  # Poisson
  poisMode(lambda)

Arguments

shape1
First positive parameter of the Beta and Kumaraswamy distributions. See the package VGAM for more details.
shape2
Second positive parameter of the Beta and Kumaraswamy distributions. See the package VGAM for more details.
shape1.a
Shape parameter of the Fisk distribution. See the package VGAM for more details.
ncp
Non-centrality parameter of the Beta, Chisquare, and Student distributions.
location
Location parameter of the Cauchy, Koenker, Laplace, and Logistic distributions. See the package VGAM for more details.
df
Degree of freedom of the Chisquare and Student distributions.
df1
First degree of freedom of the F distribution.
df2
Second degree of freedom of the F distribution.
loc
Location parameter of the Fr'{e}chet, Generalized Extreme Value, Generalized Pareto, Gumbel, and Negative Weibull distributions.
scale
Scale parameter of the Fisk, Fr'{e}chet, Gamma, Generalized Extreme Value, Gompertz, Generalized Pareto, Negative Weibull, and Weibull distributions. See the packages evd and VGAM for more details.
shape
Shape parameter of the Fr'{e}chet, Gamma, Generalized Extreme Value, Gompertz, Generalized Pareto, Negative Weibull, and Weibull distributions. See the packages evd and VGAM for more details.
rate
An alternative way to specify the scale of the Gamma distribution.
mean
Mean of the Normal distribution.
alpha
Parameter of the Hyperbolic, Generalised Hyperbolic, Stable, and Normal Inverse Gaussian distributions. See the packages fBasics and stabledist for more details.
beta
Parameter of the Hyperbolic, Generalised Hyperbolic, Stable, and Normal Inverse Gaussian distributions. See the packages fBasics and stabledist for more details.
delta
Parameter of the Hyperbolic, Generalised Hyperbolic, Stable, and Normal Inverse Gaussian distributions. See the packages fBasics and stabledist for more details.
mu
Parameter of the Hyperbolic, Generalised Hyperbolic, Normal Inverse Gaussian, and Negative binomial distributions. See the package fBasics for more details.
lambda
Vector of (non-negative) means of the Poisson distribution.
pm
Integer value for the selection of the parameterization of the Hyperbolic and Stable distributions. See the packages fBasics and stabledist for more details.
meanlog
Mean of the Lognormal distribution on the log scale.
sdlog
Standard deviation of the Lognormal distribution on the log scale.
gamma
Scale parameter of the Stable distribution. See the package stabledist for more details.
min
Lower limit of the Uniform distribution. Must be finite.
max
Upper limit of the Uniform distribution. Must be finite.
prob
Probability of success on each trial (between 0 and 1), used in the Bernoulli, Binomial and Negative Binomial distributions.
size
Number of trials (zero or more), used in the Binomial and Negative Binomial distributions.
m
Number of white balls in the urn for the Hypergeometric distribution.
n
Number of black balls in the urn for the Hypergeometric distribution.
k
Number of balls drawn from the urn for the Hypergeometric distribution.
...
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