Title: | Truncated Normal Distribution |
---|---|
Description: | Density, probability, quantile and random number generation functions for the truncated normal distribution. |
Authors: | Olaf Mersmann [aut, cre], Heike Trautmann [aut], Detlef Steuer [aut], Björn Bornkamp [aut] |
Maintainer: | Olaf Mersmann <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.0-9 |
Built: | 2024-11-03 05:57:17 UTC |
Source: | https://github.com/olafmersmann/truncnorm |
Density, distribution function, quantile function, random generation and expected value function for the truncated normal distribution with mean equal to 'mean' and standard deviation equal to 'sd'.
dtruncnorm(x, a=-Inf, b=Inf, mean = 0, sd = 1) ptruncnorm(q, a=-Inf, b=Inf, mean = 0, sd = 1) qtruncnorm(p, a=-Inf, b=Inf, mean = 0, sd = 1) rtruncnorm(n, a=-Inf, b=Inf, mean = 0, sd = 1) etruncnorm(a=-Inf, b=Inf, mean=0, sd=1) vtruncnorm(a=-Inf, b=Inf, mean=0, sd=1)
dtruncnorm(x, a=-Inf, b=Inf, mean = 0, sd = 1) ptruncnorm(q, a=-Inf, b=Inf, mean = 0, sd = 1) qtruncnorm(p, a=-Inf, b=Inf, mean = 0, sd = 1) rtruncnorm(n, a=-Inf, b=Inf, mean = 0, sd = 1) etruncnorm(a=-Inf, b=Inf, mean=0, sd=1) vtruncnorm(a=-Inf, b=Inf, mean=0, sd=1)
x , q
|
vector of quantiles. |
p |
vector of probabilites. |
n |
number of observations. If 'length(n) > 1', the length is taken to be the number required. |
a |
vector of lower bounds. These may be |
b |
vector of upper bounds. These may be |
mean |
vector of means. |
sd |
vector of standard deviations. |
If mean
or sd
are not specified they assume the default values of
0
and 1
, respectively. The values of a
, b
,
mean
and sd
are recycled as needed.
The numerical arguments other than n
are recycled to the length
of the result.
'dtruncnorm' gives the density, 'ptruncnorm' gives the distribution function, 'qtruncnorm' gives the quantile function, 'rtruncnorm' generates random deviates, 'etruncnorm' gives the expected value and 'vtruncnorm' the variance of the distribution.
Heike Trautmann [email protected],
Detlef Steuer [email protected],
Olaf Mersmann [email protected] and
Björn Bornkamp [email protected] who donated a
much improved rtruncnorm
implementation using an accept-reject sampler.
The accept-reject sampler follows the description given in
Geweke, J. (1991). Efficient simulation from the multivariate normal and student-t distributions subject to linear constraints. In Computing Science and Statistics: Proceedings of the 23rd Symposium on the Interface, Ed. E. Keramidas and S. Kaufman, pp. 571-8. Fairfax Station, VA: Interface Foundation of North America.