dnormhnorm {dsfa} R Documentation

## Normal-halfnormal distribution

### Description

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

### Usage

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

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

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

rnormhnorm(n, mu = 0, sigma_v = 1, sigma_u = 1, s = -1, check = TRUE)


### Arguments

 x vector of quantiles. mu vector of \mu sigma_v vector of \sigma_V. Must be positive. sigma_u vector of \sigma_U. 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 quantiles. lower.tail logical; if TRUE (default), probabilities are P[X \le x] otherwise, P[X > x]. p vector of probabilities. n number of observations.

### Details

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

f_\mathcal{E}(\epsilon)=\frac{1}{\sqrt{\sigma_V^2+\sigma_U^2}} \phi(\frac{\epsilon-\mu}{\sqrt{\sigma_V^2+\sigma_U^2}}) \Phi(s \frac{\sigma_U}{\sigma_V} \frac{x-\mu}{\sqrt{\sigma_V^2+\sigma_U^2}}) \qquad,

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

### Value

dnormhnorm gives the density, pnormhnorm give the distribution function, qnormhnorm gives the quantile function, and rnormhnorm 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

• pnormhnorm(): distribution function for the normal-halfnormal distribution.

• qnormhnorm(): quantile function for the normal-halfnormal distribution.

• rnormhnorm(): random number generation for the normal-halfnormal distribution.

### References

• Aigner D, Lovell CK, Schmidt P (1977). “Formulation and estimation of stochastic frontier production function models.” Journal of econometrics, 6(1), 21–37.

• Kumbhakar SC, Wang H, Horncastle AP (2015). A practitioner's guide to stochastic frontier analysis using Stata. Cambridge University Press.

• Schmidt R, Kneib T (2020). “Analytic expressions for the Cumulative Distribution Function of the Composed Error Term in Stochastic Frontier Analysis with Truncated Normal and Exponential Inefficiencies.” arXiv preprint arXiv:2006.03459.

• Gradshteyn IS, Ryzhik IM (2014). Table of integrals, series, and products. Academic press.

• Azzalini A (2013). The skew-normal and related families, volume 3. Cambridge University Press.

### Examples

pdf <- dnormhnorm(x=seq(-3, 3, by=0.1), mu=1, sigma_v=2, sigma_u=3, s=-1)
cdf <- pnormhnorm(q=seq(-3, 3, by=0.1), mu=1, sigma_v=2, sigma_u=3, s=-1)
q <- qnormhnorm(p=seq(0.1, 0.9, by=0.1), mu=1, sigma_v=2, sigma_u=3, s=-1)
r <- rnormhnorm(n=100, mu=1, sigma_v=2, sigma_u=3, s=-1)



[Package dsfa version 1.0.1 Index]