Description Usage Arguments Details Value Examples
This function is used to generate random samples from left-truncated normal distribution with specified mean and variance.
1 |
n |
Numeric scalar representing the number of observations. Must be greater than or equal to 1. |
mu |
Mean value of the underlying normal random variable |
sd |
Standard deviation of underlying normal random variable |
a |
Numeric vector indicating the left-truncation value. |
Our goal is to draw samples from the left truncated normal random variable Y_{i}^{*}. We define this distribution as
Y_{i}^{*}\sim TN(μ, σ^{2}, a)
Sampling is performed by first drawing from a random variable Z with a uniform distribution on the interval [0, 1] to generate cumulative density probabilities, p. Then the inverse density function of the truncated normal random variable is applied to generate our desired truncated normal observations.
This inverse truncated normal function is shown below:
Y_{i}^{*}=Φ^{-1}\Bigg\{p\times\bigg[1-Φ\big(\frac{a-μ}{σ}\big)\bigg] + Φ\big(\frac{a-μ}{σ}\big)\Bigg\}\timesσ+μ,
where p represents the probabilities sampled from the uniform distribution.
If the mean, mu
, is specified as a vector then the standard
deviation, sigma
, must have either:
same length as mu
be a scalar, indicating that all samples have constant standard deviation
Returns a vector of samples drawn from the left truncated normal distribution equal to length n.
1 2 |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.