tnorm: Truncated univariate normal distribution

tnormR Documentation

Truncated univariate normal distribution

Description

The function provides efficient state-of-the-art random number generation of a vector of truncated univariate distribution of the same length as the lower bound vector. The function is vectorized and the vector of means mu and of standard deviations sd are recycled.

If mu or sd are not specified they assume the default values of 0 and 1, respectively.

Arguments

n

number of observations

p

vector or matrix of probabilities

mu

vector of means

sd

vector of standard deviations

lb

vector of lower truncation limits

ub

vector of upper truncation limits

method

string, either of fast or invtransfo

Value

vector or matrix of random variates (rtnorm) or of quantiles (ptnorm), depending on the input

Examples

rtnorm(n = 10, mu = 2, lb = 1:10, ub = 2:11, method = "fast")
qtnorm(runif(10), mu = 2, lb = 1:10, ub = 2:11, sd = 1)

lbelzile/TruncatedNormal documentation built on March 4, 2024, 5:50 p.m.