utpn {tpn} | R Documentation |
Truncated positive normal
Description
Density, distribution function and random generation for the unit truncated positive normal (utpn) type 1 or 2 discussed in Gomez, Gallardo and Santoro (2021).
Usage
dutpn(x, sigma = 1, lambda = 0, type = 1, log = FALSE)
putpn(x, sigma = 1, lambda = 0, type = 1, lower.tail = TRUE, log = FALSE)
qutpn(p, sigma = 1, lambda = 0, type = 1)
rutpn(n, sigma = 1, lambda = 0, type = 1)
Arguments
x |
vector of quantiles |
n |
number of observations |
p |
vector of probabilities |
sigma |
scale parameter for the distribution |
lambda |
shape parameter for the distribution |
type |
to distinguish the type of the utpn model: 1 (default) or 2. |
log |
logical; if TRUE, probabilities p are given as log(p). |
lower.tail |
logical; if TRUE (default), probabilities are P[X <= x] otherwise, P[X > x]. |
Details
Random generation is based on the inverse transformation method.
Value
dutpn gives the density, putpn gives the distribution function, qutpn provides the quantile function and rutpn generates random deviates.
The length of the result is determined by n for rtpn, and is the maximum of the lengths of the numerical arguments for the other functions.
The numerical arguments other than n are recycled to the length of the result. Only the first elements of the logical arguments are used.
A variable has utpn distribution with scale parameter \sigma>0
and shape parameter \lambda \in
R if its probability density
function can be written as
f(y; \sigma, \lambda) = \frac{\phi\left(\frac{1-y}{\sigma y}-\lambda\right)}{\sigma y^2\Phi(\lambda)}, y>0, \mbox{(type 1),}
f(y; \sigma, \lambda) = \frac{\phi\left(\frac{y}{\sigma (1-y)}-\lambda\right)}{\sigma (1-y)^2\Phi(\lambda)}, y>0, \mbox{(type 2),}
f(y; \sigma, \lambda) = \frac{\phi\left(\frac{\log(y)}{\sigma}+\lambda\right)}{\sigma y\Phi(\lambda)}, y>0, \mbox{(type 3),}
f(y; \sigma, \lambda) = \frac{\phi\left(\frac{\log(1-y)}{\sigma}+\lambda\right)}{\sigma (1-y)\Phi(\lambda)}, y>0, \mbox{(type 4),}
where \phi(\cdot)
and \Phi(\cdot)
denote the density and cumulative distribution functions for the standard normal distribution.
Author(s)
Gallardo, D.I.
References
Gomez, H.J., Olmos, N.M., Varela, H., Bolfarine, H. (2018). Inference for a truncated positive normal distribution. Applied Mathemetical Journal of Chinese Universities, 33, 163-176.
Examples
dutpn(c(0.1,0.2), sigma=1, lambda=-1)
putpn(c(0.1,0.2), sigma=1, lambda=-1)
rutpn(n=10, sigma=1, lambda=-1)