Exp {joker}R Documentation

Exponential Distribution

Description

The Exponential distribution is a continuous probability distribution often used to model the time between independent events that occur at a constant average rate. It is defined by the rate parameter \lambda > 0.

Usage

Exp(rate = 1)

## S4 method for signature 'Exp,numeric'
d(distr, x, log = FALSE)

## S4 method for signature 'Exp,numeric'
p(distr, q, lower.tail = TRUE, log.p = FALSE)

## S4 method for signature 'Exp,numeric'
qn(distr, p, lower.tail = TRUE, log.p = FALSE)

## S4 method for signature 'Exp,numeric'
r(distr, n)

## S4 method for signature 'Exp'
mean(x)

## S4 method for signature 'Exp'
median(x)

## S4 method for signature 'Exp'
mode(x)

## S4 method for signature 'Exp'
var(x)

## S4 method for signature 'Exp'
sd(x)

## S4 method for signature 'Exp'
skew(x)

## S4 method for signature 'Exp'
kurt(x)

## S4 method for signature 'Exp'
entro(x)

## S4 method for signature 'Exp'
finf(x)

llexp(x, rate)

## S4 method for signature 'Exp,numeric'
ll(distr, x)

eexp(x, type = "mle", ...)

## S4 method for signature 'Exp,numeric'
mle(distr, x, na.rm = FALSE)

## S4 method for signature 'Exp,numeric'
me(distr, x, na.rm = FALSE)

vexp(rate, type = "mle")

## S4 method for signature 'Exp'
avar_mle(distr)

## S4 method for signature 'Exp'
avar_me(distr)

Arguments

rate

numeric. The distribution parameter.

distr

an object of class Exp.

x

For the density function, x is a numeric vector of quantiles. For the moments functions, x is an object of class Exp. For the log-likelihood and the estimation functions, x is the sample of observations.

log, log.p

logical. Should the logarithm of the probability be returned?

q

numeric. Vector of quantiles.

lower.tail

logical. If TRUE (default), probabilities are P(X \leq x), otherwise P(X > x).

p

numeric. Vector of probabilities.

n

number of observations. If length(n) > 1, the length is taken to be the number required.

type

character, case ignored. The estimator type (mle or me).

...

extra arguments.

na.rm

logical. Should the NA values be removed?

Details

The probability density function (PDF) of the Exponential distribution is given by:

f(x; \lambda) = \lambda e^{-\lambda x}, \quad x \geq 0 .

Value

Each type of function returns a different type of object:

See Also

Functions from the stats package: dexp(), pexp(), qexp(), rexp()

Examples

# -----------------------------------------------------
# Exp Distribution Example
# -----------------------------------------------------

# Create the distribution
rate <- 5
D <- Exp(rate)

# ------------------
# dpqr Functions
# ------------------

d(D, c(0.3, 2, 10)) # density function
p(D, c(0.3, 2, 10)) # distribution function
qn(D, c(0.4, 0.8)) # inverse distribution function
x <- r(D, 100) # random generator function

# alternative way to use the function
df <- d(D) ; df(x) # df is a function itself

# ------------------
# Moments
# ------------------

mean(D) # Expectation
median(D) # Median
mode(D) # Mode
var(D) # Variance
sd(D) # Standard Deviation
skew(D) # Skewness
kurt(D) # Excess Kurtosis
entro(D) # Entropy
finf(D) # Fisher Information Matrix

# List of all available moments
mom <- moments(D)
mom$mean # expectation

# ------------------
# Point Estimation
# ------------------

ll(D, x)
llexp(x, rate)

eexp(x, type = "mle")
eexp(x, type = "me")

mle(D, x)
me(D, x)
e(D, x, type = "mle")

mle("exp", x) # the distr argument can be a character

# ------------------
# Estimator Variance
# ------------------

vexp(rate, type = "mle")
vexp(rate, type = "me")

avar_mle(D)
avar_me(D)

v(D, type = "mle")

[Package joker version 0.14.2 Index]