Density, distribution function, quantile function and random generation for the univariate positive-normal distribution.

dposnorm(x, mean = 0, sd = 1, log = FALSE)
pposnorm(q, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE)
qposnorm(p, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE)
rposnorm(n, mean = 0, sd = 1)

Arguments

x, q

vector of quantiles.

p

vector of probabilities.

n

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

mean, sd, log, lower.tail, log.p

see rnorm.

Value

dposnorm gives the density, pposnorm gives the distribution function, qposnorm gives the quantile function, and rposnorm generates random deviates.

Author

T. W. Yee

Details

See posnormal, the VGAM family function for estimating the parameters, for the formula of the probability density function and other details.

See also

Examples

if (FALSE)  m <-  0.8; x <- seq(-1, 4, len = 501)
plot(x, dposnorm(x, m = m), type = "l", las = 1, ylim = 0:1,
     ylab = paste("posnorm(m = ", m, ", sd = 1)"), col = "blue",
     main = "Blue is density, orange is the CDF",
     sub = "Purple lines are the 10,20,...,90 percentiles")
#> Error in h(simpleError(msg, call)): error in evaluating the argument 'y' in selecting a method for function 'plot': object 'm' not found
abline(h = 0, col = "grey")
#> Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...): plot.new has not been called yet
lines(x, pposnorm(x, m = m), col = "orange", type = "l")
#> Error: object 'm' not found
probs <- seq(0.1, 0.9, by = 0.1)
Q <- qposnorm(probs, m = m)
#> Error: object 'm' not found
lines(Q, dposnorm(Q, m = m), col = "purple", lty = 3, type = "h")
#> Error: object 'Q' not found
lines(Q, pposnorm(Q, m = m), col = "purple", lty = 3, type = "h")
#> Error: object 'Q' not found
abline(h = probs, col = "purple", lty = 3)
#> Error in int_abline(a = a, b = b, h = h, v = v, untf = untf, ...): plot.new has not been called yet
max(abs(pposnorm(Q, m = m) - probs))  # Should be 0
#> Error: object 'Q' not found
 # \dontrun{}