dnormexp {dsfa}R Documentation

Normal-exponential distribution

Description

Probablitiy density function, distribution, quantile function and random number generation for the normal-exponential distribution.

Usage

dnormexp(
  x,
  mu = 0,
  sigma_v = 1,
  lambda = 1,
  s = -1,
  deriv = 0,
  tri = NULL,
  log.p = FALSE,
  check = TRUE
)

pnormexp(
  q,
  mu = 0,
  sigma_v = 1,
  lambda = 1,
  s = -1,
  deriv = 0,
  tri = NULL,
  lower.tail = TRUE,
  log.p = FALSE,
  check = TRUE
)

qnormexp(
  p,
  mu = 0,
  sigma_v = 1,
  lambda = 1,
  s = -1,
  lower.tail = TRUE,
  log.p = FALSE,
  check = TRUE
)

rnormexp(n, mu = 0, sigma_v = 1, lambda = 1, s = -1, check = TRUE)

Arguments

x

vector of quantiles.

mu

vector of \mu

sigma_v

vector of \sigma_V. Must be positive.

lambda

vector of \lambda. Must be positive.

s

s=-1 for production and s=1 for cost function.

deriv

derivative of order deriv of the log density. Available are 0,2 and 4.

tri

optional, index arrays for upper triangular matrices, generated by trind.generator() and supplied to chainrule().

log.p

logical; if TRUE, probabilities p are given as log(p).

check

logical; if TRUE, check inputs.

q

vector of probabilities.

lower.tail

logical; if TRUE (default), probabilities are P[X \le x] otherwise, P[X > x].

p

vector of quantiles.

n

number of observations.

Details

A random variable \mathcal{E} follows a normal-exponential distribution if \mathcal{E} = V + s \cdot U , where V \sim N(\mu, \sigma_V^2) and U \sim Exp(\lambda). The density is given by

f_\mathcal{E}(\epsilon)=\frac{\lambda}{2} \exp \{\lambda (s \mu) + \frac{1}{2} \lambda^2 \sigma_V^2-\lambda (s \epsilon) \} 2 \Phi(\frac{1}{\sigma_V} (-s \mu)-\lambda \sigma_V+\frac{1}{\sigma_V}(s \epsilon)) \qquad,

where s=-1 for production and s=1 for cost function.

Value

dnormexp gives the density, pnormexp give the distribution function, qnormexp gives the quantile function, and rnormexp generates random numbers, with given parameters. If the derivatives are calculated these are provided as the attributes gradient, hessian, l3 and l4 of the output of the density.

Functions

References

Examples

pdf <- dnormexp(x=seq(-3, 3, by=0.1), mu=1, sigma_v=2, lambda=1/3, s=1)
cdf <- pnormexp(q=seq(-3, 3, by=0.1), mu=1, sigma_v=2, lambda=1/3, s=1)
q <- qnormexp(p=seq(0.1, 0.9, by=0.1), mu=1, sigma_v=2, lambda=1/3, s=1)
r <- rnormexp(n=100, mu=1, sigma_v=2, lambda=1/3, s=1)


[Package dsfa version 1.0.1 Index]