| Normal_ct | R Documentation |
Distribution function and random generation for the center (between a lower and an upper bound) of the normal distribution with mean equal to mu and standard deviation equal to sigma.
pnorm_ct(a = -Inf, b = Inf, mu = 0, sigma = 1, log.p = TRUE, Diff = FALSE)
rnorm_ct(n, lgrt, lglt, mu = 0, sigma = 1)
a |
Lower bound for the interval. Numeric vector; must be finite when used in |
b |
Upper bound for the interval. Numeric vector; must be finite when used in |
mu |
mean parameter of the underlying normal distribution. |
sigma |
standard deviation of the underlying normal distribution. |
log.p |
Logical argument. If |
Diff |
Logical argument. If |
n |
number of draws to generate. If |
lgrt |
log of the distribution function between the
lower bound and infinity. Numeric vectors of length |
lglt |
log of the distribution function between negative
infinity and the upper bound. Numeric vectors of length |
The distribution function pnorm_ct finds the probability of the center of a normal density (the probability of the area between a lower bound a and an upper bound b) while the random number generator rnorm_ct samples from a restricted normal density where lgrt is the log of the distribution between the lower bound and infinity and lglt is the log of the distribution function between negative infinity and the upper bound. The sum of the exponentiated values for the two (exp(lgrt)+exp(lglt)) must sum to more than 1.
These functions are mainly used to handle cases where the differences
between the upper and lower bounds b-a are small. In such cases,
using pnorm(b)-pnorm(a) may result in 0 being returned even when the
difference is supposed to be positive. They are used in envelope-based
accept-reject sampling for Bayesian GLMs \insertCiteNygren2006glmbayes.
For pnorm_ct, vector of length equal to length of a and for
rnorm_ct, a vector with length determined by n containing draws from
the center of the normal distribution.
Gamma_ct, EnvelopeBuild
pnorm_ct(0.2,0.4)
exp(pnorm_ct(0.2,0.4))
pnorm_ct(0.2,0.4,log.p=FALSE)
log(pnorm_ct(0.2,0.4,log.p=FALSE))
## Example where difference between two pnorm calls fail
## but call to pnorm_ct works
pnorm(0.5)-pnorm(0.4999999999999999)
pnorm_ct(0.4999999999999999,0.5,log.p=FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.