Description Usage Arguments Details Value References See Also Examples
Density, distribution function, quantile function and random generation for truncated distributions.
1 2 3 4 5 6 |
n |
This is a the number of random draws for |
p |
This is a vector of probabilities. |
x |
This is a vector to be evaluated. |
spec |
The base name of a probability distribution is
specified here. For example, to estimate the density of a
truncated normal distribution, enter |
a |
This is the lower bound of truncation, which defaults to negative infinity. |
b |
This is the upper bound of truncation, which defaults to infinity. |
log |
Logical. If |
... |
Additional arguments pertain to the probability
distribution specified in the |
A truncated distribution is a conditional distribution that results
from a priori restricting the domain of some other probability
distribution. More than merely preventing values outside of truncated
bounds, a proper truncated distribution integrates to one within the
truncated bounds. For more information on propriety, see
is.proper
. In contrast to a truncated distribution, a
censored distribution occurs when the probability distribution is
still allowed outside of a pre-specified range. Here, distributions
are truncated to the interval [a,b], such as p(theta) in [a,b].
The dtrunc
function is often used in conjunction with the
interval
function to truncate prior probability
distributions in the model specification function for use with these
numerical approximation functions: LaplaceApproximation
,
LaplacesDemon
, and PMC
.
The R code of Nadarajah and Kotz (2006) has been modified to work with log-densities.
dtrunc
gives the density,
extrunc
gives the expectation,
ptrunc
gives the distribution function,
qtrunc
gives the quantile function,
rtrunc
generates random deviates, and
vartrunc
gives the variance of the truncated distribution.
Nadarajah, S. and Kotz, S. (2006). "R Programs for Computing Truncated Distributions". Journal of Statistical Software, 16, Code Snippet 2, p. 1–8.
interval
,
is.proper
,
LaplaceApproximation
,
LaplacesDemon
, and
PMC
.
1 2 3 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.