tpn {tpn} | R Documentation |
Truncated positive normal
Description
Density, distribution function and random generation for the slash truncated positive normal (stpn) discussed in Gomez, Gallardo and Santoro (2021).
Usage
dtpn(x, sigma, lambda, log = FALSE)
ptpn(x, sigma, lambda, lower.tail=TRUE, log=FALSE)
rtpn(n, sigma, lambda)
Arguments
x |
vector of quantiles |
n |
number of observations |
sigma |
scale parameter for the distribution |
lambda |
shape parameter for the distribution |
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
dtpn gives the density, ptpn gives the distribution function and rtpn 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 have tpn distribution with parameters \sigma>0
and \lambda \in
R if its probability density
function can be written as
f(y; \sigma, \lambda, q) = \frac{\phi\left(\frac{y}{\sigma}-\lambda\right)}{\sigma \Phi(\lambda)}, y>0,
where \phi(\cdot)
and \Phi(\cdot)
denote the density and cumultative distribution functions for the standard normal distribution.
Author(s)
Gallardo, D.I. and Gomez, H.J.
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
dtpn(c(1,2), sigma=1, lambda=-1)
ptpn(c(1,2), sigma=1, lambda=-1)
rtpn(n=10, sigma=1, lambda=-1)